views:

157

answers:

1

Please can someone explain to me how i can write a short segments of instructions to move the most significant byte in register D7 to the memory location $8000.

this is how i understand it, but i m not sure i am doing it write...please can you help me correct it...

Lets assume that D1= 31;

BTST D1, D7;

MOVE.W SR, ($8000)

+1  A: 

The byte operations on the MC68000 (as far as I can recall, and having just looked at the reference manual) will only work on the least significant byte of a register. I'm a bit rusty on this, not having programmed a 68k for nearly 20 years...

You'll therefore have to shift the register right 24 bits first, and then store it, or to avoid using another register (because only shifts of 8 bits or less can use an immediate value) use:

ROL.L #8, D7
MOVE.B D7, (A0)

The ROL instructions move bits out of one end of the register and back into the other, so an 8 bit left roll also ends up moving the top byte into the bottom byte.

Alnitak