Page 1 of 1

DOSBox debugger

Posted: Mon Jun 10, 2019 6:48 pm
by Ferital
Hello, fellow DFU developers :)

During the last months, I've gathered some experience at reverse engineering classic mechanics. However, my current method of doing it is essentially static. Even if I managed to understand some very useful functions and translate them from decompiled C code to DFU C# engine (see my recent PR related to NPC greetings), the main problem I have is I can't manage to use DOSBox debugger properly.

I'm able to locate the exact instruction where I want DOSBox to stop and put a breakpoint there. But then, either DOSBox never breaks (even if it goes through the code) or if it does, I'm unable to step over/through the following instructions using F10/F11. It's quite frustrating and the only solution I came into is to set breakpoints on a dozen function instructions, hoping DOSBox will eventually break into one of them. And then, if it does, I can only hope current CPU registers will give me enough information.

I'm pretty sure I'm not doing things right but even after looking for information on the internet, I can't understand why DOSBox debugger is behaving like it does with DF. So, did some of you manage to use it successfully?

To be honest, I really missed good old SoftICE. I used it like 20 years ago and never found any other debugger as powerful as this one was. Back in the days, I remember finding and tweaking the "loiter a while" 3 hours time limit in less than 30 minutes...

Re: DOSBox debugger

Posted: Tue Jun 11, 2019 9:48 am
by Ferital
Nervemind, I found the solution today...

For information, in case anyone gets the same issue, it comes from the "core" DOSBox configuration parameter, which has to be set to normal in order for the debugger to work properly in protected mode.

In my own Daggerfall setup, it was set to auto, which automatically makes it switch to dynamic in protected mode. But then, problem is that dynamic mode is what causes the breakpoints to be missed and stepping through the code to not work.

So, I edited dosbox configuration file and set "core" under the [cpu] group like this:

Code: Select all

[cpu]
core=normal
And I'm now able to debug classic code at runtime. Rest well this night, FALL.EXE...

Re: DOSBox debugger

Posted: Wed Jun 12, 2019 2:52 am
by Interkarma
Well done! I've done a bit of this, and once upon a time I worked exclusively in 6502 assembly, but it still feels like an arcane art to me. You and Allofich are much, much better at this that I am. We're all very lucky to have people like you and Allofich interested in helping. :)