Saves ASCII text in memory to tape as a BASIC program. Works nicely to save a program downloaded by COMM4 with minimum hassle.
Loads into addresses $3000 through $30E7 inclusive, starts execution at address $3000 or $3002.
Called at the standard entry point, $3000, this program
saves the contents of memory starting at address $4000.
The ending address is one less than the two-byte value
at addresses $3100 and $3101.
This ending address is left in memory by
when it finishes.
If you did not use
COMM4, you will have to plug
the ending address (plus one) into those memory locations
Called at its alternate entry point, $3002,
lets you save any region of memory as a BASIC program;
it does not have to start at $4000.
The starting address is read from locations $3102 and $3103,
and the ending address is at $3100 and $3101
(the same as with the standard entry point).
This program is relocatable. The buffer pointers and the default buffer location are considered to be external to the program, so even after relocating it, it will still use the same addresses for those things. (So you don't want the program to cover any of those.)
CSAVEB maps out the BASIC ROMs when reading the
data to write onto tape, easily allowing for programs up to
almost 48K in size.