Purpose: Save memory to a device Call address: $FFD8 (hex) 65496 (decimal) Communication registers: A, X, Y Preparatory routines: SETLFS, SETNAM Error returns: 5, 8, 9, READST Stack requirements: None Registers affected: A, X, Y |
Description:
This routine saves a section of memory. Memory is saved from an indirect address on page 0 specified by the accumulator to the address stored in the X and Y registers. It is then sent to a logical file on an input/output device. The SETLFS and SETNAM routines must be used before calling this routine. However, a file name is not required to SAVE to device 1 (the DatassetteTM recorder). Any attempt to save to other devices without using a file name results in an error.
NOTE: Device 0 (the keyboard), device 2 (RS-232), and device 3 (the screen) cannot be SAVEd to. If the attempt is made, an error occurs, and the SAVE is stopped. |
How to Use:
EXAMPLE:
LDA #1 ;DEVICE=1:CASSETTE JSR SETLFS LDA #0 ;NO FILE NAME JSR SETNAM LDA PROG ;LOAD START ADDRESS OF SAVE STA TXTTAB ;(LOW BYTE) LDA PROG+1 STA TXTTAB+1 ;(HIGH BYTE) LDX VARTAB ;LOAD X WITH LOW BYTE OF END OF SAVE LDY VARTAB+1 ;LOAD Y WITH HIGH BYTE LDA #<TXTTAB ;LOAD ACCUMULATOR WITH PAGE 0 OFFSET JSR SAVE