| Routines

02416: THE 'SAVE' CONTROL ROUTINE

Used by the routine at SAVE_ETC. The operation of saving a program or a block of data is very straightforward.
Input
HL | Data block start address
IX | Header start address
SA_CONTRL | 02416 | PUSH HL | Save the 'pointer'.
| 02417 | LD A,253 | Ensure that channel 'K' is open.
| 02419 | CALL CHAN_OPEN
| 02422 | XOR A | Signal 'first message'.
| 02423 | LD DE,2465 | Print the message 'Start tape, then press any key.' (see CASSETTE).
| 02426 | CALL PO_MSG
| 02429 | SET 5,(IY+2) | Signal 'screen will require to be cleared' (set bit 5 of TV-FLAG).
| 02433 | CALL WAIT_KEY | Wait for a key to be pressed.
Upon receipt of a keystroke the 'header' is saved.
| 02436 | PUSH IX | Save the base address of the 'header' on the machine stack.
| 02438 | LD DE,17 | Seventeen bytes are to be saved.
| 02441 | XOR A | Signal 'it is a header'.
| 02442 | CALL SA_BYTES | Send the 'header', with a leading 'type' byte and a trailing 'parity' byte.
There follows a short delay before the program/data block is saved.
| 02445 | POP IX | Retrieve the pointer to the 'header'.
| 02447 | LD B,50 | The delay is for fifty interrupts, i.e. one second.
SA_1_SEC | 02449 | HALT
| 02450 | DJNZ SA_1_SEC
| 02452 | LD E,(IX+11) | Fetch the length of the data block that is to be saved.
| 02455 | LD D,(IX+12)
| 02458 | LD A,255 | Signal 'data block'.
| 02460 | POP IX | Fetch the 'start of block pointer' and save the block.
| 02462 | JP SA_BYTES