VOGONS

Common searches


First post, by mefistotelis

User metadata
Rank Newbie
Rank
Newbie

I've compiled a heavy debug version of DOSBox, and I wish to use it for dumping a function from dos4gw-based game.

I already found a way to locate the function ('BPINT 21h 3Dh' - opening a file), then I'm dumping it with 'LOG'.

But I'm not sure which core should be used for suchy dumping. I've noticed that under dynamic core some opcodes seem to be missing. For example, I get:

0008:0000250D  push es                                                EAX:00240002 EBX:002E0BE6 ECX:002E0010 EDX:00000828 ESI:002E0008 EDI:0000250D EBP:0001F026 ESP:002E0BE6 DS:0018 ES:0010 FS:0000 GS:0000 SS:0828 CF:0 ZF:0 SF:0 OF:0 AF:0 PF:0 IF:0
0848:000005FA pop es EAX:00000300 EBX:00240021 ECX:00000000 EDX:002E0CC0 ESI:002E0CDC EDI:002E0C2C EBP:002E0C2C ESP:002E0C20 DS:0828 ES:0828 FS:0840 GS:0058 SS:0828 CF:0 ZF:40 SF:0 OF:0 AF:0 PF:4 IF:1

so there is a jump from 0008:0000250D to 0848:000005FA, but without any CALL, RET or JMP.

Is something really missing, or am I misinterpreting the code?

On the other side, when I'm using normal core, I get a lot of interrupt handlers - which are useless for me. Additionally, some operations are marked as '[illegal]'.

So, could you tell me which core is best for opcodes logging? Or maybe I should change some other config parameters?

Reply 1 of 7, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The dynamic core runs code in blocks, so you'll only get a log of the
first instruction of the block, which is quite useless (blocks can be
up to 32 instructions).
normal core and full core are fine. Also you can reduce the logging
information by using LOGS instead of LOG, or display more info
with LOGL.

Reply 2 of 7, by mefistotelis

User metadata
Rank Newbie
Rank
Newbie

Thanks!

And why are some instructions marked as [illegal]?

Does it mean they were ignored by dosbox core?
Or maybe debugger opcodes are decoded outside core, and can be interpreted incorrectly, even though core execution was right?

Reply 3 of 7, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

> And why are some instructions marked as [illegal]?

Because the registers or memory references the opcodes use do not have proper values yet. When your single step pointer points on the instruction it should become legal.

1+1=10

Reply 4 of 7, by mefistotelis

User metadata
Rank Newbie
Rank
Newbie

Thank you, but I ment they were [illegal] in a file dumped with 'LOG', not in the debugger window.

Anyway I solved this by using other compilation of Dosbox-debug. Instead of the one I compiled myself, I used the one from this post:
DOSBox debugger

Now, there is nothing 'illegal'.

...but I have one more question:

What exacly differs 'LOGS' from 'LOG'? Which information are not logged with 'LOGS'?

Reply 5 of 7, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Have a look at LogInstruction() in debug.cpp, LOGS tries to keep things
compact, doesn't display FS/GS and omits some flags. LOGL is the most
readable imo (that's why it was added) but generates rather large log files.

Reply 7 of 7, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yep. It's a matter of taste, but no instructions are left out.

That [illegal] might turn up for several reasons, some are because the
address decoding in the disassembler is not 100% correct (segment
wraps especially) or when the exact paging state can not be determined
for some reason. Why it's different between your build and the build from
Qbix i don't know.