## News:

11 March 2016 - Forum Rules

## 68000 Mega Drive Assembly - Move Instruction

Started by RadioTails, June 30, 2019, 09:28:43 PM

So I'm a bit unsure about how this works:

MOVE.b (A4)+, D4

MOVE.b D4, (A2,D1.w)

The first one takes the byte from Address A4. So if 007000D0 in the rom contains hex DE and stores this in Data D4.

So the second instruction moves the value in D4 (in this case DE), but I don't understand what it means in the brackets. So it's referring to A2 Address and D1 word, but it doesn't make sense looking at the live disassembler.

Hopefully someone can clear that up.
Avatar by LazyNinjartist

#### jonk

My memory is vague. But I think this is the "indirect with displacement" addressing mode. If so, then D1.w specifies the address and A2 specifies the displacement from that address. The sum of the two is the address where the value in D4 is stored. So which you consider to be the base address and which is the displacement is a matter of your own choice, I think.
An equal right to an opinion isn't a right to an equal opinion. -- 1995, me
Saying religion is the source of morality is like saying a squirrel is the source of acorns.  -- 2002, me

Thank you so much jonk! That is correct, and it makes so much sense now.

MOVE.b D4, (A2,D1.w)

------------------------------

D4 = 12

A2 = FF0100
D1.w = 0000

RAM FF0100 = 12

Now to figure out this Puyo compression. I'm slowly cracking it.
Avatar by LazyNinjartist

#### RyanfaeScotland

Quote from: jonk on July 01, 2019, 02:15:45 AM
My memory is vague. But I think this is the "indirect with displacement" addressing mode. If so, then D1.w specifies the address and A2 specifies the displacement from that address. The sum of the two is the address where the value in D4 is stored. So which you consider to be the base address and which is the displacement is a matter of your own choice, I think.

You've got the premise right, just a few small details are off: in the example A2 is the address and D1 is the displacement, you can't use A registers for displacement (so for example MOVE.b D4, (A2,A1) wouldn't be valid. Also it isn't a matter of choice, it is always the way round shown, I just give it a quick try to double check and MOVE.b D4, (D1.w,A2). throws a syntax error.

Puyo sounds interesting RadioShadow, look forward to seeing what comes of it. Great to see another Megadrive fan on the go.