mhavoc
Posts: 10
Joined: Wed Apr 04, 2018 3:09 pm

trace syntax

Hi all... Im attempting to do some debugging that is pretty complex. I have my normal trace command of

trace mytrace.txt,0,logerror,{tracelog "A=%02X X=%02X Y=%02X ",a,x,y}

(PS: Im targeting the 6502).

There are several RAM variables that I would love to be able to capture in the trace too... , I thought maybe I could just add in the hex address in the parameters... something like this...

trace mytrace.txt,0,logerror,{tracelog "A=%02X X=%02X Y=%02X OBJYL=%02X ",a,x,y,0630}

but it just echo's the value of 630 into the trace string.

Does anyone have any ideas on the syntax of the action parameter beyond the basic CPU registers.. is this even possible? Are there better ways for me to dump memory locations into the trace file that Im just blindly missing?

I looked in source, but it seems that trace goes all the way back to the CPU driver perhaps and Im not a C guru, but each CPU must inherit from a base class for tracing right?

sorry for all the questions.. thank you!!

Jess
mhavoc
Posts: 10
Joined: Wed Apr 04, 2018 3:09 pm

Re: trace syntax

Following up on my own post after a few days of trial an error, reading the source and reading the syntax of other debug commands....

Firstly, the <action> can be anything that is a valid debug command. Looking under the 'Expressions' section... it talks about data memory notation... there are a few ways to notate memory locations including B and W for Byte and Word respectively... so I was able to trace memory location data like this...

trace mytrace.txt,0,,{tracelog "A=%02X var1=%02X ",a,w@0001}

Will output this...

A=00 var1=4F14 D6FF: ldx #$1f

and something more complicated like this...

trace mytrace.txt,0,,{tracelog "A=%02X X=%02X Y=%02X var1=%04X var2=%02X ",a,w@0001,b@0000}

would log the byte @ memory $0000 as var2 and the word @ memory 0001 and 0002 as var1

Return to “MAME Discussion”