View Single Post
Old 05 May 2020, 13:17   #3
Registered User

Join Date: Jan 2019
Location: Brisbane
Posts: 70
Originally Posted by meynaf View Post
That's because $ff is seen as 255, not -1.
If you write moveq #$ffffffff,d7 then it will work.
Because #$ff in as a long is positive (moveq == moveq.l faster but functionally equivalent to move.l)
#$ff as a word is still positive (move.w)
#$ff as a byte is negative (move.b)

#-1 is negative in any type (8/16/32 bits), sign extending to long it remains negative

You may be interested to try in the debugger

sub.l d0,d0 ; just clear
move.b #$ff,d0 ; negative - see N flag is set
ext.w d0 ; still negative - n flag is still set
ext.l d0 ; still negative .... n flag set
sub.l d0,d0 ; just clear
move.w #$ff,d0 ; positive - see N flag is not set
ext.l d0 ; still positive .. N flag is not set
#$ff is always 255. It can also be -1 in the case of a byte.

Try with -1 and see what happens. Hope this helps! seems Abacus has led you astray here!
Auscoder is offline  
Page generated in 0.04946 seconds with 11 queries