flat assembler
Message board for the users of flat assembler.

Index > DOS > fasm source for DOS DEBUG clone

Author
Thread Post new topic Reply to topic
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 23 Jan 2014, 02:06
Sometimes I wish I had a simple command-line DOS DEBUG-like utility in FAMOS, mainly just for quick disassembling and assembling direct to memory.

I've decided that a cut-down version of Paul Vojta's DEBUG (Japeths's version 1.25) should do the job for me, and I'm hoping to get the final binary down to 16Kbytes or less (originally 22476 bytes). I'll be cutting out all the DOS and EMS/XMS stuff, and also making it 32-bit unreal-mode compatible (retaining 16-bit code of course).

As a first step, I've converted the Masm/JWasm source to fasm and posted the zip archive here. The source is pretty well commented.

Some of the macros seemed too complicated, so I just eliminated them. Same for some of the data structures, but some were easily converted to fasm so I retained those.

I also haven't reproduced the assembler and disassembler tables contained in the original DEBUGTBL.INC. Luckily they don't seem to contain any absolute address references, only relative ones, so I've just extracted them in binary form from the original binary code and they should be fully relocatable.
So the fasm source has
file 'debugtbl.bin' instead of
include 'debugtbl.inc'
Debugtbl.bin is currently 5174 bytes and parts of it could easily be converted to fasm source which I might do some time. However it was created with an external program and some complicated macros so some of it will be a bit too hard Wink

Similarly, file 'asmtab.bin' contains another 1806 bytes I extracted from the binary. The format of this code is well documented in the source but how the original binary was generated remains a mystery to me atm.

Initially I made sure that fasm exactly reproduced the original binary (except for many encoding differences, thankfully none of which changed the binary size!) and checked that at least the "a" and "d" commands were working properly in the newly assembled binary. The feature of just pressing enter to repeat the previous command makes testing a bit easier too!

Then I made a couple of changes to the code which reduced its size, and re-tested the binary as a simple check that at least the major address labels were being resolved correctly, and that DEBUGTBL.BIN and ASMTAB.BIN are indeed relocatable.
The changes are (see the source for full details):
- text 'PTR ' removed from address size display (one of my pet hates Smile
- "d" cmd amended to show extended ascii chars and all bytes except 07-1Ah

The new binary assembles to 22455 bytes with fasm 1.71.16 but for your convenience I've included a copy in the zip archive.

So the attached archive contains:
DEBUGF01.ASM = fasm-compatible source from DEBUG125.ASM (187750 bytes)
DEBUGTBL.BIN = asm/disasm tables extracted from original DEBUG125.COM (5174 bytes)
ASMTAB.BIN = asm table extracted from original DEBUG125.COM (1806 bytes)
DEBUGF01.COM = binary assembled by fasm ver 1.71.16 (22455 bytes)

Of course it's possible (or even likely) that I've introduced a bug or two during my conversion, so if anybody would like to do more testing I would be very appreciative Smile I hope also you find the source useful and maybe you can adapt it to your own needs.


Description: fasm source for Paul Vojta's DEBUG (ver 1.25)
(with minor amendments)

Download
Filename: DEBUGF01.ZIP
Filesize: 81.3 KB
Downloaded: 774 Time(s)


_________________
FAMOS - the first memory operating system
Post 23 Jan 2014, 02:06
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1902
DOS386 01 Feb 2014, 07:37
Interesting (I'll test later) Smile
Post 01 Feb 2014, 07:37
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 01 Feb 2014, 07:55
Isn't DOS obsolete? Wait....
Post 01 Feb 2014, 07:55
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1902
DOS386 01 Feb 2014, 08:05
> Isn't DOS obsolete? Wait....

No. Don't post here then Wink
Post 01 Feb 2014, 08:05
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 02 Feb 2014, 19:42
So I found one artefact of my conversion when I reduced the text in helpmsg and ended up with all sorts of garbage on the screen after running the application and entering a ?.

Rather than reposting the corrected file I'll just note the bug here for now.

Line 404 of DEBUGF01.ASM wrote:
Code:
        mov cx,0B8h ;size_helpmsg2    

Line 404 of DEBUGF01.ASM should have wrote:
Code:
        mov cx,size_helpmsg2    

_________________
FAMOS - the first memory operating system
Post 02 Feb 2014, 19:42
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1902
DOS386 19 Feb 2014, 14:26
YES it works (minimal test) ... thanks to neville Smile

PS: it might be a good idea to patch line 7997 too:

Code:
helpmsg db 'FF-DEBUG (FreeDOS-FASM-DEBUG) v1.25 (neville) help screen',CR,LF
    
Post 19 Feb 2014, 14:26
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 21 Feb 2014, 20:48
Thanks DOS386

_________________
FAMOS - the first memory operating system
Post 21 Feb 2014, 20:48
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.