Romhacking.net

Romhacking => Programming => Topic started by: tryphon on August 22, 2013, 10:20:48 am

Title: Strange 68000 effective address
Post by: tryphon on August 22, 2013, 10:20:48 am
Hello,

I'm not much used to 68000 assembler,and here's an instruction I can't figure out :

At address $B6A2, my disassembler shows :

Code: [Select]
MOVE.b *+$B654(PC, D2.w), D2
Could someone explain me where it reads the byte to put in D2 ?
When I traced the code, I had D2 = 0, PC = $B6A2, and D2 got the value $06, which is located at $B654. But I don't understand why, neither can I predict what would happen for different values of D2.
Title: Re: Strange 68000 effective address
Post by: Ti_ on August 22, 2013, 11:53:47 am
It's works like:
Code: [Select]
lea data,a0
 lea (a0,d2.w),d2
....
.....

data:
 dc.b 0,1,2,3,4,5
adress = a0+d2.


Code: [Select]
move.b table(pc,d2.w),d2
....
....
table
dc.b $11,$56,$89,$30
if d2=0, new d2 is $11
 if d2=1, new d2 is $56


In hex value of 'table' in command itself from +127/-128.  It's applies to PC like beq's, bcc's e.t.c.
Title: Re: Strange 68000 effective address
Post by: tryphon on August 22, 2013, 04:22:49 pm
Thank you :)