home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 20
/
020.d81
/
t.datastater
< prev
next >
Wrap
Text File
|
2022-08-26
|
5KB
|
292 lines
DATASTATER
A Utility for the C-128
Written by: Louis F. Sander
Datastater is full-featured program
for converting machine language,
sprites, or other sections of memory,
to BASIC data statements. The program
takes advantage of several features of
the machine: the built-in machine-
language monitor, the escape sequences
used in screen editing, and the
hexidecimal-to-decimal conversion
function. For ease of typing and
improved understanding, the data
statements produced are in hexidecimal
notation.
Running Datastater is simple, and
the program even includes brief
instructions. However, you should be
familiar with using the MONITOR
command to call up your machine-
language monitor, and with using that
monitor's 'M' command to dump memory
to the screen.
Your first step is to decide what
area in memory you want to convert to
data statements. Get into the monitor
by typing MONITOR<RETURN>, then use
the "M" command to display the
desired memory range. Since
Datastater manipulates the screen
display, it will convert a maximum of
16 monitor lines at a time, which is
equivalent to 128 bytes of ML ($80
bytes in hex). If you need to convert
more, just break the project into
manageable parts.
When the desired memory range is
displayed on the screen, use the
monitor's "X" command to exit back
to BASIC. The memory dump display, of
course, will remain on the screen.
Using your cursor-down key, scroll
that display upward until its first
line is on the top line of the
screen.
Then move your cursor until it's on
the line just below the last monitor
line you want to convert to data, in
the leftmost screen position. It
doesn't matter if that line is blank
or not, as long as the cursor is at
the left margin.
To initiate a conversion, just type
the word RUN, plus a colon, and then
press RETURN. (The colon is there in
case the cursor is not on a blank
line). By the way, when you run
Datastater, it checks to see that a
monitor dump is actually on the top
screen line; if it isn't, you're
shown a series of instructions.
In a normal run, you'll be
prompted for a First Line#, and you
should respond with the number you
want to assign to your first data
line. If you respond by pressing
RETURN without entering a number,
Datastater will choose a line number
equal to the decimal value of the
ML's starting address, since that's
the most logical number to use.
After choosing a starting line
number, you'll be prompted for a line
number interval. If you enter
nothing and hit RETURN, the interval
defaults to eight, which retains the
correspondence between the line
number and the address of the first
data item in the line.
As soon as you choose an interval,
you'll see the monitor lines turn
into BASIC lines. After a short wait,
some other BASIC lines will appear
on the screen.
The first one is a loop that
computes the checksum of the bytes
you have converted. (A checksum is
simply the numerical total of all the
bytes.) If your data statements are
ever typed from a listing, the typist
will appreciate having this line,
since it can be used to eliminate
errors.
The next line is a FOR-NEXT loop
that will poke your ML into memory.
Datastater determines the start and
end of the loop, which saves effort
on your part, and reduces the chance
of error. Notice that while your ML
data is in hex, the loop is in
decimal. Smart people, these
computers.
Finally, there are two REM lines
showing the number of data items, the
checksum, and the memory range of the
ML, in decimal as well as hex. This
information can be useful to you
later, so Datastater gives it to you
now, in a form that easily preserved.
After all the lines have been
printed, Datastater terminates with
the cursor flashing in the "home"
position. Your BASIC lines have been
printed on the screen, but have not
yet been added to the program in
memory. You do that yourself, by
pressing the RETURN key over each
program line. If you don't want the
extra lines, use your cursor keys to
skip over them. When you're finished
with the RETURN key, your data lines,
plus the checksum, poker, and REM
lines, are in memory along with
Datastater. You can use the DELETE
command to get rid of Datastater
itself, which will leave you with
the lines from Datastater's output.
You can save them to disk or printer,
where they can readily be added to
the balance of your BASIC program.
------
This program is copyrighted by
Commodore Microcomputers magazine.
All rights to it are reserved.
LOADSTAR has relieved you from the
burden of keying in this program.
For more complete information about
this program, refer to the February
1986 issue of Commodore
Microcomputers.
>Files used: DATASTATER.128
--------< end of article >------------