home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / dasm15.lbr / DASM.DZC / DASM.DOC
Encoding:
Text File  |  1993-10-26  |  26.5 KB  |  797 lines

  1.             DASM
  2.  
  3. *************************************************************
  4. MICRO CORNUCOPIA NOTE: I didn't have a copy of DASM.DOC
  5. so this is a copy of ZESOURCE.DOC. ZESOURCE is an extension 
  6. of RESOURCE for TDL mnemonics and this is a further extension
  7. that provides Zilog mnemonics. (You don't know how I've looked
  8. for this). Anyway, if anyone has the real ZZSOURCE.DOC,
  9. please let me know where it is so I can offload it or please
  10. send it in.
  11.  
  12. Dave Thompson
  13. ***************************************************************
  14.  
  15.     A disassembler for Z80 programs
  16.     by Dave Barker
  17.     (from RESOURCE by Ward Christensen)
  18.  
  19. {NOTE:  Most of the text of this file was written by Ward
  20. Christensen.  I have modified or added to it to make it agree
  21. with the features of ZESOURCE, which is RESOURCE enhanced to
  22. disassemble into TDL Z80 mnemonics.}
  23.  
  24.  
  25. Suggestions?  Call me eve's at (805) 526-2438 (D.Barker)
  26.         ----------------
  27. ZESOURCE commands are inconsistent at best. - ZESOURCE is a 
  28. kludge based on years of disassembler experience and hacking, 
  29. and was never "planned" - just coded sitting at a tube, and
  30. modified over 2 years before being contributed to the CP/M UG.
  31.  
  32. For example, to kill a symbol: k.label   but to kill a 
  33. control value: caddr,k and to kill a comment: ;addr,
  34. but ZESOURCE does the job like no other I have seen.
  35.         ----------------
  36. N-O-T-E: Pardon the editorial, but I feel hardware without
  37. good software is useless to 99% of us.  Most good software
  38. has to be paid for.  I strongly support the legitimate purchase
  39. of licensed software.  I do not regularly use any programs
  40. which I have not purchased.  (Yes, I do occasionally "try"
  41. one, but then buy it if I plan on using it).  I have been
  42. asked by software businesses to NOT distribute ZESOURCE -
  43. because of it's ability to produce good .asm source quickly.
  44. But, there are so many disassemblers out, why not a good, 
  45. conversational one?   Please use it in the spirit in which it 
  46. was contributed: to enlarge your understanding of the micro-
  47. computer world around you, and to allow you to customize 
  48. programs which you legitimately own, for your own use.
  49.  
  50.     "Semper non rippus offus"
  51. ----
  52. NOTE: any command taking a hex address (Dnnnn, etc)
  53. may take a value in the form .label but arithmetic
  54. may not be performed.  (i.e. d.start is ok, but d.start+8 not)
  55.         ----------------
  56.     Overall structure of ZESOURCE:  It is a .COM file,
  57. which runs at 100H.  It goes thru 1C00 or so, then the stack.
  58. At 1D00 is a 512 entry table for control commands.  Each is
  59. 3 bytes long, and controls the format of the re-sourced list,
  60. i.e. is it DB, DS, DW, instructions, etc.
  61.     At 2300 is the start of the symbol table.  It has no
  62. defined length as such.  If it is not used, it occupies only
  63. 2 bytes.
  64.     If you want to re-source something which is in memory,
  65. such as a PROM, a program previously loaded in high memory,
  66. "CP/M itself", or whatever, you can just do so.
  67.     However, typically you want to disassemble a program
  68. which runs at 100H, which is were ZESOURCE runs.   Bob
  69. Van Valzah would have solved that by making resource
  70. relocatable and moving itself up under BDOS.  I wasn't that
  71. industrious.
  72.     Instead, ZESOURCE uses the concept of an "invisible"
  73. OFFSET.  After all, what do you care where it is as long
  74. as it LOOKS like it's at 100h?
  75.     So, you set an offset.  O2F00 sets it to 2F00 Hex.
  76. Reading a .COM file (RFOO.COM) causes it to come into 3000 on.
  77. If you say D100 or L100 it dumps or lists what LOOKS like your
  78. program.  Internally, ZESOURCE is adding the offset to the
  79. D and L addresses. DASM will set an offset for you automatically.
  80.     What should you set the offset to?  Well, that depends
  81. upon how many symbols you will use.  O2400 will load the
  82. program at 2500, thus allowing only 2300-24FF for symbols,
  83. i.e. 512 bytes or about 50-60 labels.  If you didn't leave
  84. enough space, then used B to build a default symbol table,
  85. the table could run into and clobber your .com file!  (easy
  86. recovery, however: just change the offset to being higher,
  87. and read in the .COM file again)  Each entry takes 3 bytes
  88. + the symbol length, and if you like 7 byte labels like I
  89. do, that means 10 bytes/label.  An offset of 2F00 should
  90. be adequate.
  91.     If you want to put comments into the disassembled
  92. program, you will have to designate an area to Use for the
  93. comments.  The U command (e.g. U4000) specifies what area
  94. is to be used.
  95.     Before issuing the O (offset) command, do:
  96.     L5 7
  97. which will show the JMP to BDOS, which is the highest memory
  98. you may use.  (Note if you have, for example, an empty 4K
  99. memory board in high memory, you can Use THAT for comments).
  100.     Let's take an example:  You have an 8K file, FOO.COM
  101. which you want to disassemble.  It will have about 300 labels.
  102. 300 x 10 is 3000, or call it 4K (what's a K unless your
  103. tight).  The symbol table starts at 2300.  4K more is 3300.
  104. Let's load the .COM at 3300, so since it normally starts
  105. at 100H, the offset is 3200.  O3200 is the command.
  106. We then RFOO.COM to read it in.  It says 5300 2100 which
  107. means it came into actual memory to 5300, but 2100 if we
  108. are talking with respect to loading at 100.
  109.     Thus, we could set our comments table up after
  110. the .COM program - say at 6000:  U6000
  111.     The ? command shows the memory utilization for
  112. control, symbol, and comments entries.  (no, I never put
  113. in anything to keep track of the .COM - you'll just have
  114. to do that yourself).
  115.     If you ever want to dump real memory, you'll have
  116. to reset the offset to 0: O0  but then set it back.
  117. If you are not sure what it is, typing O will tell the
  118. current offset.
  119.  
  120.     Hoo, boy!  Hope this kludge of documentation
  121. is enough to get you going - hmmm, better give you
  122. some of the gotcha's I've discovered...
  123.  
  124.         ---- WATCH FOR ----
  125.  
  126. *    Symbols overflowing into the .COM.
  127.     (Use ? command to see how full symbol table is)
  128.  
  129. *    Control entries overflowing into .SYM (altho I
  130.     can't believe anyone will have a program with
  131.     more than 512 control entries!!!)
  132.  
  133. *    Comments overflowing into BDOS (ug!!)
  134.  
  135. *    Using an offset which is not in free memory
  136.     and overlaying BDOS or whatever.
  137.  
  138. *    The B(uild) command gobbling up too much when building
  139.     a DB:  "B" will take a DB 'GOBBELDY GOOK' followed
  140.     by LXI H,FOO and take the LXI as a '!' (21H) so
  141.     you'll have to manually stick a new "I" control
  142.     entry in at the address of the LXI.  You might
  143.     also delete the incorrect "I" entry which ZESOURCE
  144.     stuck in (typically at the second byte of the LXI)
  145.  
  146. *    Trying to dump real memory without setting the
  147.     offset back to 0.  (then forgetting to set it back
  148.     to its proper value)
  149.  
  150. *    Forgetting how big the .COM file you are disassembling
  151.     was.
  152.  
  153. *    Using ZESOURCE to rip off software (yes, I know, you
  154.     heard that before, but only 3 in 100 needed to be 
  155.     told, and 2 in 100 needs to be told again, and 1 in
  156.     100 doesn't give a rat's fuzzy behind anyway!!)
  157.  
  158. *    Forgetting to take checkpoints when disassembling
  159.     large files.  You may even want to rotate the names
  160.     under which things are saved:
  161.  
  162.     STEMP1.SYM
  163.     STEMP1.CTL
  164.     STEMP1.DOC
  165.  
  166. *    Missing a label:  Suppose you have a control entry
  167.     for a DW, resulting in:
  168.     
  169.     DFLT:        ;172C
  170.         DW    100H
  171.  
  172.     but somewhere in the program, the following exists:
  173.  
  174.         LDA     172DH
  175.  
  176.     Even if you did a B and have a label L172D, it won't
  177.     show up since it's in the middle of a DW.  Instead,
  178.     do this:
  179.  
  180.     K.l172d        kill the old label
  181.     e172d,.dflt+1    put in the new label as a displacement
  182.             off the beginning.
  183.  
  184. *    improperly disassembling DW's (see previous item).
  185.     You might be tempted to make DFLT a DB so that
  186.  
  187.     DFLT:        ;172C
  188.         DB    0
  189.     L172D:        ;172D
  190.         DB    1
  191.  
  192.     Note that while this disassembles and reassembles
  193.     properly, it is not "as correct" as the technique
  194.     used in the previous item.
  195.  
  196. *    Having the "B" command overlay your "E" control entry.
  197.     What?  Well, "B"uild is pretty dumb.  If he finds 8
  198.     DB type characters in a row, he fires off a DB from
  199.     then on until he runs out of those characters.  Suppose
  200.     your program was 200 long (ended at 3FF), and you
  201.     had zeroed (aha!  Nice DB candidates) memory there
  202.     (there meaning at your offset address + whatever).
  203.  
  204.     Then you QB100,400 and viola!!  ZESOURCE overlaid
  205.     your "E" control with a "B".  
  206.         ----------------
  207.  
  208.     ZESOURCE is relatively complete.  (well, actually,
  209.     the phrase "rampant featureitis" has been "mentioned").
  210.     ...But there's always another day, and another K...
  211.  
  212.         SO... Here's my "wish list"
  213.  
  214.     ..it might save you telling me YOU think such-and-such
  215.     would be nice...
  216.  
  217. *    Targets of LHLD, SHLD should automatically be flagged
  218.     as type DW in the control table.  Ditto LDA and STA
  219.     as DB or as second half of DW.  Ditto targets of LXI
  220.     as DB (?).
  221.  
  222. *        E5C,.FCB
  223.     followed by
  224.         E6C,.FCB+
  225.     should automatically calculate the appropriate
  226.     displacement, and put it in the symbol table.
  227.  
  228. *    The comments facility should be enhanced to allow
  229.     total SUBSTITUTION of entire line(s) of the code,
  230.     i.e. at address such-and-such, replace the next 3
  231.     bytes with the following arbitrary line.  This
  232.     would help those "how do I explain what was being
  233.     done" cases such as:    LXI    H,BUFFER AND 0FF00H
  234.  
  235.         ----------------
  236. ZESOURCE types an "*" prompt when it is loaded.  You may
  237. then enter any of the following commands.  Each command
  238. is a single letter followed by operands.  Commas are shown
  239. as the delimiter, but a space will also work.
  240.  
  241.         ----------------
  242.         ----------------
  243. ;    Put comments into the program.
  244.     (must execute 'u' command first, to assign area
  245.     for comments to be placed)
  246.  
  247.     ;addr,comment    enter a comment
  248.     ;addr        lists existing comment
  249.     ;        lists entire comments table
  250.     ;addr,        deletes existing comment
  251.  
  252.     note that '\' is treated as a new line, i.e.
  253.     \test\ will be formatted:
  254.  
  255.     ;
  256.     ;TEST
  257.     ;
  258.         ----------------
  259. Attempt to find DB's while listing the program.
  260. -    This command works just like 'L', but attempts
  261.     to find DB's of 8 chars or longer.
  262.  
  263.     (see 'L' command for operand formats)
  264.         ----------------
  265. Build default sym tbl (LXXXX) labels for each
  266. -    2 byte operand encountered.  Note 'B' is
  267.     identical to 'L' except labels are built.
  268.  
  269.     (see 'L' command for operand formats)
  270.         ----------------
  271. Control table usage:
  272. -    c        dump ctl tbl
  273.     cnnnn        dump from starting
  274.     cnnnn,x        define format from nnnn
  275.             to next entry.  values of x:
  276.  
  277.             B = DB (attempts ASCII
  278.                 printable, 0DH, 0AH, 0)
  279.             W = DW (attempts label)
  280.             S = DW to next ctl entry
  281.             I = instructions
  282.             K = kill this ctl entry
  283.             E = end of disassembly
  284.  
  285.     NOTE every control entry causes a "control break"
  286.     (NO, ZESOURCE was NOT written in RPG) which means
  287.     a new line will be started.  Thus if you have a
  288.     string in memory which disassembles as:
  289.  
  290.     DB    'Invalid operand',0DH
  291.     DB    0AH
  292.  
  293.     You might want to change it putting the 0DH,0AH
  294.     together on the second line - just enter a "B"
  295.     control entry for the address of the 0DH.
  296.  
  297.     The same technique could be used to make
  298.  
  299.     DB    'TYPESAVEDIR ERA REN '
  300.  
  301.     appear as
  302.  
  303.     DB    'TYPE'
  304.     DB    'SAVE'
  305.     DB    'DIR '
  306.     DB    'ERA '
  307.     DB    'REN '
  308.  
  309.         ----------------
  310. dump:
  311. -    dxxxx        Dumps 80H from xxxx on
  312.     daaaa,bbbb    Dumps from aaaa thru bbbb
  313.     d,bbbb        Continues, thru bbbb
  314.     d        Continues, 80H more
  315.  
  316.     NOTE 80H is the default dump length.  If you have
  317.     a larger display, you can change the default via:
  318.  
  319.     d=nn        nn is the HEX new default.
  320.  
  321.     For example, a 24 line tube could display 100H:
  322.  
  323.     d=100        or..
  324.     d=100,200    Defaults to 100, dumps 200-2ff
  325.  
  326.         ----------------
  327. enter symbol:
  328. -    ennnn,.symbol     symbol may be of any length,
  329.             and contain any char A-Z or 0-9,
  330.             or "+" or "-".  This allows:
  331.             E5D,.FCB+1.  Note the "+" is not
  332.             checked, i.e. E5D,.FCB+2 would be
  333.             wrong (assuming FCB is at 5C) but
  334.             would be allowed to be entered.
  335.  
  336.     Note when a new symbol is entered any ather symbol 
  337.     at that address will be killed.  This prevents having
  338.     two symbols with the same address.  If you have a label
  339.     which has the wrong address, you need not explicitly
  340.     kill the old one before entering the new.  A label
  341.     which is spelled exactly the same as an existing one
  342.     will replace the existing one even if the addresses
  343.     are different.
  344.         ----------------
  345. Find occurrence of address or label.  Note this function
  346. -    runs until interrupted (press any key).
  347.     fnnnn,ssss    find address nnnn in memory.  Start
  348.             the search at ssss.  Runs forever.
  349.             Press any key to stop.
  350.     f        continue previous find command
  351.       fnnnn        find nnnn starting at address you last
  352.             stopped at in the f command
  353.         ----------------
  354. kill symbol from table
  355. -    k.symbol
  356.         ----------------
  357. list (disassemble).  This command is used to list the
  358. -    file, or to list it to disk after enabling
  359.     the .ASM file save via 'SFILENAME.ASM' command
  360.  
  361.     l        lists 10 lines from prev pc
  362.     lssss,eeee    lists from ssss to eeee
  363.     l,eeee        lists from current pc to eeee
  364.     lssss        lists 10 lines at ssss
  365.  
  366.     Note that if you have a control 'e' entry, then the
  367.     list will stop when that address is found.  This allows
  368.     you to 'lstart,ffff'. 
  369.  
  370.     The 10 line default may be changed via:
  371.  
  372.     L=nn        where nn is a HEX line count, e.g.
  373.     L=14        set to 20 lines/screen
  374.  
  375.     You can change the default and list, e.g.
  376.  
  377.     L=9,100        Dflt to 9 lines, list at 100.
  378.  
  379.     NOTE when using L to list the .ASM program to disk,
  380.     you should either list the entire program at once
  381.     using: Lssss,eeee or, you can list small pieces
  382.     at a time.  As long as you list again without
  383.     specifying a starting address, (L or L,nnnn) then
  384.     the output file will continue uninterrupted.
  385.  
  386.     You may do dump commands, and others, without
  387.     affecting what is being written to disk.
  388.         ----------------
  389. offset for disassembly
  390. -    o        print current offset
  391.     onnnn        establish new offset
  392.  
  393.     (note the offset is always added to any 
  394.     address specified in an a, b, d, or l command.
  395.     to dump real memory, the offset must be reset to
  396.     0 (O0) before the dump.)
  397.         ----------------
  398. prolog generation - this routine generates an
  399. -    ORG instruction, and equates for any label
  400.     outside of a given low-hi address pair.
  401.     (the start and end addresses of your program).
  402.     e.g. if disassembling from 100 to 3ff, it will
  403.     generate 'fcb equ 5ch' if FCB is in the symbol
  404.     table.  In typical use, you would 'sfilename.asm'
  405.     then use the P command to write the prolog, then
  406.     the L command to write the program itself.
  407.  
  408.     Pstart addr,end addr
  409.     
  410. quiet command: any command which is preceeded by a q
  411. -    will be done 'quietly'.  For example, to save
  412.     a .asm program, you could just do:
  413.  
  414.     ql100,3ff    or    ql100,ffff if you have
  415.     set the 'e' control in the control table.
  416.  
  417.     Another use is to build a default symbol table
  418.     by taking a pass thru the program: QB100,xxxx
  419.         ----------------
  420. read .com, .ctl, .sym, or .doc file
  421. -    rfilename.com    reads in at offset+100h
  422.     rfilename.ctl    loads the ctl table
  423.     rfilename.sym    loads the sym file
  424.     rfilename.doc    loads the comments table (note
  425.             'u' command must have been issued)
  426.     rfilename.all    loads the doc, sym, and ctl files with
  427.             one command
  428.         ----------------
  429. save .asm, .ctl, .sym, or .doc file
  430. -    sfilename.asm    use 'l' command to write, z to end
  431.     sfilename.ctl    saves the ctl table
  432.     stablename.sym    saves the sym file
  433.     sfilename.doc    saves the comments table
  434.     sfilename.all    saves the doc, sym, and ctl files with
  435.             one command
  436.         ----------------
  437. use area of memory for comments table
  438. -    unnnn        such as ud000 if you had an
  439.             open board at 0d000h
  440.         ----------------
  441. purge sym tbl and CTL tbl
  442.     x
  443.     -
  444.         ----------------
  445. close .asm file (note that a preferred way to close the
  446.     .asm file is to have specified a control entry
  447.     for the end address (e.g. c1ff,e))
  448.     z
  449.     -
  450. --------------------------------------------
  451. --------------------------------------------
  452. Here is a sample of the ZESOURCE usage.
  453.  
  454. Given:    a COM file (lets say test.com) which runs at 100
  455.     (as any good COM file should), and goes thru 2FF.
  456.  
  457. lines preceeded with ---> are typed by you.
  458.  
  459. ---> ZESOURCE
  460. ---> o2200    set the offset to 2200, which means the
  461.         program will read into 2200 + 100 = 2300.
  462.  
  463. ---> rtest.com    reads the com file into memory. system says:
  464.         2500 0300 which is the actual hi load addr,
  465.         (2500) and the original hi load addr (300)
  466.  
  467.         REMEMBER this address (300) because you might
  468.         want to put a "E" (end of assembly) control
  469.         entry there.
  470.  
  471. <<<<note>>>> that all 'L' (disassembly list) and 'D' (dump)
  472.     commands work with the offset added.  Thus, you
  473.     should learn to forget that the disassembler is
  474.     in memory, and think of it as if your program were
  475.     actually at 100.  D100 will dump your program.
  476.     
  477.     also note:  if the program being "ZESOURCEd" will
  478.     have a fairly large symbol table, then you will
  479.     have to set the offset higher: o2f00 or some such.
  480.     (the ? command will show symbol table usage: if your
  481.     symbol table is nearing the .com file, then just
  482.     set a new offset (higher) and re-load the .com)
  483.  
  484.     if you want to dump r-e-a-l memory, you would have
  485.     to reset the offset to 0: o0  (but don't forget to
  486.     reset it to 1f00 before continuing with your program.)
  487.  
  488. If you are disassembling something which is in memory at
  489. it's correct address (such as looking at ccp) then don't
  490. set the offset.  It defaults to 0 when dis is first loaded.
  491.  
  492. --->    l100    list your program - lists "about" 10 lines.
  493.  
  494. --->    d100    do a dump of your program.
  495.  
  496. NOTE that typically here are the steps to disassembling
  497.     a program which has just been read into memory:
  498.  
  499. Use the dump command to find the ASCII DB areas.
  500.  
  501. Note that the 'a' command may be used to automatically
  502. find the db's, but you must then check them to insure
  503. that they don't extend too far.  All printable characters,
  504. 0dh, 0ah, and 00h are considered candidates for ascii db's.
  505.  
  506. At least 8 characters in a row must be found to make sure
  507. that long sequences of mov instructions won't be taken
  508. as db's.
  509.  
  510. Use the cnnnn,k command to kill erronious entries put
  511. in the control table by the a command, but then immediately
  512. put in the right address, such as via cnnnn,i
  513.  
  514. if you wanted to scan the program for ascii db's yourself,
  515. use the 'c' (control) command to set the beginning and
  516.     end of ascii areas.  F    JZ    078BH
  517.     XRA    A
  518.     STA    1712H
  519.     STA    1714H
  520.     CALL    1647H
  521.     CMC
  522.     DCR    C
  523.     LDAX    B
  524.     NOP
  525.     JMP    0177H
  526. L01F8:        ;01F8 
  527.     CALL    L1647    ;16 dump as:
  528.  
  529. 0100  c3170144 4f50xxxx  xxxxxxxx xxxxxxxx  *...copyr ight....*
  530. 0110  xxxxxxxx xxxxxxxx  xxxxxxxx xxxxxxxx  *xxxxxxxx ........*
  531.  
  532.  
  533. thus you would want to instruct the disassembler to switch
  534. to db mode at 103, and back to instruction mode at 117, thus:
  535.     c103,b
  536.     c117,i
  537.  
  538. Continue doing this, bracketing every ascii db which is in
  539. the middle of instructions, by a b control instruction
  540. and an i control instruction.  Note that multiple db's in
  541. a row need not have separate cnnnn,b instructions, but that
  542. these do cause a 'line break', i.e. if you have a table
  543. of ascii commands, for example:
  544.  
  545. 02e5    db    'load'
  546. 02e9    db    'save'
  547.  
  548. the disassembler would disassemble these as:
  549. 02e4    db    'loadsave'
  550.  
  551. you could put in an additional control entry: c2e9,b, which
  552. would cause the disassembler to generate:
  553.  
  554. 02e4    db    'load'
  555. 02e8    db    'save'
  556.  
  557. which is much more readable and realistic.
  558.  
  559. Note that before generating each byte of a db, a symbol
  560. table lookup is done to determine if there is a label
  561. at that location, and if so, a new line is started.
  562.  
  563. Thus if 'loadlit' and 'savelit' were in the symbol table,
  564. as the labels on the 'load' and 'save' above, no separate
  565. 'b' control instruction would be required as the label
  566. would cause the break.
  567.  
  568. <<<<NOTE>>>> that at this time the automatic label checking
  569. is n-o-t done for ds instructions.  Make sure that each
  570. ds instrucion references only up to the next label.  This
  571. means that multiple ds's in a row must each be explicitly
  572. entered into the control table.  Presence of a label is
  573. not sufficient.
  574.             ----
  575. steps, continued:
  576.  
  577. After building the control entries with cnnnn,b and cnnnn,i
  578. put in a control entry cnnnn,e which defines the address of
  579. the end of your program.  The l command will then automatically
  580. stop there, and in addition, if you are in 'save xxx.asm'
  581. mode, the output .asm file will be closed.  If you do
  582. mot define a control 'e' entry, then you will have to use
  583. the break facility to stop the l command (don't use control-c
  584. as that will re-boot cp/m).  If you were writing an .asm
  585. file, you would have to user the z command to close the
  586. file.
  587.  
  588. Next, you would list your program to determine how it looks.
  589. when you recognize a routine by it's function, insert a label.
  590.  
  591. For example, if you saw that location 7ef was a character
  592. out routine (type) then enter a label into the symbol table:
  593.     E7EF,.TYPE
  594.  
  595. NOTE that all symbols start with a '.', so as to be dis-
  596. tinguished from hex data.
  597.  
  598. NOTE that if you want the disassembler to make default labels
  599. for you, use b (for build labels) instead of l (for list
  600. program).  The b commands causes lnnnn default labels to
  601. be inserted in the symbol table for every 2 byte operand
  602. encountered (LXI, SHLD, JMP, etc).  It will undoubtedly
  603. make some you don't want, such as L0000.  You will have to:
  604.  
  605.     K.L0000        kill label L0000 from the table.
  606.  
  607. When you encounter data reference instructions, try
  608. to determine what type of area the instruction points to.
  609. Typically,, LXI instructions may point to a work area
  610. which should be defined as a DS, or to an ASCII string,
  611. in which case we will have already made it a 'b' control
  612. instruction.  Operands of LHLD and SHLD instructions
  613. should be made DW instructions.  For example if you
  614. encounter LHLD 0534H, then issue a control instruction:
  615.  
  616.     C534,W
  617.  
  618. NOTE that whatever mode you are last in will remain in
  619. effect.  Therefore if 534,w is the last entry in the
  620. control table, all data from there on will be taken to be
  621. DW's.
  622.  
  623. Suppose that you determine that address 7cf is a 128 byte
  624. buffer for disk I/O.  You want it to disassemble to:
  625.  
  626. DKBUF        ;07CF
  627.     DS    80H
  628.  
  629. You do this as follows:
  630.  
  631.     C7CF,S        to start the DS
  632.     C84F,B        to define it's end, and
  633.     E7CF,.DKBUF    to put the symbol in the table.
  634.  
  635. Continue, iteratively using the 'l' command and the 'c'
  636. and 'e' commands until you have the listing in a nice
  637. format.  You will then probably want to save the control
  638. symbol, and comments tables.  Or, you could have been 
  639. saving them at checkpoint times (so if you make a 
  640. major mistake you could go back to a previous one).
  641.  
  642. To save a control file:
  643.     sfilename.CTL    (any filename, may include a: or b:)
  644.  
  645. To save a symbol file:
  646.     sfilename.sym
  647.  
  648. To save a comments file:  
  649.     sfilename.doc    (not ".com" of course)
  650.  
  651. NOTE that the filetypes must be used as shown, but
  652. that any legal filename (or disk:filename such as b:xxxx.CTL)
  653. may be used.
  654.  
  655. You could now control-c to return to CP/M, and come back
  656. later to resume your disassembly:
  657.  
  658.     ZESOURCE
  659.     o2200
  660.     rtemp.com
  661.     rtemp.sym
  662.     rtemp.ctl
  663.     uxxxx        (such as u4000)
  664.     rtemp.doc
  665.  
  666. This will take you back exactly where you left off.
  667.  
  668. If you want to save a .asm file out to disk, do the following:
  669.  
  670. Make sure that there is a control entry defining the end
  671. of the program (such as c200,e) or else you will have to 
  672. specify the ending address and manually type a z command to 
  673. close the file. 
  674.  
  675.     sfilename.asm
  676.  
  677. A message will indicate that the file is opened.  Any
  678. subsequent a, b, or l command will have whatever is listed
  679. written to disk.  Encountering a 'e' control, or typing a z
  680. command will then close the .asm file.  The listing may
  681. be interrupted, and continued.  Since the l command types
  682. only 10 lines, use laddr,ffff to list thru the end of the
  683. assembly.
  684.  
  685. If this is the 'final' save of the .asm file, you will
  686. probably want to put an 'org' at the beginning of the
  687. output file, as well as generate equ instructions for
  688. any references outside of the program.  For example, a
  689. typical cp/m program will have references to:
  690.     bdos    at 5
  691.     fcb    at 5ch
  692.     tbuff    at 80h
  693.  
  694. the 'p' (for prologue) command generates the org, then
  695. scans the symbol table and generates equates:
  696.     BDOS    EQU    05H
  697.     FCB    EQU    05CH    (etc.)
  698.  
  699.  
  700. If you have a "e" control entry in your file, you can
  701. list as follows:  laddr,ffff - the listing will continue
  702. until the "e" control entry is found
  703.  
  704.  
  705. additional commands:
  706.  
  707. if you entered a label in the symbol table but now want
  708. to get rid of it:
  709.     k.symbol
  710.  
  711. note to rename a symbol, such as when you had a system-
  712. assigned lnnnn label but now want to make it meaningful:
  713.  
  714.     k.l0334
  715.     e334,.type
  716.  
  717. you could even:
  718.     e.l0334,.type
  719.     k.l0334
  720.  
  721. but that takes more typing.
  722.  
  723.  
  724.  
  725. here are some more commands:
  726.  
  727. ?        prints statistics on symbol and control table
  728.         usage, etc.
  729.  
  730. c        prints the entire control table
  731.  
  732. cnnnn        prints the control table starting
  733.         at address nnnn
  734.  
  735. ds        dumps the symbol table.  Interrupt it
  736.         by typing any key.
  737.  
  738. ds.symbol    starts dumping at the specified symbol,
  739.  
  740.         or the nearest symbol.  thus "ds.f" starts
  741.         the dump at the first label starting
  742.         with the letter 'f'.
  743.  
  744. ....have fun, and let me know of any problems or
  745.     suggested improvements
  746.     ------------------------
  747.  
  748.         ZESOURCE
  749.     "Quick" command summary
  750.  
  751. Any address may be replaced by .symbol i.e. D.START
  752.  
  753. ;addr,comment        Enter a comment
  754. ;addr            Lists existing comment
  755. ;            Lists entire comments table
  756. ;addr,            Deletes existing comment
  757. A(see "L" for operands)    Attempt to find DB's
  758. B(see "L" for operands)    Build default sym tbl (Lxxxx)
  759. C            Dump ctl tbl
  760. Cnnnn            Dump ctl starting at nnnn
  761. Cnnnn,x            Define format from nnnn (B,E,I,S,W)
  762. Dxxxx            Dumps 80H from xxxx on
  763. Daaaa,bbbb        Dumps from aaaa thru bbbb
  764. D,bbbb            Dump thru bbbb
  765. D            Dump 80H more
  766. D=nn            nn= Hex dump size default.
  767. Ds            Dumps the symbol table.
  768. Ds.symbol        Sym dump starting at .symbol
  769. Ennnn,.symbol        Enter symbol into table, kill old
  770. Fnnnn,ssss        Find address nnnn starting at ssss
  771. F            Continue previous find command
  772. Fnnnn            Find nnnn
  773. K.symbol        Kill symbol from symbol table
  774. L            Lists 10 lines from prev pc
  775. Lssss,eeee        Lists from ssss to eeee
  776. L,eeee            Lists from current pc to eeee
  777. Lssss            Lists 10 lines at ssss
  778. L=nn            nn is hex list default # of lines
  779. O            Print current offset
  780. Onnnn            Establish new offset
  781. Pstart addr,end addr    Generate program prolog
  782. Q            Before any command suppresses
  783.             console output: QB100,200
  784. Rfilename.COM        Reads in at offset+100h
  785. Rfilename.CTL        Loads the ctl table
  786. Rfilename.SYM        Loads the sym file
  787. Rfilename.DOC        Loads the comments table 
  788. Rfilename.ALL        Loads the doc, sym, and ctl files
  789. Sfilename.ASM        Save .ASM file.  Write w/L, Z to end
  790. Sfilename.CTL        Saves the CTL table
  791. Sfilename.SYM        Saves the sym file
  792. Sfilename.DOC        Saves the comments table
  793. Sfilename.ALL        Saves the doc, sym, and ctl files
  794. Unnnn            Use nnnn for comments table
  795. X            Purge all symbols and control
  796. Z            Write eof to .ASM file
  797. ?            Prints statistics (sym, ctl, comments)
  798.