Prev: ECFB Up: Map Next: ED71
ED10: Save Or Load High Scores
Used by the routines at Display_High_Score_Entry_Screen and Attract_Mode_Loop.
Checks whether J (save) or L (load) is held on keyboard row BF. On J, saves the 012D-byte score table from Messaging_HighScoreName to tape. On L, loads from tape into the buffer at Entity_List_Base; a successful load copies the buffer to the live score data and restarts the display. A failed load shows a tape error message — or a wrong-game warning if a Moon Patrol score table was detected — then waits for a keypress before returning.
Save_Or_Load_High_Scores ED10 LD A,$BF Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
ED12 IN A,($FE)
ED14 CPL
ED15 AND %00001010 Isolate the L (bit 1) and J (bit 3) keys.
ED17 RET Z Return if neither tape key is pressed.
ED18 LD DE,$012D Set the score table byte count to 012D.
ED1B BIT 1,A Test whether the L key is held for a tape load.
ED1D LD A,$6B Set the tape data type identifier to 6B and jump to Load_High_Score_Table if the L key is held.
ED1F JR NZ,Load_High_Score_Table
J key path: save the score table to tape.
ED21 LD IX,$F1AB Point IX to the score table at Messaging_HighScoreName for the tape save.
ED25 CALL $04C2 Save 012D bytes to tape via SA_BYTES (04C2).
ED28 DI Disable interrupts and return.
ED29 RET
L key path: load a score table from tape into the buffer at Entity_List_Base.
Load_High_Score_Table ED2A SCF Set the carry flag to signal a data block load to LD_BYTES.
ED2B LD IX,$6100 Point IX to the score reception buffer at Entity_List_Base.
ED2F CALL $0556 Load 012D bytes from tape via LD_BYTES (0556).
ED32 POP DE Restore DE from the stack.
ED33 DI Disable interrupts.
ED34 JR C,Install_Loaded_Score_Table Jump to Install_Loaded_Score_Table if the tape load succeeded.
Load failed: select the appropriate error message.
ED36 LD A,L Read the tape data type marker returned by the load.
ED37 LD HL,$EFBC Point HL to the tape error message at Messaging_TapeError.
ED3A CP $6C Jump to Show_Tape_Message if the marker is not the Moon Patrol identifier 6C.
ED3C JR NZ,Show_Tape_Message
ED3E LD HL,$EFDD Select the wrong-game warning at Messaging_HighScoreError.
Show_Tape_Message ED41 PUSH HL Stash the message pointer on the stack.
ED42 XOR A Clear A to prepare for display reinitialisation.
ED43 CALL Initialise_Display_And_Border Reinitialise the display via Initialise_Display_And_Border.
ED46 CALL Draw_Colour_Border Call Draw_Colour_Border.
ED49 CALL Cycle_Border_Colour Call Cycle_Border_Colour.
ED4C POP HL Restore the message pointer from the stack.
ED4D CALL PrintMessaging Print the tape status message via PrintMessaging.
Tape_Message_Loop ED50 LD C,$64 Set the frame delay count to 64.
ED52 CALL Display_Loop_Delay Call Display_Loop_Delay.
ED55 CALL Scan_And_Cycle_Screen_Attributes Call Scan_And_Cycle_Screen_Attributes.
ED58 CALL Cycle_Border_Colour Call Cycle_Border_Colour.
ED5B CALL CheckBreakKey Check the BREAK key via CheckBreakKey.
ED5E CALL Check_Any_Key_During_Display Abort if any key is pressed via Check_Any_Key_During_Display.
ED61 JR Tape_Message_Loop Loop back to Tape_Message_Loop.
Load succeeded: copy the freshly loaded data from the tape reception buffer into the live score table.
Install_Loaded_Score_Table ED63 LD HL,$6100 Set up the score table copy: source Entity_List_Base, destination Messaging_HighScoreName, length 012D bytes.
ED66 LD DE,$F1AB
ED69 LD BC,$012D
ED6C LDIR Copy the loaded score table into the live high score data.
ED6E JP High_Score_Display Jump to High_Score_Display to restart the high score display.
Prev: ECFB Up: Map Next: ED71