Prev: 60667 Up: Map Next: 60785
60688: 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 191. On J, saves the 301-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 60688 LD A,191 Read from the keyboard;
Port Number Bit
0 1 2 3 4
191 ENTER L K J H
60690 IN A,(254)
60692 CPL
60693 AND %00001010 Isolate the L (bit 1) and J (bit 3) keys.
60695 RET Z Return if neither tape key is pressed.
60696 LD DE,301 Set the score table byte count to 301.
60699 BIT 1,A Test whether the L key is held for a tape load.
60701 LD A,107 Set the tape data type identifier to 107 and jump to Load_High_Score_Table if the L key is held.
60703 JR NZ,Load_High_Score_Table
J key path: save the score table to tape.
60705 LD IX,61867 Point IX to the score table at Messaging_HighScoreName for the tape save.
60709 CALL 1218 Save 301 bytes to tape via SA_BYTES (1218).
60712 DI Disable interrupts and return.
60713 RET
L key path: load a score table from tape into the buffer at Entity_List_Base.
Load_High_Score_Table 60714 SCF Set the carry flag to signal a data block load to LD_BYTES.
60715 LD IX,24832 Point IX to the score reception buffer at Entity_List_Base.
60719 CALL 1366 Load 301 bytes from tape via LD_BYTES (1366).
60722 POP DE Restore DE from the stack.
60723 DI Disable interrupts.
60724 JR C,Install_Loaded_Score_Table Jump to Install_Loaded_Score_Table if the tape load succeeded.
Load failed: select the appropriate error message.
60726 LD A,L Read the tape data type marker returned by the load.
60727 LD HL,61372 Point HL to the tape error message at Messaging_TapeError.
60730 CP 108 Jump to Show_Tape_Message if the marker is not the Moon Patrol identifier 108.
60732 JR NZ,Show_Tape_Message
60734 LD HL,61405 Select the wrong-game warning at Messaging_HighScoreError.
Show_Tape_Message 60737 PUSH HL Stash the message pointer on the stack.
60738 XOR A Clear A to prepare for display reinitialisation.
60739 CALL Initialise_Display_And_Border Reinitialise the display via Initialise_Display_And_Border.
60742 CALL Draw_Colour_Border Call Draw_Colour_Border.
60745 CALL Cycle_Border_Colour Call Cycle_Border_Colour.
60748 POP HL Restore the message pointer from the stack.
60749 CALL PrintMessaging Print the tape status message via PrintMessaging.
Tape_Message_Loop 60752 LD C,100 Set the frame delay count to 100.
60754 CALL Display_Loop_Delay Call Display_Loop_Delay.
60757 CALL Scan_And_Cycle_Screen_Attributes Call Scan_And_Cycle_Screen_Attributes.
60760 CALL Cycle_Border_Colour Call Cycle_Border_Colour.
60763 CALL CheckBreakKey Check the BREAK key via CheckBreakKey.
60766 CALL Check_Any_Key_During_Display Abort if any key is pressed via Check_Any_Key_During_Display.
60769 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 60771 LD HL,24832 Set up the score table copy: source Entity_List_Base, destination Messaging_HighScoreName, length 301 bytes.
60774 LD DE,61867
60777 LD BC,301
60780 LDIR Copy the loaded score table into the live high score data.
60782 JP High_Score_Display Jump to High_Score_Display to restart the high score display.
Prev: 60667 Up: Map Next: 60785