home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / tdl-tool.lbr / TR.DQC / TR.DOC
Text File  |  1985-11-30  |  29KB  |  976 lines

  1. .HETR.COM DOCUMENTATION                        NOVEMBER 1985 VERSION
  2.  
  3.  
  4. TR.COM    -    Aε inter-activσ disassemble≥ fo≥ Z8░ codσ usinτ ì
  5. áááááááááááááááInte∞ typσ mnemonics¼ b∙ Alaε ╫ Warren
  6.  
  7.  
  8. DeriveΣ froφ aε earl∙ versioε oµ WarΣ Christensensº RESOURCE.COM¼ ì
  9. TR.CO═ support≤ mos⌠ oµ thσ samσ feature≤ plu≤ severa∞ others¼ ì
  10. anΣ caε disassemblσ Z8░ codσ usinτ thσ samσ mnemonic≤ useΣ b∙ ì
  11. TA.CO═ anΣ TD.COM¼ thσ matchinτ assemble≥ anΣ debugger«  Thσ ì
  12. addeΣ feature≤ ß commanΣ interprete≥ tha⌠ i≤ ß bi⌠ les≤ fuss∙ ì
  13. abou⌠ tokeε delimiter≤ (i⌠ wil∞ accep⌠ dots¼ commas¼ colins¼ ì
  14. semi-colin≤ anΣ spaces)¼ anΣ doe≤ no⌠ requirσ thσ usσ oµ ß do⌠ iε ì
  15. fron⌠ oµ symboliπ names«  Anothe≥ featurσ i≤ ß chaiε read/savσ ì
  16. option¼ tha⌠ wil∞ reaΣ o≥ savσ thσ fou≥ filσ type≤ onσ afte≥ thσ ì
  17. other«  Thσ builΣ commanΣ use≤ differen⌠ letter≤ t∩ prefi° label≤ ì
  18. whicΦ arσ referenceΣ b∙ differen⌠ type≤ oµ code≤ (╠ i≤ fo≥ ì
  19. destinatioε addresse≤ oµ Calls¼ Jumps¼ anΣ Addres≤ tables╗ ═ i≤ ì
  20. fo≥ addresse≤ oµ LHL─ ª SHL─ codes╗ ╬ i≤ fo≥ addresse≤ oµ LD┴ ª ì
  21. ST┴ codes╗ ╨ i≤ fo≥ addresse≤ oµ LX╔ codes╗ ß minu≤ sigε i≤ useΣ ì
  22. wheε thσ addres≤ i≤ abovσ thσ to≡ oµ thσ TPA¼ anΣ thσ negativσ ì
  23. valuσ i≤ useΣ fo≥ thσ res⌠ oµ thσ symbol)«  Additiona∞ command≤ ì
  24. includσ ß pokσ featurσ tha⌠ allow≤ fo≥ an∙ bytσ iε RA═ t∩ bσ ì
  25. changed¼ anΣ ß mathmatic≤ commanΣ tha⌠ print≤ thσ sum¼ ì
  26. difference¼ product¼ etc.
  27.  
  28. TR.COM type≤ aε "*ó promp⌠ wheε i⌠ i≤ loaded«  Yo⌡ ma∙ theε ì
  29. ente≥ an∙ oµ thσ followinτ commands«  EacΦ commanΣ i≤ ß singlσ ì
  30. lette≥ followeΣ b∙ operands«  Comma≤ arσ showε a≤ thσ delimiter¼ ì
  31. bu⌠ ß spacσ wil∞ als∩ work, as will colins, semi-colins and dots.
  32.  
  33.         ----------------
  34.         ----------------
  35. ;    Put comments into the program.
  36.     (must execute 'u' command first, to assign area
  37.     for comments to be placed)
  38.  
  39.     ;addr,comment    enter a comment
  40.     ;addr        lists existing comment
  41.     ;        lists entire comments table
  42.     ;addr,        deletes existing comment
  43.  
  44.     note that '\' is treated as a new line, i.e.
  45.     \test\ will be formatted:
  46.  
  47.     ;
  48.     ;TEST
  49.     ;
  50.         ----------------
  51. Attempt to find DB's while listing the program.
  52. -    This command works just like 'L', but attempts
  53.     to find DB's of 8 chars or longer.
  54.  
  55.     (see 'L' command for operand formats)
  56. .pa        ----------------èBuild default sym tbl (LXXXX) labels for each
  57. -    2 byte operand encountered.  Note 'B' is
  58.     identical to 'L' except labels are built.
  59.  
  60.     (see 'L' command for operand formats)
  61.  
  62.         ----------------
  63. Control table usage:
  64. -    C        Dump control table
  65.     CNNNN        Dump from starting
  66.     CNNNN,X        Define format from NNNN
  67.             to next entry.  Values of x:
  68.  
  69.             B = DB (attempts ASCII
  70.                 printable, 0DH, 0AH, 0)
  71.             W = DW (attempts label)
  72.             S = DW to next ctl entry
  73.             I = instructions
  74.             K = kill this ctl entry
  75.             E = end of disassembly
  76.  
  77.     NOTE every control entry causes a "control break"
  78.     (NO, TR.COM was NOT written in RPG) which means
  79.     a new line will be started.  Thus if you have a
  80.     string in memory which disassembles as:
  81.  
  82.     DB    'Invalid operand',0DH
  83.     DB    0AH
  84.  
  85.     You might want to change it putting the 0DH,0AH
  86.     together on the second line - just enter a "B"
  87.     control entry for the address of the 0DH.
  88.  
  89.     The same technique could be used to make
  90.  
  91.     DB    'TYPESAVEDIR ERA REN '
  92.  
  93.     appear as
  94.  
  95.     DB    'TYPE'
  96.     DB    'SAVE'
  97.     DB    'DIR '
  98.     DB    'ERA '
  99.     DB    'REN '
  100.  
  101. .pa        ----------------èDUMP:
  102. -    DXXXX        Dumps 80H from XXXX on
  103.     DAAAA,BBBB    Dumps from AAAA thru BBBB
  104.     D,BBBB        Continues, thru BBBB
  105.     D        Continues, 80H more
  106.  
  107.     NOTE 80H is the default dump length.  If you have
  108.     a larger display, you can change the default via:
  109.  
  110.     D=NN        NN is the HEX new default.
  111.  
  112.     For example, a 24 line tube could display 100H:
  113.  
  114.     D=100        or..
  115.     D=100,200    Defaults to 100, dumps 200-2ff
  116.         ----------------
  117.  
  118. ENTER SYMBOL:
  119. -    ENNNN,SYMBOL     Symbol may be of any length,
  120.             and contain any char A-Z or 0-9,
  121.             or "+" or "-".  This allows:
  122.             E5D,FCB+1.  Note the "+" is not
  123.             checked, i.e. E5D,.FCB+2 would be
  124.             wrong (assuming FCB is at 5C) but
  125.             would be allowed to be entered.
  126.  
  127.     Note if you enter two symbols for the same address,
  128.     whichever one is first alphabetically will show up
  129.     on the disassembled listing.  If you have a label
  130.     which has the wrong address, you need not explicitly
  131.     kill the old one before entering the new.  A label
  132.     which is spelled exactly the same as an existing one
  133.     will replace the existing one even if the addresses
  134.     are different.
  135.         ----------------
  136.  
  137. Find occurrence of address or label.  Note this function
  138. -    runs until interrupted (press any key).
  139.     FNNNN,SSSS    Find address NNNN in memory.  Start
  140.             the search at SSSS.  Runs forever.
  141.             Press any key to stop.
  142.     F        Continue previous find command
  143.       FNNNN        Find NNNN starting at address you last
  144.             stopped at in the f command
  145.         ----------------
  146.  
  147. KILL SYMBOL from table
  148. -    K SYMBOL
  149. .pa        ----------------èList (disassemble).  This command is used to list the
  150. -    file, or to list it to disk after enabling
  151.     the .ASM file save via 'SFILENAME.ASM' command
  152.  
  153.     L        Lists 10 lines from prev pc
  154.     LSSSS,EEEE    Lists from SSSS to EEEE
  155.     L,EEEE        Lists from current pc to EEEE
  156.     LSSSS        Lists 10 lines at SSSS
  157.  
  158.     Note that if you have a control 'e' entry, then the
  159.     list will stop when that address is found.  This allows
  160.     you to 'LSTART,FFFF'. 
  161.  
  162.     The 10 line default may be changed via:
  163.  
  164.     L=NN        Where NN is a HEX line count, e.g.
  165.     L=14        set to 20 lines/screen
  166.  
  167.     You can change the default and list, e.g.
  168.  
  169.     L=9,100        Dflt to 9 lines, list at 100.
  170.  
  171.     NOTE when using L to list the .ASM program to disk,
  172.     you should either list the entire program at once
  173.     using: LSSSS,EEEE or, you can list small pieces
  174.     at a time.  As long as you list again without
  175.     specifying a starting address, (L or L,NNNN) then
  176.     the output file will continue uninterrupted.
  177.  
  178.     You may do dump commands, and others, without
  179.     affecting what is being written to disk.
  180.         ----------------
  181.  
  182. Offset for Disassembly
  183. -    O        Print current offset
  184.     ONNNN        Establish new offset
  185.  
  186.     (Note the offset is always added to any 
  187.     address specified in an A, B, D  or L command.
  188.     to dump real memory, the offset must be reset to
  189.     0 (O0) before the dump.)
  190.         ----------------
  191.  
  192. Prolog Generation - This routine generates an
  193. -    ORG instruction, and equates for any label
  194.     outside of a given low-hi address pair.
  195.     (the start and end addresses of your program).
  196.     e.g. if disassembling from 100 to 3FF, it will
  197.     generate 'FCB EQU 5CH' if FCB is in the symbol
  198.     table.  In typical use, you would 'SFILENAME.ASM'
  199.     then use the P command to write the prolog, then
  200.     the L command to write the program itself.
  201.  
  202.     PSTART ADDR,END ADDR
  203. .pa    èQuiet command: any command which is preceeded by a q
  204. -    will be done 'quietly'.  For example, to save
  205.     a .ASM program, you could just do:
  206.  
  207.     QL100,3FF    or    QL100,FFFF if you have
  208.     set the 'E' control in the control table.
  209.  
  210.     Another use is to build a default symbol table
  211.     by taking a pass thru the program: QB100,XXXX
  212.         ----------------
  213.  
  214. Read .COM, .CTL, .SYM, or .DOC file
  215. -    RFILENAME.COM    Reads in at offset+100h
  216.     RFILENAME.CTL    Loads the ctl table
  217.     RFILENAME.SYM    Loads the sym file
  218.     RFILENAME.DOC    Loads the comments table (note
  219.             'U' command must have been issued)
  220.     RFILENAME.*    Loads the all of the files above in
  221.             the order shown.  If the offset for
  222.             is set too low, it will be reset higher
  223.             as will the base of the comment table.
  224.         ----------------
  225.  
  226. Save .ASM, .CTL, .SYM, or .DOC file
  227. -    SFILENAME.CTL    Saves the CTL table
  228.     SFILENAME.SYM    Saves the sym file
  229.     SFILENAME.DOC    Saves the comments table
  230.     SFILENAME.ASM    Use 'L' command to write, 'Z' to end
  231.     SFILENAME.AS═    Savσ file≤ a≤ abovσ anΣ enable≤ .AS═ save.
  232.  
  233.         ----------------
  234. Use area of memory for comments table
  235. -    UNNNN        Such as UD000 if you had an
  236.             open board at 0D000h
  237.         ----------------
  238.  
  239. Purge symbol table and control table
  240.     X
  241.     -
  242.         ----------------
  243.  
  244. Close .ASM file (note that a preferred way to close the
  245.     .ASM file is to have specified a control entry
  246.     for the end address (e.g. C1FF,E))
  247.     Z
  248.     -
  249.  
  250.         ----------------
  251. .paèIµ yo⌡ entereΣ ß labe∞ iε thσ symbo∞ tablσ bu⌠ no≈ wan⌠ t∩ ge⌠ ì
  252. riΣ oµ it:
  253.  
  254.     K SYMBOL
  255.  
  256. NOT┼:
  257. T∩ renamσ ß symbol¼ sucΦ a≤ wheε yo⌡ haΣ ß system-assigneΣ ì
  258. LNNNN labe∞ bu⌠ no≈ wan⌠ t∩ makσ i⌠ meaningful:
  259.  
  260.     K L0334
  261.     E334,TYPE
  262.  
  263. you could even:
  264.  
  265.     EL0334 TYPE
  266.     KL0334
  267.  
  268. but that takes more typing.
  269.  
  270.  
  271. ?        Prints statistics on symbol and control table
  272.         usage, etc.
  273.  
  274. C        Prints the entire control table
  275.  
  276. NNNN        Prints the control table starting
  277.         at address NNNN
  278.  
  279. DS        Dumps the symbol table.  Interrupt it
  280.         by typing any key.
  281.  
  282. DS SYMBOL    Symbol starts dumping at the specified symbol,
  283.         or the nearest symbol.  thus "ds.f" starts
  284.         the dump at the first label starting
  285.         with the letter 'f'.
  286.  
  287. --------------------------------------------
  288. .PAè        ---- WATCH FOR ----
  289.  
  290. *    Symbols overflowing into the .COM.
  291.     (Use ? command to see how full symbol table is)
  292.  
  293. *    Control entries overflowing into .SYM (although 
  294.     it's hard to believe anyone will have a program with
  295.     more than 512 control entries!!!)
  296.  
  297. *    Using an offset which is not in free memory
  298.     and overlaying BDOS or whatever.
  299.  
  300. *    The B(uild) command gobbling up too much when building
  301.     a DB:  "B" will take a DB 'GOBBELDY GOOK' followed
  302.     by LXI H,FOO and take the LXI as a '!' (21H) so
  303.     you'll have to manually stick a new "I" control
  304.     entry in at the address of the LXI.  You might
  305.     also delete the incorrect "I" entry which TR.COM
  306.     stuck in (typically at the second byte of the LXI)
  307.  
  308. *    Trying to dump real memory without setting the
  309.     offset back to 0.  (then forgetting to set it back
  310.     to its proper value)
  311.  
  312. *    Forgetting how big the .COM file you are disassembling
  313.     was.
  314.  
  315. *    Using TR.COM to rip off software (yes, I know, you
  316.     heard that before, but only 3 in 100 needed to be 
  317.     told, and 2 in 100 needs to be told again, and 1 in
  318.     100 doesn't give a rat's fuzzy behind anyway!!)
  319.  
  320. *    Forgetting to take checkpoints when disassembling
  321.     large files.  You may even want to rotate the names
  322.     under which things are saved:
  323.  
  324.     STEMP1.SYM
  325.     STEMP1.CTL
  326.     STEMP1.DOC
  327.  
  328. *    Missing a label:  Suppose you have a control entry
  329.     for a DW, resulting in:
  330.     
  331.     DFLT:            ;172C
  332.         DW    100H
  333.  
  334.     but somewhere in the program, the following exists:
  335.  
  336.         LDA     172DH
  337.  
  338.     Even if you did a B and have a label L172D, it won't
  339. .paè    show up since it's in the middle of a DW.  Instead,
  340.     do this:
  341.  
  342.     KL172D        Kill the old label
  343.     E172D,DFLT+1    Put in the new label as a displacement
  344.             off the beginning.
  345.  
  346. *    improperly disassembling DW's (see previous item).
  347.     You might be tempted to make DFLT a DB so that
  348.  
  349.     DFLT:            ;172C
  350.         DB    0
  351.     L172D:            ;172D
  352.         DB    1
  353.  
  354.     Note that while this disassembles and reassembles
  355.     properly, it is not "as correct" as the technique
  356.     used in the previous item.
  357.  
  358. *    Having the "B" command overlay your "E" control entry.
  359.     What?  Well, "B"uild is pretty dumb.  If he finds 8
  360.     DB type characters in a row, he fires off a DB from
  361.     then on until he runs out of those characters.  Suppose
  362.     your program was 200 long (ended at 3FF), and you
  363.     had zeroed (aha!  Nice DB candidates) memory there
  364.     (there meaning at your offset address + whatever).
  365.  
  366.     Then you QB100,400 and viola!!  TR.COM overlaid
  367.     your "E" control with a "B".  
  368.         ----------------
  369. .paèTR.CO═ i≤ relativel∙ complete«  (well¼ actually¼ thσ phrasσ ì
  370. "rampan⌠ featureitisó ha≤ beeε "mentioned")....Bu⌠ there'≤ alway≤ ì
  371. anothe≥ day¼ anΣ anothe≥ K..« SO..« Here'≤ ß "wisΦ listó oµ ì
  372. thing≤ tha⌠ ma∙ bσ includeΣ iε ß futurσ version...i⌠ migh⌠ savσ ì
  373. yo⌡ tellinτ mσ YO╒ thinδ such-and-such would be nice...
  374.  
  375. *        E5C,.FCB
  376.     followed by
  377.         E6C,.FCB+
  378.     should automatically calculate the appropriate
  379.     displacement, and put it in the symbol table.
  380.  
  381. *    The comments facility should be enhanced to allow
  382.     total SUBSTITUTION of entire line(s) of the code,
  383.     i.e. at address such-and-such, replace the next 3
  384.     bytes with the following arbitrary line.  This
  385.     would help those "how do I explain what was being
  386.     done" cases such as:
  387.  
  388.     LXI    H,BUFFER AND 0FF00H
  389.  
  390. *    Add the ability to, in one instruction, rename
  391.     a default (LXXXX) label to a meaningful name.
  392.  
  393. *    Include labels that are imbedded within instruction
  394.     codes.
  395.  
  396.         CALL    0
  397.  
  398.     which has a label imbedded in the address of the call
  399.     would show as:
  400.  
  401.         CALL    0
  402.     TYPADD:    EQU    $-2
  403.  
  404.         ----------------
  405. .PAè.HE                     EXAMPLE OF TR.COM USAGE
  406.  
  407. Given:    a COM file (lets say TEST.COM) which runs at 100
  408.     (as any good COM file should), and goes thru 2FF.
  409.  
  410. Lines preceeded with ---> are typed by you.
  411.  
  412. ---> TR.COM
  413. ---> O2200    Set the offset to 2200, which means the
  414.         program will read into 2200 + 100 = 2300.
  415.  
  416. ---> RTEST.COM    Reads the .COM file into memory.  System says:
  417.         2500 0300 which is the actual hi load addr,
  418.         (2500) and the original hi load addr (300)
  419.  
  420.         REMEMBER this address (300) because you might
  421.         want to put a "E" (end of assembly) control
  422.         entry there.
  423.  
  424. <<<<NOTE>>>> 
  425.     That all 'L' (disassembly list) and 'D' (dump)
  426.     commands work with the offset added.  Thus, you
  427.     should learn to forget that the disassembler is
  428.     in memory, and think of it as if your program were
  429.     actually at 100.  D100 will dump your program.
  430.     
  431.     ALSO:  If the program being disassembled will
  432.     have a fairly large symbol table, then you will
  433.     have to set the offset higher: 02F00 or some such.
  434.     (The ? command will show symbol table usage: if your
  435.     symbol table is nearing the .COM file, then just
  436.     set a new offset (higher) and re-load the .COM)
  437.  
  438.     If you want to dump R-E-A-L memory, you would have
  439.     to reset the offset to 0: o0  (but don't forget to
  440.     reset it to 1F00 before continuing with your program.)
  441.  
  442.  
  443. Iµ yo⌡ arσ disassemblinτ somethinτ whicΦ i≤ iε memor∙ a⌠ it'≤ ì
  444. correc⌠ addres≤ (sucΦ a≤ lookinτ a⌠ CCP⌐ theε don'⌠ se⌠ thσ ì
  445. offset«  I⌠ default≤ t∩ ░ wheε TR i≤ firs⌠ loaded.
  446.  
  447. --->    L100    List your program - lists "about" 10 lines.
  448.  
  449. --->    D100    Do a dump of your program.
  450.  
  451. NOTE:    That typically here are the steps to disassembling
  452.     a program which has just been read into memory:
  453.  
  454. Use the dump command to find the ASCII DB areas.
  455. .PAèNotσ tha⌠ thσ 'Aº commanΣ ma∙ bσ useΣ t∩ automaticall∙ finΣ thσ ì
  456. db's¼ bu⌠ yo⌡ mus⌠ theε checδ theφ t∩ insurσ tha⌠ the∙ don'⌠ ì
  457. extenΣ to∩ far«  Al∞ printablσ characters¼ 0DH¼ 0AH¼ 09H, & 00H arσ ì
  458. considereΣ candidate≤ fo≥ ASCII db's.
  459.  
  460. A⌠ leas⌠ ╕ character≤ iε ß ro≈ mus⌠ bσ founΣ t∩ makσ surσ tha⌠ ì
  461. lonτ sequence≤ oµ mo÷ instruction≤ won'⌠ bσ takeε a≤ db's.
  462.  
  463. Usσ thσ CNNNN,K commanΣ t∩ kil∞ erroniou≤ entrie≤ pu⌠ iε thσ ì
  464. contro∞ tablσ b∙ thσ ß command¼ bu⌠ theε immediatel∙ pu⌠ iε thσ ì
  465. righ⌠ address¼ sucΦ a≤ viß CNNNN,I
  466.  
  467. Iµ yo⌡ wanteΣ t∩ scaε thσ prograφ fo≥ ASCII db'≤ yourself¼ usσ ì
  468. thσ 'Cº (control⌐ commanΣ t∩ se⌠ thσ beginninτ anΣ enΣ oµ ASCII ì
  469. areas«  Fo≥ example¼ ß program which starts out:
  470.  
  471. 0100        JMP    START
  472. 0103        DB    'COPYRIGHT .....'
  473. 0117    START:
  474.  
  475. would show up in the dump as:
  476.  
  477. 0100  C3170144 4F50xxxx  xxxxxxxx xxxxxxxx  *...COPYR IGHT....*
  478. 0110  xxxxxxxx xxxxxxxx  xxxxxxxx xxxxxxxx  *xxxxxxxx ........*
  479.  
  480.  
  481. Thu≤ yo⌡ woulΣ wan⌠ t∩ instruc⌠ thσ disassemble≥ t∩ switcΦ t∩ dΓ ì
  482. modσ a⌠ 103¼ anΣ bacδ t∩ instructioε modσ a⌠ 117¼ thus:
  483.  
  484.     C103,B
  485.     C117,I
  486.  
  487. Continuσ doinτ this¼ bracketinτ ever∙ ASCII dΓ whicΦ i≤ iε thσ ì
  488. middlσ oµ instructions¼ b∙ ß Γ contro∞ instructioε anΣ aε I ì
  489. contro∞ instruction«  Notσ tha⌠ multiplσ db'≤ iε ß ro≈ neeΣ no⌠ ì
  490. havσ separatσ CNNNN,B instructions¼ bu⌠ tha⌠ thesσ d∩ causσ ß ì
  491. 'linσ break'¼ i.e« iµ yo⌡ havσ ß tablσ oµ ASCII commands¼ fo≥ ì
  492. example:
  493.  
  494. 02E5    db    'load'
  495. 02E9    db    'save'
  496.  
  497. the disassembler would disassemble these as:
  498. 02E4    db    'loadsave'
  499.  
  500. Yo⌡ coulΣ pu⌠ iε aε additiona∞ contro∞ entry║ C2E9,B¼ whicΦ woulΣ ì
  501. causσ thσ disassemble≥ t∩ generate:
  502.  
  503. 02E4    db    'load'
  504. 02E8    db    'save'
  505.  
  506. which is much more readable and realistic.
  507. .PAèNotσ tha⌠ beforσ generatinτ eacΦ bytσ oµ ß db¼ ß symbo∞ tablσ ì
  508. looku≡ i≤ donσ t∩ determinσ iµ therσ i≤ ß labe∞ a⌠ tha⌠ location¼ ì
  509. anΣ iµ so¼ ß ne≈ linσ i≤ started.
  510.  
  511. Thu≤ iµ 'LOADLITº anΣ 'SAVELITº werσ iε thσ symbo∞ table¼ a≤ thσ ì
  512. label≤ oε thσ 'loadº anΣ 'saveº above¼ n∩ separatσ 'Bº contro∞ ì
  513. instructioε woulΣ bσ requireΣ a≤ thσ labe∞ woulΣ causσ thσ break.
  514.  
  515. <<<<NOTE>>>╛
  516. Automatiπ labe∞ checkinτ i≤ N-O-T donσ fo≥ d≤ instructions«  Makσ ì
  517. surσ tha⌠ eacΦ d≤ instrucioε reference≤ onl∙ u≡ t∩ thσ nex⌠ ì
  518. label«  Thi≤ mean≤ tha⌠ multiplσ ds'≤ iε ß ro≈ mus⌠ eacΦ bσ ì
  519. explicitl∙ entereΣ int∩ thσ contro∞ table«  Presencσ oµ ß labe∞ ì
  520. i≤ no⌠ sufficient.
  521.  
  522. Afte≥ buildinτ thσ contro∞ entrie≤ witΦ cNNNN,Γ anΣ cNNNN,Θ pu⌠ ì
  523. iε ß contro∞ entr∙ CNNNN,E whicΦ define≤ thσ addres≤ oµ thσ enΣ ì
  524. oµ you≥ program«  Thσ L commanΣ wil∞ theε automaticall∙ sto≡ ì
  525. there¼ anΣ iε addition¼ iµ yo⌡ arσ iε 'SAVE XXX.ASMº mode¼ thσ ì
  526. outpu⌠ .ASM filσ wil∞ bσ closed«  Iµ yo⌡ d∩ mo⌠ definσ ß contro∞ ì
  527. 'Eº entry¼ theε yo⌡ wil∞ havσ t∩ usσ thσ breaδ facilit∙ t∩ sto≡ ì
  528. thσ L commanΣ (don'⌠ usσ control-π a≤ tha⌠ wil∞ re-boo⌠ CP/M)«  ì
  529. Iµ yo⌡ werσ writinτ aε .ASM file¼ yo⌡ woulΣ havσ t∩ use≥ thσ Z ì
  530. commanΣ t∩ closσ thσ file.
  531.  
  532. Next¼ yo⌡ woulΣ lis⌠ you≥ prograφ t∩ determinσ ho≈ i⌠ looks«  ì
  533. Wheε yo⌡ recognizσ ß routinσ b∙ it'≤ function¼ inser⌠ ß label«  ì
  534. Fo≥ example¼ iµ yo⌡ sa≈ tha⌠ locatioε 7EF wa≤ ß characte≥ ou⌠ ì
  535. routinσ (type⌐ theε ente≥ ß labe∞ int∩ thσ symbo∞ table:
  536.  
  537.     E7EF TYPE
  538.  
  539. NOT┼ tha⌠ iµ yo⌡ wan⌠ thσ disassemble≥ t∩ makσ defaul⌠ label≤ fo≥ ì
  540. you¼ usσ B (fo≥ builΣ labels⌐ insteaΣ oµ L (fo≥ lis⌠ program)«  ì
  541. Thσ B command≤ cause≤ LNNNN defaul⌠ label≤ t∩ bσ inserteΣ iε thσ ì
  542. symbo∞ tablσ fo≥ ever∙ ▓ bytσ operanΣ encountereΣ (LXI¼ SHLD¼ ì
  543. JMP¼ etc)«  I⌠ wil∞ undoubtedl∙ makσ somσ yo⌡ don'⌠ want¼ sucΦ a≤ ì
  544. L0000«  Yo⌡ wil∞ havσ to:
  545.  
  546.     K L0000        Kill label L0000 from the table.
  547.  
  548. Wheε yo⌡ encounte≥ datß referencσ instructions¼ tr∙ t∩ determinσ ì
  549. wha⌠ typσ oµ areß thσ instructioε point≤ to«  Typically,¼ LX╔ ì
  550. instruction≤ ma∙ poin⌠ t∩ ß worδ areß whicΦ shoulΣ bσ defineΣ a≤ ì
  551. ß DS¼ o≥ t∩ aε ASCI╔ string¼ iε whicΦ casσ wσ wil∞ havσ alread∙ ì
  552. madσ i⌠ ß 'Bº contro∞ instruction«  Operand≤ oµ LHL─ anΣ SHL─ ì
  553. instruction≤ shoulΣ bσ madσ D╫ instructions«  Fo≥ examplσ iµ yo⌡ ì
  554. encounte≥ LHL─ 0534H¼ theε issuσ ß contro∞ instruction:
  555.  
  556.     C534,W
  557.  
  558. NOT┼ tha⌠ whateve≥ modσ yo⌡ arσ las⌠ iε wil∞ remaiε iε effect«  ì
  559. Thereforσ iµ 534,W i≤ thσ las⌠ entr∙ iε thσ contro∞ table¼ al∞ ì
  560. datß froφ therσ oε wil∞ bσ takeε t∩ bσ DW's.
  561. .PAèSupposσ tha⌠ yo⌡ determinσ tha⌠ addres≤ 7CF i≤ ß 12╕ bytσ buffe≥ ì
  562. fo≥ disδ I/O«  Yo⌡ wan⌠ i⌠ t∩ disassemblσ to:
  563.  
  564. DISKKBUF:        ;07CF
  565.     DS    80H
  566.  
  567. You do this as follows:
  568.  
  569.     C7CF,S        To start the DS
  570.     C84F,B        To define it's end, and
  571.     E7CF,DISKKBUF    To put the symbol in the table.
  572.  
  573. Continue¼ iterativel∙ usinτ thσ 'Lº commanΣ anΣ thσ 'Cº anΣ 'Eº ì
  574. command≤ unti∞ yo⌡ havσ thσ listinτ iε ß nicσ format«  Yo⌡ wil∞ ì
  575. theε probabl∙ wan⌠ t∩ savσ thσ contro∞ symbol¼ anΣ comment≤ ì
  576. tables«  Or¼ yo⌡ coulΣ havσ beeε savinτ theφ a⌠ checkpoin⌠ time≤ ì
  577. (s∩ iµ yo⌡ makσ ß majo≥ mistakσ yo⌡ coulΣ g∩ bacδ t∩ ß previou≤ ì
  578. one).
  579.  
  580. To save a control file:
  581.     SFILENAME.CTL    (Any filename, may include A: or B:)
  582.  
  583. To save a symbol file:
  584.     SFILENAME.SYM
  585.  
  586. To save a comments file:  
  587.     SFILENAME.DOC    (not ".COM" of course)
  588.  
  589. NOT┼ tha⌠ thσ filetype≤ mus⌠ bσ useΣ a≤ shown¼ bu⌠ tha⌠ an∙ lega∞ ì
  590. filenamσ (o≥ disk:FILENAME sucΦ a≤ B:XXXX.CTL⌐ ma∙ bσ used.
  591.  
  592. Yo⌡ coulΣ no≈ control-π t∩ returε t∩ CP/M¼ anΣ comσ bacδ late≥ t∩ ì
  593. resumσ you≥ disassembly:
  594.  
  595. --->    TR
  596. --->    O2200
  597. --->    RTEMP.COM
  598. --->    RTEMP.SYM
  599. --->    RTEMP.CTL
  600. --->    UXXXX        (such as U4000)
  601. --->    RTEMP.DOC
  602.  
  603. Thi≤ wil∞ takσ yo⌡ bacδ exactl∙ wherσ yo⌡ lef⌠ off«  O≥ yo⌡ coulΣ ì
  604. use the default type load:
  605.  
  606. --->    TR
  607. --->    RTEMP.*
  608.     .CTL
  609.     .SYM    SETTING OFFSET     = 4000
  610.     .COM    SETTING COMMENT TABLE = 5700
  611.     .DOC
  612. .PAèIf you want to save a .ASM file out to disk, do the following:
  613.  
  614. Makσ surσ tha⌠ therσ i≤ ß contro∞ entr∙ defininτ thσ enΣ oµ thσ ì
  615. prograφ (sucΦ a≤ c200,e⌐ o≥ elsσ yo⌡ wil∞ havσ t∩ specif∙ thσ ì
  616. endinτ addres≤ anΣ manuall∙ typσ ß · commanΣ t∩ closσ thσ file« 
  617.  
  618.     SFILENAME.ASM
  619.  
  620. ┴ messagσ wil∞ indicatσ tha⌠ thσ filσ i≤ opened«  An∙ subsequen⌠ ì
  621. A, B, o≥ L commanΣ wil∞ havσ whateve≥ i≤ listeΣ writteε t∩ disk«  ì
  622. Encounterinτ ß 'Eº control¼ o≥ typinτ ß 'Zº commanΣ wil∞ theε ì
  623. closσ thσ .ASM file«  Thσ listinτ ma∙ bσ interrupted¼ anΣ ì
  624. continued«  Sincσ thσ L commanΣ type≤ onl∙ 1░ lines¼ usσ ì
  625. LADDR,FFFF t∩ lis⌠ thr⌡ thσ enΣ oµ thσ assembly.
  626.  
  627. Iµ thi≤ i≤ thσ 'finalº savσ oµ thσ .ASM file¼ yo⌡ wil∞ probabl∙ ì
  628. wan⌠ t∩ pu⌠ aε 'ORGº a⌠ thσ beginninτ oµ thσ outpu⌠ file¼ a≤ wel∞ ì
  629. a≤ generatσ EQU instruction≤ fo≥ an∙ reference≤ outsidσ oµ thσ ì
  630. program«  Fo≥ example¼ ß typica∞ CP/M prograφ wil∞ havσ ì
  631. reference≤ to:
  632.  
  633.     BDOS    at 5
  634.     FCB    at 5Ch
  635.     TBUFF    at 80h
  636.  
  637. Thσ 'Pº (fo≥ prologue⌐ commanΣ generate≤ thσ ORG¼ theε scan≤ thσ ì
  638. symbo∞ tablσ anΣ generate≤ equates:
  639.  
  640.     BDOS    EQU    05H
  641.     FCB    EQU    05CH    (etc.)
  642.  
  643. Iµ yo⌡ havσ aε 'Eº contro∞ entr∙ iε you≥ file¼ yo⌡ caε lis⌠ a≤ ì
  644. follows║  LADDR,FFF╞ - thσ listinτ wil∞ continuσ unti∞ thσ 'Eº ì
  645. contro∞ entr∙ i≤ found
  646. .PAèNo≈ let≤ tr∙ ß morσ completσ example¼ thi≤ timσ we'l∞ worδ oε ß ì
  647. prograφ nameΣ TODOC«  Fo≥ thσ sakσ oµ identification¼ command≤ ì
  648. entereΣ froφ thσ consolσ arσ showε iε lowercasσ only¼ anΣ arσ ì
  649. terminateΣ witΦ ß return«  Comment≤ no⌠ entereΣ b∙ thσ ì
  650. disassemble≥ arσ showε oε thσ righ⌠ side...
  651.  
  652. A>tr                ;Call TR from CP/M
  653.  
  654. TR.COM                ;Signs on
  655.  
  656. *rtodoc.*            ;Tell it to Read TODOC.*
  657.  
  658.         ** TR REPLIES **
  659.  
  660.  .CTL    <-- FILE NOT FOUND    
  661.  .SYM    -> SETTING OFFSET    = 3600
  662.  .COM    3980 0380 -> SETTING COMMENT TABLE    = 3A00
  663.  .DOC
  664.  
  665.  SYMBOL TABLE    = 3000 314B
  666.  CURRENT PC    = 0100
  667.  PROGRAM OFFSET    = 3600
  668.  COMMENT TABLE    = 3A00 3C5B
  669.  CONTROL TABLE    = 2A00 2A03
  670.  
  671.  Memory open to DE05
  672.  
  673.     ** WHAT HAPPENED & WHAT ITS TELLING YOU **
  674.  
  675.  .CTL    <-- FILE NOT FOUND
  676.     It was not able to find TODOC.CTL on the disk
  677.  
  678.  .SYM    -> SETTING OFFSET    = 3600
  679.     It found and read TODOC.SYM, but the offset for
  680.     reading the .COM file was to low, so it reset the
  681.     offset at 3600H.
  682.  
  683.  .COM    3980 0380 -> SETTING COMMENT TABLE    = 3A00
  684.     It found and read TODOC.COM, the last address used
  685.     was 0380H, which is offset to 3980H.  The base address
  686.     for the comment table was to low so it reset the
  687.     table to 3A00, just above the .COM file.
  688.  
  689.  
  690.  .DOC
  691.     It found and read TODOC.DOC with no problems.
  692.  
  693.  SYMBOL TABLE    = 3000 314B    ;Table starts at 3000h, ends at 314B
  694.  CURRENT PC    = 0100        ;The next address to be listed is 0100H
  695.  PROGRAM OFFSET    = 3600        ;The .COM file offset is 3600H
  696.  COMMENT TABLE    = 3A00 3C5B    ;Table runs from 3A00H to 3C5BH
  697.  CONTROL TABLE    = 2A00 2A03    ;Table runs from 2A00H to 2A03H
  698.  
  699.  Memory open to DE05        ;The top of the TPA is 0DE05H
  700. .PAè*qa100,380            ;Quietly Attempt to find DB's
  701. *l100                ;List code starting at 100h
  702.  
  703. ;SET STACK & CHECK FOR NAME
  704.  
  705.  0100    LXI    SP,0FEH        ;No label is symbol table for 
  706.  0103    LDA    5DH        ;either of these two addresses
  707.  0106    CPI    '!'
  708.  0108    LXI    D,NONAME
  709.  010B    JZ    FINIS
  710.  
  711. ;COPY FILENAME
  712.  
  713.  010E    LXI    H,FCB
  714.  0111    LXI    D,OFCB
  715.  0114    MVI    C,9
  716.  
  717. *m65 5c            ;math check for 065H and 05CH
  718.  
  719. +    = 0C1H        ;065H + 05CH = 0C1H
  720. -    = 9        ;065H - 05CH = 9
  721.             ;(65H is address of CP/M default file type)
  722. *    = 244CH        ;065H * 05CH = 244CH
  723. /    = 1        ;065H / 05CH = 1
  724. MOD  = 9        ;065H MOD 05CH = 9
  725. AND  = 44H        ;065H AND 05CH = 44H
  726. OR   = 7DH        ;065H OR 05CH = 7DH
  727. XOR  = 39H        ;065H XOR 05CH = 39H
  728.  
  729. *e65 filetype        ;Enter a label named FILETYPE at 065H
  730. *e7c fcb+32        ;Enter a label named FCB+32 at 07CH
  731. *e5d,filename        ;Enter a label named FILENAME at 05DH
  732. *l            ;Continue listing
  733. MVFN:
  734.  0116    MOV    A,M
  735.  0117    STAX    D
  736.  0118    INX    H
  737.  0119    INX    D
  738.  011A    DCR    C
  739.  011B    JNZ    MVFN
  740.  
  741. ;FORCE SOURCE TO .PRN
  742.  
  743.  011E    DB    '!e',0,'6P#6R#6N'    <-- Doesn't look like a string
  744.  
  745. ;OPEN SOURCE
  746.  
  747.  0129    XRA    A
  748.  012A    STA    FCB+32
  749.  012D    LXI    D,FCB
  750.  0130    MVI    C,0FH
  751. .paè*kc11b,12a            ;Kill all control table entries between
  752.                 ;011Bh and 012Ah
  753. CONTROL TABLE = 2A00 2A0C    ;Latest control table beginning & end
  754.  
  755. Memory open to DE05        ;TPA hasn't moved
  756.  
  757. *l11b                ;List starting at 011BH to see what
  758.                 ;removing entries did
  759. ;FORCE SOURCE TO .PRN
  760.  
  761.  011E    LXI    H,FILETYPE
  762.  0121    MVI    M,'P'
  763.  0123    INX    H
  764.  0124    MVI    M,'R'
  765.  0126    INX    H
  766.  0127    MVI    M,'N'        ;Obviously the string was the
  767.                 ;code shown here
  768. ;OPEN SOURCE
  769.  
  770.  0129    XRA    A
  771.  
  772. *l306,360            ;List code from 0306H thru 0360H
  773.  
  774.  0306    'file',0DH,0AH,'$'
  775.  
  776. ;VARIABLES                ;This comment is a give away
  777.  
  778. IPTR:
  779.  030D    RST    7            ;Must not be code
  780.  0310    MVI    B,0
  781.  
  782. OFCB:
  783.  0312    DB    0,'FILENAMEDOC',0,0,0,0,0
  784.  0323    DB    0,0,0,0,0,0,0,0,0,0,0,0,0
  785.  0330    DB    0,0,0,0,0,0,0,0,0,0,0,0,0
  786.  033D    DB    0,0,0,0,0,0,0,0,0,0,0,0,0
  787.  
  788. OLDNO:
  789.  034B    DB    '     '
  790.  
  791. NUNUM:
  792.  034C    DB    0,0,0,0,0,0,0,0,0,0,0,0,0
  793.  0359    DB    0,0
  794.  
  795. CMTCHR:
  796.  035B    DB    0,0,0,0,0
  797.  
  798. *kc306,360            ;Removing all control entries
  799.                 ;between 0306h and 0360h
  800. CONTROL TABLE  = 2A00 2A06    ;New table ends
  801.  
  802. Memory open to DE05        ;Same memory top
  803. .paè*c30d,w                ;Code after 30DH is words
  804. *c310,b                ;Code after 310H is bytes
  805. *c320,s                ;Code after 320H is space
  806. *c346,b                ;Code after 346H is bytes
  807. *c34c,s                ;Code after 34CH is space
  808. *c35b,s                ;Code after 35BH is space
  809. *l306,360            ;List code again
  810.  
  811.  0306    DB    'file',0DH,0AH,'$'
  812.  
  813. ;VARIABLES
  814.  
  815. IPTR:
  816.  030D    DW    05FFH        ;New listing shows an address
  817.  
  818. OPTR:                ;A new address that didn't show before
  819.  030F    DW    OBFR
  820.  
  821. CURCHR:
  822.  0310    DB    0
  823.  
  824. OFCB:
  825.  0312    DB    0,'FILENAMEDOC',0,0
  826.  0320    DS    0026H            ;Space instead of zeros
  827.  
  828. OLDNO:
  829.  034B    DB    '     '
  830.  
  831. LINE:
  832.  034B    DB    0
  833.  
  834. NUNUM:
  835.  034C    DS    000FH        ;Spaces instead of zeros
  836.  
  837. CMTCHR:
  838.  035B    DS    0025H
  839.  
  840. *c380,e                ;Set end of program
  841. *stodok.*            ;Save all files under new name
  842.  
  843.  .CTL                    ;Saving TODOK.CTL
  844.  .SYM                    ;Saving TODOK.SYM
  845.  .DOC                    ;Saving TODOK.DOC
  846.  .ASM      ++WRITING .ASM ENABLED    ;Saving TODOK.ASM ENABLED
  847. USE Z COMMAND OR E CONTROL TO CLOSE FILE++
  848.  
  849.      ***  At this point we will need to include the program    ***
  850.      ***  origin and all of the labels that are not contianed  ***
  851.      ***  withiε thσ prograφ itself«  N∩ othe≥ reaΣ o≥ write≤  ***
  852.      ***  can occur until the .ASM file is closed.             ***
  853. .paè*p100,37f            ;Prolog with all labels out
  854. ;                ;side of the range 0100H and 037FH
  855. ;DISASSEMBLY OF:
  856. ;  TODOC.COM
  857. ;
  858.  
  859.     ORG    0100H
  860. BDOS:    EQU    05H
  861. FCB:    EQU    5CH
  862. FILENAME:    EQU    5DH
  863. FILETYPE:    EQU    65H
  864. IBFR:    EQU    0500H
  865. OBFR:    EQU    0600H        ;Last line of prolog
  866.  
  867. *ql100,400            ;Quietly list 100H thru 400H
  868.                 ;which sends data to .ASM file
  869.  0380    END            ;It got the end of file control
  870. ++ASM FILE CLOSED++        ;and closes the file itself
  871. *^C                ;Control-C exits back to CP/M
  872. A>
  873. .PAè.HECOMMAND SUMMARIES FOR TR.COM    -    VERSION OF 11/16/85
  874.  
  875.  
  876.  
  877.  
  878. SHORT COMMAND SUMMARY
  879. =====================
  880.  
  881. .   Sort symbol table        K  Kill entry
  882. ;   Dump comments table        L  List (Disassemble)
  883. ?   List memory settings    M  Mathmatics functions
  884. ^   Poke address with byte    N  No address toggle
  885. A   Attempt to find DB        O  Show current offset
  886. B   Build dflt syms        P  Prolog for ORG & EQU's
  887. C   Alter control table        Q  Quiet mode (no console out)
  888. D   Dump memory            R  Read file
  889. E   Enter symbol into table    S  Save file
  890. F   Find next occurrence    U  Use addr for comments
  891. Hx  Help with command "x"    X  Purge symbols and control
  892. I   Increment symbols        Z  Close .ASM file
  893.  
  894.  
  895.  
  896.  
  897.  
  898. DETAILED COMMAND SUMMARY
  899. ========================
  900.  
  901. Addr    Means a hex address, or a symbol
  902. [xx]    Means an optional operand.  Multiple addresses must
  903.     be separated by either comma's, spaces, dots, colins,
  904.     or semi-colins.
  905.  
  906.  
  907. .        Sort symbol table
  908.  
  909. ;        Dump comments table
  910. ;addr,COMMENT    Put in comment
  911. ;addr,        Delete comment
  912.  
  913.  
  914. ?        List memory manager settings
  915.  
  916. ^addr,byte    Poke addr with value of byte
  917.  
  918. A[addr][,addr]    Attempt to find DB
  919.  
  920. B[addr][,addr]    Build dflt syms
  921.  
  922. Caddr        Dump ctl from addr
  923. Caddr,K        Kill ctl entry
  924. Caddr,type    Add ctl entry:
  925.  
  926.         B = Byte    E = End
  927.         H = Hex byte    I = Instructions
  928.         S = Space    W = Word
  929. .paèD[addr][,addr]    Dump memory
  930. D=nn        Change default dump size
  931. DS[SYMBOL]    Dump symbol table
  932.  
  933. Eaddr,.SYMbol    Enter/replace symbol into table
  934.  
  935. F        Find next occurrence
  936. Faddr[,strtadr]    Find occurrence of address following start
  937.  
  938. H        Help with commands
  939. Hx        Help with command "x"
  940.  
  941. Iaddr,offset    Increment every symbol from
  942.         addr on, by "offset"
  943.  
  944. K SYMBOL    Kill symbol entry
  945. KCaddr,addr    Kill all control entries
  946.         between addresses
  947.  
  948. L[addr][,addr]    List (Disassemble)
  949. L=nn        Change default # lines in list
  950.  
  951. M  addr,addr    Mathmatics operations on addresses
  952.  
  953. N        No address comments toggle
  954.  
  955. O        Show current offset
  956. Oaddr        Set offset for disassembly
  957.  
  958. Paddr,addr    Prolog: ORG first addr, EQU's
  959.         for all "outside" symbols
  960.  
  961. Q any command    Quiet mode (no console out)
  962.  
  963. RFILENAME.typ    Read .COM, .DOC, .CTL, or .SYM file
  964. RFILENAME.¬    ReaΣ .COM¼ .DOC¼ .CTL¼ and .SY═ filσ
  965.         sequentiall∙ and automatically set offset
  966.         and comment base if needed.
  967.  
  968. SFILENAME.typ    Save .ASM, .DOC, .CTL, or .SYM file
  969. SFILENAME.¬    Savσ .ASM¼ .DOC¼ .CTL¼ and .SY═ file≤ sequentially
  970.  
  971. Uaddr        Use addr for comments table
  972.  
  973. X        Purge all symbols and control
  974.  
  975. Z        Close .ASM file
  976.