News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: 68000 Mega Drive Assembly - Move Instruction  (Read 331 times)

RadioShadow

  • Sr. Member
  • ****
  • Posts: 327
  • Holding the Mega Drive controller
    • View Profile
68000 Mega Drive Assembly - Move Instruction
« on: 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.

jonk

  • Sr. Member
  • ****
  • Posts: 273
    • View Profile
Re: 68000 Mega Drive Assembly - Move Instruction
« Reply #1 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.
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

RadioShadow

  • Sr. Member
  • ****
  • Posts: 327
  • Holding the Mega Drive controller
    • View Profile
Re: 68000 Mega Drive Assembly - Move Instruction
« Reply #2 on: July 02, 2019, 04:33:33 pm »
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. :)

RyanfaeScotland

  • Sr. Member
  • ****
  • Posts: 360
    • View Profile
    • My Brill Game Site
Re: 68000 Mega Drive Assembly - Move Instruction
« Reply #3 on: July 11, 2019, 03:35:04 pm »
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. :thumbsup:

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