All I had to do was find out what code was being used to do this, and fix it so that it would run under any version of DOS. I got out my PS/2-PC Assembly Language book, and looked in the interrupt list for a function that told you what version of DOS was running. Surprise surprise, it was a function of INT 21H (funtion 30H to be exact.)
My first attempt was to DEBUG EDLIN.EXE, which initially looked promising. After hitting U forty times, I discovered that the code I was looking for wasn't near the beginning of the program, and even worse, that DEBUG wouldn't let you write to an EXE.
Ok, so how as I going to edit that file? I decided to try hexediting it. First I needed to know what instructions I was looking for, and what those instructions looked like in HEX. I broke out my dssembly book, did some research, and wrote down the results.
Then I loaded my DOS freeware hexedit program and searched for the instruction group that would return the version of DOS, MOV AH,30; INT 21H (B420 CD21 in hex). Sure enough, I found this group. Then I looked for a CMP AH, 6 (3C06 in hex). I couldn't find this instruction, but I did find a 3D06 in the right place. After than I found a JNE (Jump if Not Equal) instruction, and decided that I had found the right place, even if it didn't look exactly like I had expected. So I changed JNE to JE, and tried it out. It loaded up a file, without any problem, and let me edit it. Success!
Well, not quite. There was still a problem: This hacked version of EDLIN would work with DOS 7, but no longer with DOS 6.x. So I went back to my hex editor, and replaced the JE that I had hacked in with a pair of NOPs. Now the jump code was no more, and no matter what version, EDLIN will run. Of course, I can't guarantee that EDLIN doesn't use something that only DOS 6.x and later have, but in my tests it has had no problems at all. You should be able to use it with DOS 3.x and above.
No comments:
Post a Comment