home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / SIMTEL / CPMUG / CPMUG042.ARK / RESOURCE.DOC < prev    next >
Text File  |  1984-04-29  |  26KB  |  772 lines

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