| Routines

053F: THE 'SA/LD-RET' SUBROUTINE

Used by the routines at SA_BYTES and LD_BYTES. This subroutine is common to both saving and loading. The border is set to its original colour and the BREAK key tested for a last time.
Input
F | Carry flag reset if there was a loading error
SA_LD_RET | 053F | PUSH AF | Save the carry flag. (It is reset after a loading error.)
| 0540 | LD A,($5C48) | Fetch the original border colour from its system variable (BORDCR).
| 0543 | AND $38
| 0545 | RRCA | Move the border colour to bits 2, 1 and 0.
| 0546 | RRCA
| 0547 | RRCA
| 0548 | OUT ($FE),A | Set the border to its original colour.
| 054A | LD A,$7F | Read the BREAK key for a last time.
| 054C | IN A,($FE)
| 054E | RRA
| 054F | EI | Enable the maskable interrupt.
| 0550 | JR C,SA_LD_END | Jump unless a break is to be made.
Report D - BREAK-CONT repeats.
| 0552 | RST $08 | Call the error handling routine.
| 0553 | DEFB $0C
Continue here.
SA_LD_END | 0554 | POP AF | Retrieve the carry flag.
| 0555 | RET | Return to the calling routine.