home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / gwbasic / com2asm / com2asm.doc < prev   
Encoding:
Text File  |  1987-05-10  |  2.0 KB  |  47 lines

  1. DOCUMENTATION FOR COM2ASM.BAS PROGRAM
  2. DOS 2.0 Unassembly Program
  3. by Rich Winkel, Columbus, MO
  4.  
  5. I use this program whenever I want to convert a COM file to assembler source
  6. code, for subsequent modification and re-assembly.  Here's how it works:
  7.  
  8. Get into Debug with the COM file you're working with, and locate the areas
  9. containing the code.  (Stay away from the data areas.)  Write down the starting
  10. 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,
  11. containing the commands necessary to unassemble the program in the sequence
  12. in which it resides in RAM.  The easiest way to do this is to use the Copy
  13. command.
  14.  
  15.    A>copy con file1
  16.    u addr1 addr2  <--unassemble the file
  17.    u addr3 addr4
  18.    .   (etc.)
  19.    .
  20.    q              <--DON'T FORGET THIS!
  21.    ^Z
  22.  
  23.    1 File(s) copied
  24.  
  25.    A>
  26. Now, type
  27.      DEBUG (filename).COM <FILE1 >FILE2
  28.  
  29. This will (given enough time) generate a file called FILE2 containing the
  30. result of the above commands to Debug.  Now run the COM2ASM.BAS program, enter
  31. FILE2 in response to the "Input file?" prompt, and some other (new) file name
  32. for the output file prompt.  The program will then read FILE2, get rid of the
  33. hex addresses on the left and the op code, label the intra-segment jumps and
  34. calls and their destinations with labels of the form "Ln", where 0<n<999, and
  35. send the results to the other (new) file.  The result is compatible (as far as
  36. it goes) with the IBM Assembler.
  37.  
  38. If you get "Error: Referenced code not found," it means that a jump or call
  39. was not found in the input file.  At this point, processing stops and the
  40. address of the missing code is printed out, followed by the addresses of
  41. referenced code not yet processed.
  42.  
  43. When this happens, it either means you missed portions of the code, you got
  44. "unsynchronized" during the unassembly (perhaps you started unassembling in
  45. the middle of an instruction), you got into data areas, or (possibly) the code
  46. modifies itself during execution.
  47.