Quote:
Originally Posted by StingRay
Sure does. Might be that I needed this behaviour once and my mind was playing tricks on me.
|
I tested using this code albeit on the Hatari emulator.
d1 winds up being $ff00
Code:
oddsandends
move.l sp,d0
move.w #$3344,-(sp)
move.b #$ff,d1
move.b d1,-(sp)
move.w (sp)+,d1 ; shift by 8
move.l d0,sp
rts
Seems my memory and test code was fuzzy. Here's a better test case.
Code:
oddsandends
move.l sp,d0
move.w #$3344,-(sp) ; set four bytes up with garbage
move.w #$1122,-(sp) ; " "
addq #2,sp ; point the stack at $1122
move.l sp,a1 ; stuff it in a1
move.b -1(a1),d2 ; we load $22
move.b #$ff,d1 ; then move shift value
move.b d1,-(sp) ; boom high byte is $22
move.w (sp)+,d1 ; shift by 8 and d1 is now $ff22
move.l d0,sp
rts
Indeed there's garbage in the lower byte. Care must be taken when using the stack with this trick