Download Print this page

Radio Shack TRS-80 Model II Reference Manual page 125

Disk operating system
Hide thumbs Also See for TRS-80 Model II:

Advertisement

UTILITY PROGRAMS
Using PATCH on a Program File
Remember that in this context, "program files" refers strictly to those files
stored with the "P" attribute. Use the
DlR
command to find out the attributes
of a file.
BASIC
programs have the "D", not the "P", attribute. (See
instructions for changing data files.) Program files are created with
DUMP.
Suppose you want to change seven bytes in a machine-language program file.
First determine where the seven-byte sequence resides in
RAM
when the
program is loaded. Then make sure that your replacement string is the same
length as that of the original string. For example, you might write down the
information as follows:
Wile to be changed:
VDREAD
Start address:
X'5280'
Sequence of code to be changed:
X'CD2C25E5'
Replacement code:
X'OOOOOOC9'
Then you could use the following command:
PATCH
VDREAD A= 5280, F = CD2C25E5, C = 000000C9
Using PATCH on a data file (including BASIC programs)
If the file is stored with the "D" attribute, you specify the patch area in terms
of the logical record which contains the data, and the starting byte of the data
in that record. (The
TRSDOS LIST
command gives this information.)
For example, suppose in a file called
NAMEFILE
you need to change a 12-byte
sequence. When you
LIST
the file, you find that the sequence is located in
record 128, and that the sequence starts at byte 14. Write down the
information like this:
File to be changed:
NAMEFILE
Record number: 128
Starting byte: 14
Sequence of text to be changed:
"JOHN'S DINER"
Replacement text:
"JACK'S PLACE"
Then use the following command:
PATCH
NAMEFILE R = 128, B = 14, F = "JOHN'S DINER", C = "JACK'S PLACE"
Notice that either string can include a single-quote, as long as the string is
surrounded by double-quotes. If you wanted to include a double-quote inside
either string, you would have to enclose that string in single-quotes.
Note: The string you are changing must be wholly contained inside the
specified record. If it spans two records, you will have to perform the patch
operation twice, once for each record.
-------------------------
161

Advertisement

loading