oziphantom
Registered: Oct 2014 Posts: 490 |
6502 Static Analyser
I've been working on a python script that I can run over 64tass's output to help me track bugs. At the moment it has the concept of a function, trashing a register or variable or modifying it. This then allows me to put in commands to verify that a function does not trash something.
pressA
;&&trashes a,x,y,Pointer1,Pointer1+1,Pointer2,Pointer2+1
;&&modifies CursorX
lda CursorX
beq KeyboardRoutine._exitPLA
clc
adc #24
tay
jsr restoreVerticalDigitsBar ;&&preserve y
dey
jsr setVerticalDigitsBarToCurrent
dec CursorX
rts
So here the system knows what is trashed. What is modified and assets that `restoreVerticalDigitsBar` does not trash or modify y.
When I wrote `restoreVerticalDigitsBar` it didn't but at some point I might add a feature, re factor the code to save a clock or so, and then trash y, which will give me a really hard to track down bug. Here the Build will catch and error for me.
The system will parse the code and report anything that is trashed that is not reported. It is a little annoying in that a parent function must also list everything its child functions trash, but this keeps it simple and allows you to see the whole tree when you look at just one function. The script also spits out a single HTML file which kind of acts like documentation. It will list name, address, size, what it calls,trashes and modifies. Handy for when you need to look up a function in the Win Vice debugger.
What else do you think would be useful? |