ok, there's a first time for everything...
I haven't used a debugger till now, so I don't know how to do what I need.
Is there some guide somewhere? I have openMSX debugger.
Actually I need to understand wich part of my code writes (accidentally) something in some RAM locations. Usually these locations aren't used but to avoid space wasting I've started to move some variables and tables there and suddenly some strange behaviors started to happen!
I've started openmsx debugger and pointed to one of these RAM addresses but it seemed unchanged until I've paused and restarted the debugger. after the restart the address content was changed (I know for sure that that address content changes, because if I move the SAT buffer around that address one of the Turrican feet change color randomly after some time)
how to use a debugger
Try to set openMSX in the breaked state, that will update the debugger's view. There's a button in the debugger for that.
You could let openMSX get into breaked state automatically when a value is written to a certain memory address. For that, set a watchpoint.
Exactly!
In the openMSX debugger, the easy way to do it is this:
- start the debugger and connect it to openMSX
- hit the "break" button at least once (the red circle): this is needed, as for some reason, if you don't first break openMSX, some times (about 50% in my case) any breakpoints that you set will not be actually set. You only need to break once, then you can let it continue running if you want (the "running dude" button).
- in the "breakpoint" menu at the top, click "Add ..."
- then select the "Memory write watchpoint" type, and specify the address or range you want to detect
- there you go, let your game run, and the debugger will stop as soon as an instruction writes there!
Something that is amazing in openMSX is that once you are in a breakpoint, you can actually "step back in time", to see what happened earlier that led to the state you are in. If you want to go back step by step click the "step back" button in the debugger. If you want to go back longer intervals (e.g., a whole frame, or 10 seconds), then it's easier to do it from the console of openMSX itself, for example: "rewind goback 0.1" will go back 0.1 seconds in time).
openMSX is amazing for debugging. So, I'm sure you'll find the issue
Thank you Manuel and Santi! Tomorrow I will try to apply your hints
You can also use the openMSX console (F10) an add watch or break points from there (with the debugger attached, of course).
For example:
debug set_watchpoint read_mem 0x1234
debug set_watchpoint read_io 0x2E
Thanks!
for example: "rewind goback 0.1" will go back 0.1 seconds in time).
Small correction: reverse goback 0.1
ooops, true, thanks Manuel
for example: "rewind goback 0.1" will go back 0.1 seconds in time).
Small correction: reverse goback 0.1
There’s also prev_frame
and next_frame
which I use quite regularly.
Solved! It tooks me literally 12 minutes thanks to the debugger! Nevermore without!
Wohoo!! Nice! It's an extremely useful tool!