home *** CD-ROM | disk | FTP | other *** search
- DOCUMENTATION FOR COM2ASM.BAS PROGRAM
- DOS 2.0 Unassembly Program
- by Rich Winkel, Columbus, MO
-
- I use this program whenever I want to convert a COM file to assembler source
- code, for subsequent modification and re-assembly. Here's how it works:
-
- Get into Debug with the COM file you're working with, and locate the areas
- containing the code. (Stay away from the data areas.) Write down the starting
- and ending addresses for all the code areas in the file, and quit. Back in DOS,create a file to be piped into the standard input of the Debug program,
- containing the commands necessary to unassemble the program in the sequence
- in which it resides in RAM. The easiest way to do this is to use the Copy
- command.
-
- A>copy con file1
- u addr1 addr2 <--unassemble the file
- u addr3 addr4
- . (etc.)
- .
- q <--DON'T FORGET THIS!
- ^Z
-
- 1 File(s) copied
-
- A>
- Now, type
- DEBUG (filename).COM <FILE1 >FILE2
-
- This will (given enough time) generate a file called FILE2 containing the
- result of the above commands to Debug. Now run the COM2ASM.BAS program, enter
- FILE2 in response to the "Input file?" prompt, and some other (new) file name
- for the output file prompt. The program will then read FILE2, get rid of the
- hex addresses on the left and the op code, label the intra-segment jumps and
- calls and their destinations with labels of the form "Ln", where 0<n<999, and
- send the results to the other (new) file. The result is compatible (as far as
- it goes) with the IBM Assembler.
-
- If you get "Error: Referenced code not found," it means that a jump or call
- was not found in the input file. At this point, processing stops and the
- address of the missing code is printed out, followed by the addresses of
- referenced code not yet processed.
-
- When this happens, it either means you missed portions of the code, you got
- "unsynchronized" during the unassembly (perhaps you started unassembling in
- the middle of an instruction), you got into data areas, or (possibly) the code
- modifies itself during execution.