home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
utils
/
asmutl
/
tdl-tool.lbr
/
TR.DQC
/
TR.DOC
Wrap
Text File
|
1985-11-30
|
29KB
|
976 lines
.HETR.COM DOCUMENTATION NOVEMBER 1985 VERSION
TR.COM - Aε inter-activσ disassemble≥ fo≥ Z8░ codσ usinτ ì
áááááááááááááááInte∞ typσ mnemonics¼ b∙ Alaε ╫ Warren
DeriveΣ froφ aε earl∙ versioε oµ WarΣ Christensensº RESOURCE.COM¼ ì
TR.CO═ support≤ mos⌠ oµ thσ samσ feature≤ plu≤ severa∞ others¼ ì
anΣ caε disassemblσ Z8░ codσ usinτ thσ samσ mnemonic≤ useΣ b∙ ì
TA.CO═ anΣ TD.COM¼ thσ matchinτ assemble≥ anΣ debugger« Thσ ì
addeΣ feature≤ ß commanΣ interprete≥ tha⌠ i≤ ß bi⌠ les≤ fuss∙ ì
abou⌠ tokeε delimiter≤ (i⌠ wil∞ accep⌠ dots¼ commas¼ colins¼ ì
semi-colin≤ anΣ spaces)¼ anΣ doe≤ no⌠ requirσ thσ usσ oµ ß do⌠ iε ì
fron⌠ oµ symboliπ names« Anothe≥ featurσ i≤ ß chaiε read/savσ ì
option¼ tha⌠ wil∞ reaΣ o≥ savσ thσ fou≥ filσ type≤ onσ afte≥ thσ ì
other« Thσ builΣ commanΣ use≤ differen⌠ letter≤ t∩ prefi° label≤ ì
whicΦ arσ referenceΣ b∙ differen⌠ type≤ oµ code≤ (╠ i≤ fo≥ ì
destinatioε addresse≤ oµ Calls¼ Jumps¼ anΣ Addres≤ tables╗ ═ i≤ ì
fo≥ addresse≤ oµ LHL─ ª SHL─ codes╗ ╬ i≤ fo≥ addresse≤ oµ LD┴ ª ì
ST┴ codes╗ ╨ i≤ fo≥ addresse≤ oµ LX╔ codes╗ ß minu≤ sigε i≤ useΣ ì
wheε thσ addres≤ i≤ abovσ thσ to≡ oµ thσ TPA¼ anΣ thσ negativσ ì
valuσ i≤ useΣ fo≥ thσ res⌠ oµ thσ symbol)« Additiona∞ command≤ ì
includσ ß pokσ featurσ tha⌠ allow≤ fo≥ an∙ bytσ iε RA═ t∩ bσ ì
changed¼ anΣ ß mathmatic≤ commanΣ tha⌠ print≤ thσ sum¼ ì
difference¼ product¼ etc.
TR.COM type≤ aε "*ó promp⌠ wheε i⌠ i≤ loaded« Yo⌡ ma∙ theε ì
ente≥ an∙ oµ thσ followinτ commands« EacΦ commanΣ i≤ ß singlσ ì
lette≥ followeΣ b∙ operands« Comma≤ arσ showε a≤ thσ delimiter¼ ì
bu⌠ ß spacσ wil∞ als∩ work, as will colins, semi-colins and dots.
----------------
----------------
; Put comments into the program.
(must execute 'u' command first, to assign area
for comments to be placed)
;addr,comment enter a comment
;addr lists existing comment
; lists entire comments table
;addr, deletes existing comment
note that '\' is treated as a new line, i.e.
\test\ will be formatted:
;
;TEST
;
----------------
Attempt to find DB's while listing the program.
- This command works just like 'L', but attempts
to find DB's of 8 chars or longer.
(see 'L' command for operand formats)
.pa ----------------èBuild default sym tbl (LXXXX) labels for each
- 2 byte operand encountered. Note 'B' is
identical to 'L' except labels are built.
(see 'L' command for operand formats)
----------------
Control table usage:
- C Dump control table
CNNNN Dump from starting
CNNNN,X Define format from NNNN
to next entry. Values of x:
B = DB (attempts ASCII
printable, 0DH, 0AH, 0)
W = DW (attempts label)
S = DW to next ctl entry
I = instructions
K = kill this ctl entry
E = end of disassembly
NOTE every control entry causes a "control break"
(NO, TR.COM was NOT written in RPG) which means
a new line will be started. Thus if you have a
string in memory which disassembles as:
DB 'Invalid operand',0DH
DB 0AH
You might want to change it putting the 0DH,0AH
together on the second line - just enter a "B"
control entry for the address of the 0DH.
The same technique could be used to make
DB 'TYPESAVEDIR ERA REN '
appear as
DB 'TYPE'
DB 'SAVE'
DB 'DIR '
DB 'ERA '
DB 'REN '
.pa ----------------èDUMP:
- DXXXX Dumps 80H from XXXX on
DAAAA,BBBB Dumps from AAAA thru BBBB
D,BBBB Continues, thru BBBB
D Continues, 80H more
NOTE 80H is the default dump length. If you have
a larger display, you can change the default via:
D=NN NN is the HEX new default.
For example, a 24 line tube could display 100H:
D=100 or..
D=100,200 Defaults to 100, dumps 200-2ff
----------------
ENTER SYMBOL:
- ENNNN,SYMBOL Symbol may be of any length,
and contain any char A-Z or 0-9,
or "+" or "-". This allows:
E5D,FCB+1. Note the "+" is not
checked, i.e. E5D,.FCB+2 would be
wrong (assuming FCB is at 5C) but
would be allowed to be entered.
Note if you enter two symbols for the same address,
whichever one is first alphabetically will show up
on the disassembled listing. If you have a label
which has the wrong address, you need not explicitly
kill the old one before entering the new. A label
which is spelled exactly the same as an existing one
will replace the existing one even if the addresses
are different.
----------------
Find occurrence of address or label. Note this function
- runs until interrupted (press any key).
FNNNN,SSSS Find address NNNN in memory. Start
the search at SSSS. Runs forever.
Press any key to stop.
F Continue previous find command
FNNNN Find NNNN starting at address you last
stopped at in the f command
----------------
KILL SYMBOL from table
- K SYMBOL
.pa ----------------èList (disassemble). This command is used to list the
- file, or to list it to disk after enabling
the .ASM file save via 'SFILENAME.ASM' command
L Lists 10 lines from prev pc
LSSSS,EEEE Lists from SSSS to EEEE
L,EEEE Lists from current pc to EEEE
LSSSS Lists 10 lines at SSSS
Note that if you have a control 'e' entry, then the
list will stop when that address is found. This allows
you to 'LSTART,FFFF'.
The 10 line default may be changed via:
L=NN Where NN is a HEX line count, e.g.
L=14 set to 20 lines/screen
You can change the default and list, e.g.
L=9,100 Dflt to 9 lines, list at 100.
NOTE when using L to list the .ASM program to disk,
you should either list the entire program at once
using: LSSSS,EEEE or, you can list small pieces
at a time. As long as you list again without
specifying a starting address, (L or L,NNNN) then
the output file will continue uninterrupted.
You may do dump commands, and others, without
affecting what is being written to disk.
----------------
Offset for Disassembly
- O Print current offset
ONNNN Establish new offset
(Note the offset is always added to any
address specified in an A, B, D or L command.
to dump real memory, the offset must be reset to
0 (O0) before the dump.)
----------------
Prolog Generation - This routine generates an
- ORG instruction, and equates for any label
outside of a given low-hi address pair.
(the start and end addresses of your program).
e.g. if disassembling from 100 to 3FF, it will
generate 'FCB EQU 5CH' if FCB is in the symbol
table. In typical use, you would 'SFILENAME.ASM'
then use the P command to write the prolog, then
the L command to write the program itself.
PSTART ADDR,END ADDR
.pa èQuiet command: any command which is preceeded by a q
- will be done 'quietly'. For example, to save
a .ASM program, you could just do:
QL100,3FF or QL100,FFFF if you have
set the 'E' control in the control table.
Another use is to build a default symbol table
by taking a pass thru the program: QB100,XXXX
----------------
Read .COM, .CTL, .SYM, or .DOC file
- RFILENAME.COM Reads in at offset+100h
RFILENAME.CTL Loads the ctl table
RFILENAME.SYM Loads the sym file
RFILENAME.DOC Loads the comments table (note
'U' command must have been issued)
RFILENAME.* Loads the all of the files above in
the order shown. If the offset for
is set too low, it will be reset higher
as will the base of the comment table.
----------------
Save .ASM, .CTL, .SYM, or .DOC file
- SFILENAME.CTL Saves the CTL table
SFILENAME.SYM Saves the sym file
SFILENAME.DOC Saves the comments table
SFILENAME.ASM Use 'L' command to write, 'Z' to end
SFILENAME.AS═ Savσ file≤ a≤ abovσ anΣ enable≤ .AS═ save.
----------------
Use area of memory for comments table
- UNNNN Such as UD000 if you had an
open board at 0D000h
----------------
Purge symbol table and control table
X
-
----------------
Close .ASM file (note that a preferred way to close the
.ASM file is to have specified a control entry
for the end address (e.g. C1FF,E))
Z
-
----------------
.paèIµ yo⌡ entereΣ ß labe∞ iε thσ symbo∞ tablσ bu⌠ no≈ wan⌠ t∩ ge⌠ ì
riΣ oµ it:
K SYMBOL
NOT┼:
T∩ renamσ ß symbol¼ sucΦ a≤ wheε yo⌡ haΣ ß system-assigneΣ ì
LNNNN labe∞ bu⌠ no≈ wan⌠ t∩ makσ i⌠ meaningful:
K L0334
E334,TYPE
you could even:
EL0334 TYPE
KL0334
but that takes more typing.
? Prints statistics on symbol and control table
usage, etc.
C Prints the entire control table
NNNN Prints the control table starting
at address NNNN
DS Dumps the symbol table. Interrupt it
by typing any key.
DS SYMBOL Symbol starts dumping at the specified symbol,
or the nearest symbol. thus "ds.f" starts
the dump at the first label starting
with the letter 'f'.
--------------------------------------------
.PAè ---- WATCH FOR ----
* Symbols overflowing into the .COM.
(Use ? command to see how full symbol table is)
* Control entries overflowing into .SYM (although
it's hard to believe anyone will have a program with
more than 512 control entries!!!)
* Using an offset which is not in free memory
and overlaying BDOS or whatever.
* The B(uild) command gobbling up too much when building
a DB: "B" will take a DB 'GOBBELDY GOOK' followed
by LXI H,FOO and take the LXI as a '!' (21H) so
you'll have to manually stick a new "I" control
entry in at the address of the LXI. You might
also delete the incorrect "I" entry which TR.COM
stuck in (typically at the second byte of the LXI)
* Trying to dump real memory without setting the
offset back to 0. (then forgetting to set it back
to its proper value)
* Forgetting how big the .COM file you are disassembling
was.
* Using TR.COM to rip off software (yes, I know, you
heard that before, but only 3 in 100 needed to be
told, and 2 in 100 needs to be told again, and 1 in
100 doesn't give a rat's fuzzy behind anyway!!)
* Forgetting to take checkpoints when disassembling
large files. You may even want to rotate the names
under which things are saved:
STEMP1.SYM
STEMP1.CTL
STEMP1.DOC
* Missing a label: Suppose you have a control entry
for a DW, resulting in:
DFLT: ;172C
DW 100H
but somewhere in the program, the following exists:
LDA 172DH
Even if you did a B and have a label L172D, it won't
.paè show up since it's in the middle of a DW. Instead,
do this:
KL172D Kill the old label
E172D,DFLT+1 Put in the new label as a displacement
off the beginning.
* improperly disassembling DW's (see previous item).
You might be tempted to make DFLT a DB so that
DFLT: ;172C
DB 0
L172D: ;172D
DB 1
Note that while this disassembles and reassembles
properly, it is not "as correct" as the technique
used in the previous item.
* Having the "B" command overlay your "E" control entry.
What? Well, "B"uild is pretty dumb. If he finds 8
DB type characters in a row, he fires off a DB from
then on until he runs out of those characters. Suppose
your program was 200 long (ended at 3FF), and you
had zeroed (aha! Nice DB candidates) memory there
(there meaning at your offset address + whatever).
Then you QB100,400 and viola!! TR.COM overlaid
your "E" control with a "B".
----------------
.paèTR.CO═ i≤ relativel∙ complete« (well¼ actually¼ thσ phrasσ ì
"rampan⌠ featureitisó ha≤ beeε "mentioned")....Bu⌠ there'≤ alway≤ ì
anothe≥ day¼ anΣ anothe≥ K..« SO..« Here'≤ ß "wisΦ listó oµ ì
thing≤ tha⌠ ma∙ bσ includeΣ iε ß futurσ version...i⌠ migh⌠ savσ ì
yo⌡ tellinτ mσ YO╒ thinδ such-and-such would be nice...
* E5C,.FCB
followed by
E6C,.FCB+
should automatically calculate the appropriate
displacement, and put it in the symbol table.
* The comments facility should be enhanced to allow
total SUBSTITUTION of entire line(s) of the code,
i.e. at address such-and-such, replace the next 3
bytes with the following arbitrary line. This
would help those "how do I explain what was being
done" cases such as:
LXI H,BUFFER AND 0FF00H
* Add the ability to, in one instruction, rename
a default (LXXXX) label to a meaningful name.
* Include labels that are imbedded within instruction
codes.
CALL 0
which has a label imbedded in the address of the call
would show as:
CALL 0
TYPADD: EQU $-2
----------------
.PAè.HE EXAMPLE OF TR.COM USAGE
Given: a COM file (lets say TEST.COM) which runs at 100
(as any good COM file should), and goes thru 2FF.
Lines preceeded with ---> are typed by you.
---> TR.COM
---> O2200 Set the offset to 2200, which means the
program will read into 2200 + 100 = 2300.
---> RTEST.COM Reads the .COM file into memory. System says:
2500 0300 which is the actual hi load addr,
(2500) and the original hi load addr (300)
REMEMBER this address (300) because you might
want to put a "E" (end of assembly) control
entry there.
<<<<NOTE>>>>
That all 'L' (disassembly list) and 'D' (dump)
commands work with the offset added. Thus, you
should learn to forget that the disassembler is
in memory, and think of it as if your program were
actually at 100. D100 will dump your program.
ALSO: If the program being disassembled will
have a fairly large symbol table, then you will
have to set the offset higher: 02F00 or some such.
(The ? command will show symbol table usage: if your
symbol table is nearing the .COM file, then just
set a new offset (higher) and re-load the .COM)
If you want to dump R-E-A-L memory, you would have
to reset the offset to 0: o0 (but don't forget to
reset it to 1F00 before continuing with your program.)
Iµ yo⌡ arσ disassemblinτ somethinτ whicΦ i≤ iε memor∙ a⌠ it'≤ ì
correc⌠ addres≤ (sucΦ a≤ lookinτ a⌠ CCP⌐ theε don'⌠ se⌠ thσ ì
offset« I⌠ default≤ t∩ ░ wheε TR i≤ firs⌠ loaded.
---> L100 List your program - lists "about" 10 lines.
---> D100 Do a dump of your program.
NOTE: That typically here are the steps to disassembling
a program which has just been read into memory:
Use the dump command to find the ASCII DB areas.
.PAèNotσ tha⌠ thσ 'Aº commanΣ ma∙ bσ useΣ t∩ automaticall∙ finΣ thσ ì
db's¼ bu⌠ yo⌡ mus⌠ theε checδ theφ t∩ insurσ tha⌠ the∙ don'⌠ ì
extenΣ to∩ far« Al∞ printablσ characters¼ 0DH¼ 0AH¼ 09H, & 00H arσ ì
considereΣ candidate≤ fo≥ ASCII db's.
A⌠ leas⌠ ╕ character≤ iε ß ro≈ mus⌠ bσ founΣ t∩ makσ surσ tha⌠ ì
lonτ sequence≤ oµ mo÷ instruction≤ won'⌠ bσ takeε a≤ db's.
Usσ thσ CNNNN,K commanΣ t∩ kil∞ erroniou≤ entrie≤ pu⌠ iε thσ ì
contro∞ tablσ b∙ thσ ß command¼ bu⌠ theε immediatel∙ pu⌠ iε thσ ì
righ⌠ address¼ sucΦ a≤ viß CNNNN,I
Iµ yo⌡ wanteΣ t∩ scaε thσ prograφ fo≥ ASCII db'≤ yourself¼ usσ ì
thσ 'Cº (control⌐ commanΣ t∩ se⌠ thσ beginninτ anΣ enΣ oµ ASCII ì
areas« Fo≥ example¼ ß program which starts out:
0100 JMP START
0103 DB 'COPYRIGHT .....'
0117 START:
would show up in the dump as:
0100 C3170144 4F50xxxx xxxxxxxx xxxxxxxx *...COPYR IGHT....*
0110 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx *xxxxxxxx ........*
Thu≤ yo⌡ woulΣ wan⌠ t∩ instruc⌠ thσ disassemble≥ t∩ switcΦ t∩ dΓ ì
modσ a⌠ 103¼ anΣ bacδ t∩ instructioε modσ a⌠ 117¼ thus:
C103,B
C117,I
Continuσ doinτ this¼ bracketinτ ever∙ ASCII dΓ whicΦ i≤ iε thσ ì
middlσ oµ instructions¼ b∙ ß Γ contro∞ instructioε anΣ aε I ì
contro∞ instruction« Notσ tha⌠ multiplσ db'≤ iε ß ro≈ neeΣ no⌠ ì
havσ separatσ CNNNN,B instructions¼ bu⌠ tha⌠ thesσ d∩ causσ ß ì
'linσ break'¼ i.e« iµ yo⌡ havσ ß tablσ oµ ASCII commands¼ fo≥ ì
example:
02E5 db 'load'
02E9 db 'save'
the disassembler would disassemble these as:
02E4 db 'loadsave'
Yo⌡ coulΣ pu⌠ iε aε additiona∞ contro∞ entry║ C2E9,B¼ whicΦ woulΣ ì
causσ thσ disassemble≥ t∩ generate:
02E4 db 'load'
02E8 db 'save'
which is much more readable and realistic.
.PAèNotσ tha⌠ beforσ generatinτ eacΦ bytσ oµ ß db¼ ß symbo∞ tablσ ì
looku≡ i≤ donσ t∩ determinσ iµ therσ i≤ ß labe∞ a⌠ tha⌠ location¼ ì
anΣ iµ so¼ ß ne≈ linσ i≤ started.
Thu≤ iµ 'LOADLITº anΣ 'SAVELITº werσ iε thσ symbo∞ table¼ a≤ thσ ì
label≤ oε thσ 'loadº anΣ 'saveº above¼ n∩ separatσ 'Bº contro∞ ì
instructioε woulΣ bσ requireΣ a≤ thσ labe∞ woulΣ causσ thσ break.
<<<<NOTE>>>╛
Automatiπ labe∞ checkinτ i≤ N-O-T donσ fo≥ d≤ instructions« Makσ ì
surσ tha⌠ eacΦ d≤ instrucioε reference≤ onl∙ u≡ t∩ thσ nex⌠ ì
label« Thi≤ mean≤ tha⌠ multiplσ ds'≤ iε ß ro≈ mus⌠ eacΦ bσ ì
explicitl∙ entereΣ int∩ thσ contro∞ table« Presencσ oµ ß labe∞ ì
i≤ no⌠ sufficient.
Afte≥ buildinτ thσ contro∞ entrie≤ witΦ cNNNN,Γ anΣ cNNNN,Θ pu⌠ ì
iε ß contro∞ entr∙ CNNNN,E whicΦ define≤ thσ addres≤ oµ thσ enΣ ì
oµ you≥ program« Thσ L commanΣ wil∞ theε automaticall∙ sto≡ ì
there¼ anΣ iε addition¼ iµ yo⌡ arσ iε 'SAVE XXX.ASMº mode¼ thσ ì
outpu⌠ .ASM filσ wil∞ bσ closed« Iµ yo⌡ d∩ mo⌠ definσ ß contro∞ ì
'Eº entry¼ theε yo⌡ wil∞ havσ t∩ usσ thσ breaδ facilit∙ t∩ sto≡ ì
thσ L commanΣ (don'⌠ usσ control-π a≤ tha⌠ wil∞ re-boo⌠ CP/M)« ì
Iµ yo⌡ werσ writinτ aε .ASM file¼ yo⌡ woulΣ havσ t∩ use≥ thσ Z ì
commanΣ t∩ closσ thσ file.
Next¼ yo⌡ woulΣ lis⌠ you≥ prograφ t∩ determinσ ho≈ i⌠ looks« ì
Wheε yo⌡ recognizσ ß routinσ b∙ it'≤ function¼ inser⌠ ß label« ì
Fo≥ example¼ iµ yo⌡ sa≈ tha⌠ locatioε 7EF wa≤ ß characte≥ ou⌠ ì
routinσ (type⌐ theε ente≥ ß labe∞ int∩ thσ symbo∞ table:
E7EF TYPE
NOT┼ tha⌠ iµ yo⌡ wan⌠ thσ disassemble≥ t∩ makσ defaul⌠ label≤ fo≥ ì
you¼ usσ B (fo≥ builΣ labels⌐ insteaΣ oµ L (fo≥ lis⌠ program)« ì
Thσ B command≤ cause≤ LNNNN defaul⌠ label≤ t∩ bσ inserteΣ iε thσ ì
symbo∞ tablσ fo≥ ever∙ ▓ bytσ operanΣ encountereΣ (LXI¼ SHLD¼ ì
JMP¼ etc)« I⌠ wil∞ undoubtedl∙ makσ somσ yo⌡ don'⌠ want¼ sucΦ a≤ ì
L0000« Yo⌡ wil∞ havσ to:
K L0000 Kill label L0000 from the table.
Wheε yo⌡ encounte≥ datß referencσ instructions¼ tr∙ t∩ determinσ ì
wha⌠ typσ oµ areß thσ instructioε point≤ to« Typically,¼ LX╔ ì
instruction≤ ma∙ poin⌠ t∩ ß worδ areß whicΦ shoulΣ bσ defineΣ a≤ ì
ß DS¼ o≥ t∩ aε ASCI╔ string¼ iε whicΦ casσ wσ wil∞ havσ alread∙ ì
madσ i⌠ ß 'Bº contro∞ instruction« Operand≤ oµ LHL─ anΣ SHL─ ì
instruction≤ shoulΣ bσ madσ D╫ instructions« Fo≥ examplσ iµ yo⌡ ì
encounte≥ LHL─ 0534H¼ theε issuσ ß contro∞ instruction:
C534,W
NOT┼ tha⌠ whateve≥ modσ yo⌡ arσ las⌠ iε wil∞ remaiε iε effect« ì
Thereforσ iµ 534,W i≤ thσ las⌠ entr∙ iε thσ contro∞ table¼ al∞ ì
datß froφ therσ oε wil∞ bσ takeε t∩ bσ DW's.
.PAèSupposσ tha⌠ yo⌡ determinσ tha⌠ addres≤ 7CF i≤ ß 12╕ bytσ buffe≥ ì
fo≥ disδ I/O« Yo⌡ wan⌠ i⌠ t∩ disassemblσ to:
DISKKBUF: ;07CF
DS 80H
You do this as follows:
C7CF,S To start the DS
C84F,B To define it's end, and
E7CF,DISKKBUF To put the symbol in the table.
Continue¼ iterativel∙ usinτ thσ 'Lº commanΣ anΣ thσ 'Cº anΣ 'Eº ì
command≤ unti∞ yo⌡ havσ thσ listinτ iε ß nicσ format« Yo⌡ wil∞ ì
theε probabl∙ wan⌠ t∩ savσ thσ contro∞ symbol¼ anΣ comment≤ ì
tables« Or¼ yo⌡ coulΣ havσ beeε savinτ theφ a⌠ checkpoin⌠ time≤ ì
(s∩ iµ yo⌡ makσ ß majo≥ mistakσ yo⌡ coulΣ g∩ bacδ t∩ ß previou≤ ì
one).
To save a control file:
SFILENAME.CTL (Any filename, may include A: or B:)
To save a symbol file:
SFILENAME.SYM
To save a comments file:
SFILENAME.DOC (not ".COM" of course)
NOT┼ tha⌠ thσ filetype≤ mus⌠ bσ useΣ a≤ shown¼ bu⌠ tha⌠ an∙ lega∞ ì
filenamσ (o≥ disk:FILENAME sucΦ a≤ B:XXXX.CTL⌐ ma∙ bσ used.
Yo⌡ coulΣ no≈ control-π t∩ returε t∩ CP/M¼ anΣ comσ bacδ late≥ t∩ ì
resumσ you≥ disassembly:
---> TR
---> O2200
---> RTEMP.COM
---> RTEMP.SYM
---> RTEMP.CTL
---> UXXXX (such as U4000)
---> RTEMP.DOC
Thi≤ wil∞ takσ yo⌡ bacδ exactl∙ wherσ yo⌡ lef⌠ off« O≥ yo⌡ coulΣ ì
use the default type load:
---> TR
---> RTEMP.*
.CTL
.SYM SETTING OFFSET = 4000
.COM SETTING COMMENT TABLE = 5700
.DOC
.PAèIf you want to save a .ASM file out to disk, do the following:
Makσ surσ tha⌠ therσ i≤ ß contro∞ entr∙ defininτ thσ enΣ oµ thσ ì
prograφ (sucΦ a≤ c200,e⌐ o≥ elsσ yo⌡ wil∞ havσ t∩ specif∙ thσ ì
endinτ addres≤ anΣ manuall∙ typσ ß · commanΣ t∩ closσ thσ file«
SFILENAME.ASM
┴ messagσ wil∞ indicatσ tha⌠ thσ filσ i≤ opened« An∙ subsequen⌠ ì
A, B, o≥ L commanΣ wil∞ havσ whateve≥ i≤ listeΣ writteε t∩ disk« ì
Encounterinτ ß 'Eº control¼ o≥ typinτ ß 'Zº commanΣ wil∞ theε ì
closσ thσ .ASM file« Thσ listinτ ma∙ bσ interrupted¼ anΣ ì
continued« Sincσ thσ L commanΣ type≤ onl∙ 1░ lines¼ usσ ì
LADDR,FFFF t∩ lis⌠ thr⌡ thσ enΣ oµ thσ assembly.
Iµ thi≤ i≤ thσ 'finalº savσ oµ thσ .ASM file¼ yo⌡ wil∞ probabl∙ ì
wan⌠ t∩ pu⌠ aε 'ORGº a⌠ thσ beginninτ oµ thσ outpu⌠ file¼ a≤ wel∞ ì
a≤ generatσ EQU instruction≤ fo≥ an∙ reference≤ outsidσ oµ thσ ì
program« Fo≥ example¼ ß typica∞ CP/M prograφ wil∞ havσ ì
reference≤ to:
BDOS at 5
FCB at 5Ch
TBUFF at 80h
Thσ 'Pº (fo≥ prologue⌐ commanΣ generate≤ thσ ORG¼ theε scan≤ thσ ì
symbo∞ tablσ anΣ generate≤ equates:
BDOS EQU 05H
FCB EQU 05CH (etc.)
Iµ yo⌡ havσ aε 'Eº contro∞ entr∙ iε you≥ file¼ yo⌡ caε lis⌠ a≤ ì
follows║ LADDR,FFF╞ - thσ listinτ wil∞ continuσ unti∞ thσ 'Eº ì
contro∞ entr∙ i≤ found
.PAèNo≈ let≤ tr∙ ß morσ completσ example¼ thi≤ timσ we'l∞ worδ oε ß ì
prograφ nameΣ TODOC« Fo≥ thσ sakσ oµ identification¼ command≤ ì
entereΣ froφ thσ consolσ arσ showε iε lowercasσ only¼ anΣ arσ ì
terminateΣ witΦ ß return« Comment≤ no⌠ entereΣ b∙ thσ ì
disassemble≥ arσ showε oε thσ righ⌠ side...
A>tr ;Call TR from CP/M
TR.COM ;Signs on
*rtodoc.* ;Tell it to Read TODOC.*
** TR REPLIES **
.CTL <-- FILE NOT FOUND
.SYM -> SETTING OFFSET = 3600
.COM 3980 0380 -> SETTING COMMENT TABLE = 3A00
.DOC
SYMBOL TABLE = 3000 314B
CURRENT PC = 0100
PROGRAM OFFSET = 3600
COMMENT TABLE = 3A00 3C5B
CONTROL TABLE = 2A00 2A03
Memory open to DE05
** WHAT HAPPENED & WHAT ITS TELLING YOU **
.CTL <-- FILE NOT FOUND
It was not able to find TODOC.CTL on the disk
.SYM -> SETTING OFFSET = 3600
It found and read TODOC.SYM, but the offset for
reading the .COM file was to low, so it reset the
offset at 3600H.
.COM 3980 0380 -> SETTING COMMENT TABLE = 3A00
It found and read TODOC.COM, the last address used
was 0380H, which is offset to 3980H. The base address
for the comment table was to low so it reset the
table to 3A00, just above the .COM file.
.DOC
It found and read TODOC.DOC with no problems.
SYMBOL TABLE = 3000 314B ;Table starts at 3000h, ends at 314B
CURRENT PC = 0100 ;The next address to be listed is 0100H
PROGRAM OFFSET = 3600 ;The .COM file offset is 3600H
COMMENT TABLE = 3A00 3C5B ;Table runs from 3A00H to 3C5BH
CONTROL TABLE = 2A00 2A03 ;Table runs from 2A00H to 2A03H
Memory open to DE05 ;The top of the TPA is 0DE05H
.PAè*qa100,380 ;Quietly Attempt to find DB's
*l100 ;List code starting at 100h
;SET STACK & CHECK FOR NAME
0100 LXI SP,0FEH ;No label is symbol table for
0103 LDA 5DH ;either of these two addresses
0106 CPI '!'
0108 LXI D,NONAME
010B JZ FINIS
;COPY FILENAME
010E LXI H,FCB
0111 LXI D,OFCB
0114 MVI C,9
*m65 5c ;math check for 065H and 05CH
+ = 0C1H ;065H + 05CH = 0C1H
- = 9 ;065H - 05CH = 9
;(65H is address of CP/M default file type)
* = 244CH ;065H * 05CH = 244CH
/ = 1 ;065H / 05CH = 1
MOD = 9 ;065H MOD 05CH = 9
AND = 44H ;065H AND 05CH = 44H
OR = 7DH ;065H OR 05CH = 7DH
XOR = 39H ;065H XOR 05CH = 39H
*e65 filetype ;Enter a label named FILETYPE at 065H
*e7c fcb+32 ;Enter a label named FCB+32 at 07CH
*e5d,filename ;Enter a label named FILENAME at 05DH
*l ;Continue listing
MVFN:
0116 MOV A,M
0117 STAX D
0118 INX H
0119 INX D
011A DCR C
011B JNZ MVFN
;FORCE SOURCE TO .PRN
011E DB '!e',0,'6P#6R#6N' <-- Doesn't look like a string
;OPEN SOURCE
0129 XRA A
012A STA FCB+32
012D LXI D,FCB
0130 MVI C,0FH
.paè*kc11b,12a ;Kill all control table entries between
;011Bh and 012Ah
CONTROL TABLE = 2A00 2A0C ;Latest control table beginning & end
Memory open to DE05 ;TPA hasn't moved
*l11b ;List starting at 011BH to see what
;removing entries did
;FORCE SOURCE TO .PRN
011E LXI H,FILETYPE
0121 MVI M,'P'
0123 INX H
0124 MVI M,'R'
0126 INX H
0127 MVI M,'N' ;Obviously the string was the
;code shown here
;OPEN SOURCE
0129 XRA A
*l306,360 ;List code from 0306H thru 0360H
0306 'file',0DH,0AH,'$'
;VARIABLES ;This comment is a give away
IPTR:
030D RST 7 ;Must not be code
0310 MVI B,0
OFCB:
0312 DB 0,'FILENAMEDOC',0,0,0,0,0
0323 DB 0,0,0,0,0,0,0,0,0,0,0,0,0
0330 DB 0,0,0,0,0,0,0,0,0,0,0,0,0
033D DB 0,0,0,0,0,0,0,0,0,0,0,0,0
OLDNO:
034B DB ' '
NUNUM:
034C DB 0,0,0,0,0,0,0,0,0,0,0,0,0
0359 DB 0,0
CMTCHR:
035B DB 0,0,0,0,0
*kc306,360 ;Removing all control entries
;between 0306h and 0360h
CONTROL TABLE = 2A00 2A06 ;New table ends
Memory open to DE05 ;Same memory top
.paè*c30d,w ;Code after 30DH is words
*c310,b ;Code after 310H is bytes
*c320,s ;Code after 320H is space
*c346,b ;Code after 346H is bytes
*c34c,s ;Code after 34CH is space
*c35b,s ;Code after 35BH is space
*l306,360 ;List code again
0306 DB 'file',0DH,0AH,'$'
;VARIABLES
IPTR:
030D DW 05FFH ;New listing shows an address
OPTR: ;A new address that didn't show before
030F DW OBFR
CURCHR:
0310 DB 0
OFCB:
0312 DB 0,'FILENAMEDOC',0,0
0320 DS 0026H ;Space instead of zeros
OLDNO:
034B DB ' '
LINE:
034B DB 0
NUNUM:
034C DS 000FH ;Spaces instead of zeros
CMTCHR:
035B DS 0025H
*c380,e ;Set end of program
*stodok.* ;Save all files under new name
.CTL ;Saving TODOK.CTL
.SYM ;Saving TODOK.SYM
.DOC ;Saving TODOK.DOC
.ASM ++WRITING .ASM ENABLED ;Saving TODOK.ASM ENABLED
USE Z COMMAND OR E CONTROL TO CLOSE FILE++
*** At this point we will need to include the program ***
*** origin and all of the labels that are not contianed ***
*** withiε thσ prograφ itself« N∩ othe≥ reaΣ o≥ write≤ ***
*** can occur until the .ASM file is closed. ***
.paè*p100,37f ;Prolog with all labels out
; ;side of the range 0100H and 037FH
;DISASSEMBLY OF:
; TODOC.COM
;
ORG 0100H
BDOS: EQU 05H
FCB: EQU 5CH
FILENAME: EQU 5DH
FILETYPE: EQU 65H
IBFR: EQU 0500H
OBFR: EQU 0600H ;Last line of prolog
*ql100,400 ;Quietly list 100H thru 400H
;which sends data to .ASM file
0380 END ;It got the end of file control
++ASM FILE CLOSED++ ;and closes the file itself
*^C ;Control-C exits back to CP/M
A>
.PAè.HECOMMAND SUMMARIES FOR TR.COM - VERSION OF 11/16/85
SHORT COMMAND SUMMARY
=====================
. Sort symbol table K Kill entry
; Dump comments table L List (Disassemble)
? List memory settings M Mathmatics functions
^ Poke address with byte N No address toggle
A Attempt to find DB O Show current offset
B Build dflt syms P Prolog for ORG & EQU's
C Alter control table Q Quiet mode (no console out)
D Dump memory R Read file
E Enter symbol into table S Save file
F Find next occurrence U Use addr for comments
Hx Help with command "x" X Purge symbols and control
I Increment symbols Z Close .ASM file
DETAILED COMMAND SUMMARY
========================
Addr Means a hex address, or a symbol
[xx] Means an optional operand. Multiple addresses must
be separated by either comma's, spaces, dots, colins,
or semi-colins.
. Sort symbol table
; Dump comments table
;addr,COMMENT Put in comment
;addr, Delete comment
? List memory manager settings
^addr,byte Poke addr with value of byte
A[addr][,addr] Attempt to find DB
B[addr][,addr] Build dflt syms
Caddr Dump ctl from addr
Caddr,K Kill ctl entry
Caddr,type Add ctl entry:
B = Byte E = End
H = Hex byte I = Instructions
S = Space W = Word
.paèD[addr][,addr] Dump memory
D=nn Change default dump size
DS[SYMBOL] Dump symbol table
Eaddr,.SYMbol Enter/replace symbol into table
F Find next occurrence
Faddr[,strtadr] Find occurrence of address following start
H Help with commands
Hx Help with command "x"
Iaddr,offset Increment every symbol from
addr on, by "offset"
K SYMBOL Kill symbol entry
KCaddr,addr Kill all control entries
between addresses
L[addr][,addr] List (Disassemble)
L=nn Change default # lines in list
M addr,addr Mathmatics operations on addresses
N No address comments toggle
O Show current offset
Oaddr Set offset for disassembly
Paddr,addr Prolog: ORG first addr, EQU's
for all "outside" symbols
Q any command Quiet mode (no console out)
RFILENAME.typ Read .COM, .DOC, .CTL, or .SYM file
RFILENAME.¬ ReaΣ .COM¼ .DOC¼ .CTL¼ and .SY═ filσ
sequentiall∙ and automatically set offset
and comment base if needed.
SFILENAME.typ Save .ASM, .DOC, .CTL, or .SYM file
SFILENAME.¬ Savσ .ASM¼ .DOC¼ .CTL¼ and .SY═ file≤ sequentially
Uaddr Use addr for comments table
X Purge all symbols and control
Z Close .ASM file