SAVE

Save memory to a device
Function AddressVectorDescription
SAVE FFD80332Save memory to a device

This routine saves a section of memory to a device.

To use, you first need to call SETLFS to set the device to save to. Then SETNAM must be called to set the filename.

Finally you store the start address in 2 bytes of zero page memory, set X & Y to point to the address immediately after the data to save, and A to the offset within zeropage where the start address was stored.

Any errors are reported via the READST routine.

You cannot save to devices 0 (keyboard), 2 (RS-232) or 3 (Screen).
Example:
saveFileLDA#1Select device 1 = Cassette
LDA#0Set no file name, valid for cassette only
LDA#<startAddressStart address low byte
STAFREEKZPStore in Zero Page.
LDA#>startAddressStart address high byte
STAFREEKZP+1
LDX#<endAddressEnd address low byte
LDY#>endAddressEnd address high byte
LDA#<FREEKZPZero page offset to FREEKZP
JMPSAVESave the file

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.