[net.micro.trs-80] Loading screen images from disk

perl@rdin.UUCP (Robert Perlberg) (03/07/84)

<>

I have not used my Model III in years (how could anyone go back
to TRSDOS after being spoiled by UNIX?), but I though I remembered
a system call for executing a TRSDOS command from within a machine
language program.  I had seen people use the DUMP and LOAD facility
to load screens so I decided to try it and then report the details
here.  The experience made me realize why I stopped using TRASHDOS.
The saturation of bugs in that system is criminal.

Nevertheless (I love that word!), here is the procedure for saving
and loading a screen image (such as it is):

Copy the display map (3C00-3FFF) to another area of memory above
6000 (this is only necessary because the @!#?@! DUMP command
refuses to read below 6000 to protect Tandy's valuable software).
Then invoke the DUMP command as follows:

DUMP filename/CMD (START=aaaa,END=bbbb,TRA=dddd)

where aaaa is the start address of the region you copied to,
      bbbb is the end address "
and   dddd is the address of a RET instruction (more on that
                                                later)

Then, to restore the image, invoke the command file thus created:

filename

and move the data from the dump region back to 3C00.

When I say "invoke", I mean use the CMDDOS system call (X'429C').
According to the manual (page 89), this call will execute a TRSDOS command
and return to the caller.  I tried it with the LOAD command.
It didn't work!  The solution I opted for was to have the address
of a RET instruction stored in the TRA field of the DUMPed file.
That way, when the file is executed, it will jump to a RET instruction
which will return to your program.  Your best bet would be to
find a RET instruction (X'C9') in ROM to improve reliability.

You can avoid the copy back to 3C00 by including the parameter
RELO=3C00 in the dump command, but the image will appear slowly.
I believe the Z80 has a single instruction for copying arbitrarily
large sections of memory.  I didn't try invoking the DUMP command
from a program.  If CMDDOS doesn't return from a DUMP, this wouldn't
be so bad since the creation of images is a one time job.  If
you need to load the file into a different region than you saved
it from, you can use the RELO= parameter at DUMP time, or use
the RELO command anytime after the fact.

Good luck.

Robert (God, I'm glad I don't have to use TRSDOS anymore) Perlberg
Resource Dynamics Inc.
New York
philabs!rdin!rdin2!perl