Prev: C03B Up: Map Next: C089
C040: Save Game
Used by the routine at SaveGameState.
Stores the current game so it can be restored later.
SaveGame C040 LD HL,$09A2 Print the message at 09A2 and wait for a key.
C043 CALL PrintStringAndWaitForKeypress
C046 LD ($C109),DE Record the tape header: saved game.
C04A LD ($C10B),IX
C04E LD IX,$C0FE Use the tape header: saved game (C0FE).
C052 LD DE,$0011
C055 XOR A Set A to 00 to indicate this is a header block.
C056 CALL $04C2 Call SA_BYTES.
C059 LD B,$32 Count 32.
SaveGame_PauseLoop C05B HALT Wait for 32 frames (one second) between the header and the data block.
C05C DJNZ SaveGame_PauseLoop
C05E DI Read the tape header: saved game.
C05F LD DE,($C109)
C063 LD IX,($C10B) Read the tape header: saved game.
C067 LD A,$FF Set A to FF to indicate this is a data block.
C069 CALL $04C2 Call SA_BYTES.
C06C DI Turn interrupts off again, as SA_BYTES leaves them on.
C06D LD HL,$C0A5 Take the messaging: rewind tape, then call PrintString to print string.
C070 CALL PrintString
C073 LD HL,$09AC Print the message at 09AC and wait for a key.
C076 CALL PrintStringAndWaitForKeypress
C079 LD IX,$C0FE Use the tape header: saved game (C0FE).
C07D LD DE,$0011
C080 LD A,$00 Set A to 00 to indicate this is a header block.
C082 AND A Clear the carry so the ROM verifies this block.
C083 CALL $0556 Call LD_BYTES.
C086 JR NC,LoadGameData_Error Jump to LoadGameData_Error if the header did not load.
C088 AND A Clear the carry before the next tape block.
Prev: C03B Up: Map Next: C089