clownassembler icon indicating copy to clipboard operation
clownassembler copied to clipboard

Addressing mode Program Counter Relative with Index support?

Open czxinc opened this issue 4 months ago • 1 comments

I'm trying to research a neogeo game. I using MAME to export the code. There is a piece of code that appears frequently in the game.

090714: D040                     add.w   D0, D0
090716: D040                     add.w   D0, D0
090718: 4EFB 0002                jmp     ($2,PC,D0.w)
09071C: 6000 0046                bra     $90764
090720: 6000 0068                bra     $9078a
090724: 6000 0082                bra     $907a8
090728: 6000 008C                bra     $907b6
09072C: 6000 00AE                bra     $907dc 

This is a jumping table. My main focus is on ($2,PC,D0.w).This is a little complex addressing mode called Program Counter Relative with Index. His syntax is (d8,Dn,PC). It can be understood as jump to PCAddressNextOpcode+D0.w+d8. But after I compiled this code, its actual syntax is (label,pc,d0.w). I tried to compile this instruction on easy68k and got the same result. I'm new at disassembly. I would like to ask if the label method is standard of 68k compiler, or if it just lacks support for the d8 method?

I noticed that #20 mentioned the relevant issue. I'm also trying to use ghidra for research. But I still prefer the label method shown in the code exported by MAME.

czxinc avatar Oct 15 '25 22:10 czxinc