********************************************************* * CSAVEM * Save binary data in memory to tape as a machine * language program. * * This program is relocatable, except that it assumes * its data buffer to start at $4000, and its end-buffer * pointer to be at $3100 and $3101, as per COMM4. Note * that this end-buffer pointer points one byte past the * last byte to be saved; it does not point at the last * byte itself. * * By default (entry point=$3000), the data to save is * found at address $4000; it is saved with that as the * load address so it will load back into the same place; * and that same address is used as its starting execution * address. The last byte saved is determined by the * end-buffer pointer as described above. * * The alternative (entry point=$3002) is that each of * these addresses is specified individually. The * address of the data to save is found at address $3102, * the address that it should load into later is at $3104, * and the address at which to start execution is at * $3106. The last byte saved is determined by the * end-buffer pointer as described above. * * Because the program does not map out the BASIC ROMs to * get at the RAM underneath, it is normally limited to * binaries of up to 16K ($4000 - $7FFF). Almost 20K * could be saved by calling the alternate entry point * with a starting data address of, say, $3110, and an * ending address of $7FFF. * * Finally, there is a special entry point at 'instal' * which will use this program to save itself in such a * way that it will later load and run at address $3000. * That instal routine omits itself in the saved data, * so it can only be used once, when it is still sitting * in memory from when the program was downloaded. * * 5-Sep-99 815pm WJY - initial vertion from CSAVEB 0.05 * 7-Sep-99 250am WJY - fix ACTIND, * bypass as09 optimization lbra bug * 12-Sep-99 140am WJY - drop block copy, block count, * mapping-in of upper 32K RAM, * activity indicator * 16-Sep-99 315pm WJY - fixed some non-relocatable code ********************************************************** noopt include "coco.asm" * COMM4 leftover data buffer equ $4000 ; buffer of ASCII data last equ $3100 ; last address filled + 1 * Data needed with the special entry point ($3002). * These are considered as external to the program, * so references to them should not be relative. spdata equ $3102 ; address of the data to save spload equ $3104 ; load address spexec equ $3106 ; exec address org $3000 start bra normal start2 bra specl fcb $99,$09,$16,$15,$15 ; revision date & time fcc "CSAVEM V0.4" normal ldx #buffer ; default addresses == buffer stx spdata stx spload stx spexec specl orcc #IRQ|FIRQ ; disable interrupts * write the name block ldx spload ; fill in data stx