VOGONS


First post, by flagist

User metadata
Rank Newbie
Rank
Newbie

Hello gentlemen!
I'm trying to implement some very simplistic stack trace command in dosbox debugger, but I have some problems with it, maybe someone experienced in DOS programming and asm could help?
I added global vector represent current stack state, and modified executors of CALL, RET and RETF to update this vector.
But stack is exceeded all the time, so, are there any other commands that modify stack?

Reply 1 of 7, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

In DOS programming, particularly in assembly, there is no guarantee that every call has a corresponding return and vice versa. A program might CALL a following POP AX instruction just to learn what the address is. DOSBox, like real DOS, executes a program by pushing the entry point onto the stack and then executing a RETF.

Reply 2 of 7, by lightmaster

User metadata
Rank Oldbie
Rank
Oldbie
flagist wrote:
Hello gentlemen! I'm trying to implement some very simplistic stack trace command in dosbox debugger, but I have some problems w […]
Show full quote

Hello gentlemen!
I'm trying to implement some very simplistic stack trace command in dosbox debugger, but I have some problems with it, maybe someone experienced in DOS programming and asm could help?
I added global vector represent current stack state, and modified executors of CALL, RET and RETF to update this vector.
But stack is exceeded all the time, so, are there any other commands that modify stack?

Hello there!
What would be the benefits for the games?

25071588525_735097840e_b.jpg

Reply 3 of 7, by flagist

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote:

In DOS programming, particularly in assembly, there is no guarantee that every call has a corresponding return and vice versa. A program might CALL a following POP AX instruction just to learn what the address is. DOSBox, like real DOS, executes a program by pushing the entry point onto the stack and then executing a RETF.

Thank you! Then maybe I'll have to maintain some annotated copy of stack segment

Reply 4 of 7, by flagist

User metadata
Rank Newbie
Rank
Newbie
lightmaster wrote:

What would be the benefits for the games?

Well, it will simplify the reconstruction of program logic without reading ALL the code.
For example, I'm trying to extract resources from BABYTYPE'93 (touch-typing training game) to reimplement it with some additions.
Its sprites are stored in an unknown format. I can set a breakpoint on an interrupt that opens the resource file or on write to graphics memory. But when it's hit I want to know where it was called from and why. All I have is a bunch of asm code, and I want to reconstruct its structure to disasm only important parts of it.
Theoretically I could read stack segment, but it also contains function arguments, flags and CS mixed with older EIPs, so it would be more productive to maintain some structure containing only EIPs.