Hidden out in plain sight is a small but powerful assembler ~ disassembler.
Dave's guide to the world of DOS Debug.
In days of yore, around the same time when dinosaurs roamed the earth,
the latest hottest version of Lotus 123 came with a pestilential 'copy
protection' scheme which meant you had to keep a key disc in your A:
drive until the drive melted or the diskette wore smooth, whichever
came first.
We didn't whine about it (much). No, we hauled forth our trusty DEBUG
from the dank recesses of DOS, dissassembled that sucker, and planted a
NOP just where it would do the most good.
And spruced up what Redmond passed off as an OS with the same little
weed-whacker.
Incidentally, and not coincidentally, Lotus 1.1a was written in
assembler, ran like a bat out of hell, took up 89,856 bytes, and loaded
in 1.8 seconds on an 8088.
Version 2.0 was re-written in 'C' ran like it had constipation,
took up X MB etc etc.
The idea of small tight code died with it.
But you say, this is 2007. We heard of assembler in school, and
skipped the optional (hour) on it. Must be dead an gone to heaven...
Not quite. Debug still lurks in the nether regions of Windows. You can tempt the
beast out. Boost your bragging potential. Be an assembler programmer!
Step 1 : Enter the source code and compile the program.
What program will become clearer along the way.
Open a DOS box.
At the indicated prompt type in the bolded command and press the Enter key.
If you get into deep doggie doo press things till you get the '-' prompt, then enter 'q' to quit and start over.
| Prompt |
Commands |
Enter |
Comment |
| DOS Prompt |
debug |
enter |
; You'll see a '-' in the bottom left corner. |
| - |
|
|
; Yep, that's the interface and all the interface. |
| |
|
|
; Tastefully minimalist. |
| |
a 100 |
enter |
; Start (.COM) program) assembly at offset |
| |
|
|
; 001h bytes from the start of the max |
| |
|
|
; 64Kb segment |
| 1438:0100 |
mov ah,2a |
enter |
; Program line 1 : all deep magic stuff. |
| 1438:0102 |
int 21 |
enter |
; Program line 2 : if you get this. |
| 1438:0104 |
mov ah,4c |
enter |
; Program line 3 : to work we'll |
| 1438:0106 |
int 21 |
enter |
; Program line 4 : explain it later |
| 1438:0108 |
|
enter |
; to get back the - prompt. |
The program is now assembled.
Step 2 : Write the program to disc.
| Prompt |
Commands |
Enter |
Comment |
| |
|
|
; First we must calculate the program's length. |
| - |
h 0108 0100 |
enter |
; The parameters are the address right after |
| |
|
|
; the end of our program and the initial |
| |
|
|
; address (0100h for .COM programs) |
| 0209 008 |
|
|
; Program is 8 bytes long. |
| |
|
|
; (4 x 2 byte instructions) |
| - |
n dow.com |
enter |
; Name our program. |
| |
|
|
; The .com must be specified. |
| - |
rcx |
enter |
; r(egister) cx contents must be set to the |
| CX 07CF |
|
|
; |
| : |
0008 |
enter |
; number of bytes to be written to dow.com |
| - |
w |
enter |
; To write dow.com to disk |
| Writing 0008 |
|
|
; debug confirms it has written this |
| bytes |
|
|
; many bytes |
| - |
Q |
enter |
; Quit. Let's see if we have a dow.com. |
Do a Dir. Yep it's there all massive 8 bytes of it.
Can something that small do anything useful? After all your last
'hello world' with the latest Visual Whatever did nothing useful
and weighed in at 64Kb.
Let's see how you did.
 | Copy it into the same directory as your 'dow.com' |
 | Open a DOS Command window and cd to the directory. |
 | Type dowtest and hit enter. |
If you assembled dow.com right, yes it does do something useful, and now you know what day of the week it is!

How does all this magic happen? Click the Next button for the next enthralling episode...
|