home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpmhelp / resource.hlp < prev    next >
Text File  |  1994-07-27  |  28KB  |  698 lines

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