Re: Debugging Advice
Posted: Mon Apr 02, 2018 5:05 pm
CRASH BUG FIXED!!
Playing with MAME's debugger I could see the program counter was shooting off into BASIC rom when the game crashed. But I could also see using a memory window onto my Sprite data structure that all of the associated sprite pointers looked fine. So I started a trace just before a section of game which was prone to crashing and hit one first attempt. Then just searched backwards through the trace and `bingo' I could see the problem immediately.
An indirect JSR was jumping to address $0000, stumbling through illegal opcodes and eventually jumping into BASIC rom where it looped indefinitely.
The cause of all this was me failing to clear a collision flag byte when sprites are initialised. This occasionally triggered a false collision on a game item which should under normal circumstances not be collidable. The item's collision look-up was null which is why the pc jumped to address $0000 following the bogus collision.
I have to say MAME's debugger has been invaluable on this but I'd still be interested to know how to create a trace file from XRoar. Ctrl+v will output to the console window, albeit XRoar stops responding in the process, but I'd be interested to know how to output to a file?
Cheers, Steve.
Playing with MAME's debugger I could see the program counter was shooting off into BASIC rom when the game crashed. But I could also see using a memory window onto my Sprite data structure that all of the associated sprite pointers looked fine. So I started a trace just before a section of game which was prone to crashing and hit one first attempt. Then just searched backwards through the trace and `bingo' I could see the problem immediately.
An indirect JSR was jumping to address $0000, stumbling through illegal opcodes and eventually jumping into BASIC rom where it looped indefinitely.
The cause of all this was me failing to clear a collision flag byte when sprites are initialised. This occasionally triggered a false collision on a game item which should under normal circumstances not be collidable. The item's collision look-up was null which is why the pc jumped to address $0000 following the bogus collision.
I have to say MAME's debugger has been invaluable on this but I'd still be interested to know how to create a trace file from XRoar. Ctrl+v will output to the console window, albeit XRoar stops responding in the process, but I'd be interested to know how to output to a file?
Cheers, Steve.