CSAVEM Preliminary man page


Saves binary data in memory to tape as a machine language program. Works nicely to save a program downloaded by COMM4 with minimum hassle.

Loads into addresses $3000 through $308F 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 COMM4 when it finishes. The load and execution addresses are also saved as $4000, so the machine-language program will load back into the same place that it was saved from. If you did not use COMM4, you will have to plug the ending address (plus one) into those memory locations before calling CSAVEM. If you used COMM5S19, you can copy that value from locations $3402 and $3403.

Called at its alternate entry point, $3002, CSAVEM lets you save any region of memory as a machine language program, and specify any values you like for the load and execution addresses; they do not have to be $4000. The starting address is read from locations $3102 and $3103, the load address from $3104 and $3105, and the execution address from $3106 and $3107. The ending address is at $3100 and $3101, just as with the standard entry point.

The alternate entry point is useful because COMM4 and COMM5S19 alway save incoming data starting at address $4000, even if it is a machine language program that should load into some other address.

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.)

CSAVEM does not map out the BASIC ROMs when reading the data to write onto tape, so it is effectively limited to saving programs up to 16K in size. (Machine language programs need to be saved without gaps between blocks, so it does not have time to map out the ROMs and copy data from the RAM under them, the way CSAVEB does.)

There is also one very special entry point at $3090 that uses CSAVEM to save itself with load and execution addresses of $3000. When it saves itself this way, it omits this special installation routine; having done its job, it is no longer needed. The reason for this special installation routine is that CSAVEM was written to run at address $3000, but COMM4 will download it to address $4000. So just after being downloaded, all of its entry points are off by $1000; the normal entry point which should be at $3000 is now at $4000 and this special one is at $4090. Although it can work at these addresses, it normally expects its data buffer to be at $4000, so it is more convenient for CSAVEM to be someplace else. So if it is downloaded with COMM4, it can then be saved to tape by calling "EXEC &H4090".


Back to my Color Computer web page
(remove all "x"s to get a valid address)