Thursday, February 18, 2016

Perfecting the trace

I discovered how to print memory in the mame debugger.

If you type "help expressions" it gives you a nice rundown.

you can print

b@addr byte
w@addr word
d@addr doubleword
q@addr quadword

and you can prefix with (p=program, d=data, i=io) so pw@9921 will mean the word at program memory space 9921.

So now I've got a pretty good tracelog line:

trace trace0.txt,0,{tracelog "A=%02X EA=%04X HL=%04X DE=%04X BC=%04X SKIP=%1X 9921=%04X | ",a,ea,hl,de,bc,(psw&0x20)!=0,pw@9921}

and it generates:
A=00 EA=00D1 HL=C002 DE=000A BC=0090 SKIP=0 9921=0286  |  0008: EXX     
A=00 EA=00D1 HL=7B76 DE=0000 BC=0200 SKIP=0 9921=0286  |  0009: EXA     
A=CB EA=0286 HL=7B76 DE=0000 BC=0200 SKIP=0 9921=0286  |  000A: JMP     $9817
A=CB EA=0286 HL=7B76 DE=0000 BC=0200 SKIP=0 9921=0286  |  9817: JMP     $7A04
A=CB EA=0286 HL=7B76 DE=0000 BC=0200 SKIP=0 9921=0286  |  7A04: DMOV    EA,ECNT
A=CB EA=0685 HL=7B76 DE=0000 BC=0200 SKIP=0 9921=0286  |  7A06: DMOV    HL,EA
A=CB EA=0685 HL=0685 DE=0000 BC=0200 SKIP=0 9921=0286  |  7A07: SHLD    $9921
A=CB EA=0685 HL=0685 DE=0000 BC=0200 SKIP=0 9921=0685  |  7A0B: CALL    $7A34
A=CB EA=0685 HL=0685 DE=0000 BC=0200 SKIP=0 9921=0685  |  7A34: ONIW    VV:0F,$41
A=CB EA=0685 HL=0685 DE=0000 BC=0200 SKIP=0 9921=0685  |  7A37: RET     

No comments:

Post a Comment