#954 Cast bug or subtraction bug

closed-fixed
hc08 port (43)
5
2013-05-25
2005-07-20
Anonymous
No

Hi.Look at this piece of code:

;PageOffset = (uint8_t)(Address-FLASH_GIVE_PAGE(Address));

lda 6,s
sta 1,s
lda 6,s
and #0xC0
sta 4,s
lda 5,s
sta 3,s
lda 4,s
lda 1,s
psha
sub 1,s

Variables Address and the result of FLASH_GIVE_PAGE
macro are 16
bit, variable PageOffset is 8 bit.When I try to cast
the 16 bit
result of subtraction to 8 bit variable there is a
mistake as you
can see.Very similar mistake was in 16 bit comparison bug.

Discussion

  • Erik Petrich

    Erik Petrich - 2005-07-22

    Logged In: YES
    user_id=635249

    Fixed in src/hc08/gen.c 1.37
    (SDCC version 2.5.1 #1066)

     
  • Erik Petrich

    Erik Petrich - 2005-07-22
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     

Log in to post a comment.