Prev: 9EC5 Up: Map Next: 9F27
9EDB: Load From Tape
Used by the routine at Action_LoadGame.
LoadTape 9EDB PUSH IX Stash IX, HL, DE and BC on the stack.
9EDD PUSH HL
9EDE PUSH DE
9EDF PUSH BC
Print "LOADING...Start Tape.".
9EE0 LD HL,$9EC5 HL=Messaging_LoadingPressPlay.
9EE3 CALL PrintStringAndNewline Call PrintStringAndNewline.
9EE6 LD IX,$9F88 Load the starting address into IX at Table_ItemLocations.
9EEA LD DE,$0181 Set the block length in DE to 0181 bytes.
9EED LD A,$FF Set A to FF which indicates this is a data block.
9EEF SCF Set the carry flag to indicate this is loading.
9EF0 CALL $0556 Call LD_BYTES.
9EF3 JR C,LoadTape_Success Jump to LoadTape_Success if the block loaded without error (carry flag set).
Print "Status file not found.".
9EF5 LD HL,$0013 HL=Messaging_StatusFileNotFound.
The tape load failed.
9EF8 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
9EFB JR LoadTape_Return Jump to LoadTape_Return.
There is nothing to unpack when no state bytes were saved.
LoadTape_Success 9EFD LD A,($BBD1) Jump to LoadTape_Return if there are no saved state bytes.
9F00 OR A
9F01 JR Z,LoadTape_Return
Write the packed bytes at SavedStateBytes back through the addresses in Table_SavedStateAddresses.
9F03 LD B,A The addresses are listed in Table_SavedStateAddresses and the copies sit at SavedStateBytes.
9F04 LD IX,$BAF9
9F08 LD DE,$A0D4
9F0B JR RestoreState_Write Start with the first address.
The next saved address.
RestoreState_Loop 9F0D INC IX Advance to the next saved address.
9F0F INC IX
9F11 INC DE
RestoreState_Write 9F12 LD L,(IX+$00) Write that byte back into the game.
9F15 LD H,(IX+$01)
9F18 LD A,(DE)
9F19 LD (HL),A
9F1A DJNZ RestoreState_Loop Repeat until every saved byte is restored.
Describe the room the save returned to.
9F1C LD E,$00 Show the room as the player last saw it.
9F1E CALL Handler_RoomExits Call Handler_RoomExits.
Restore the caller's registers and return.
LoadTape_Return 9F21 POP BC Restore BC, DE, HL and IX from the stack.
9F22 POP DE
9F23 POP HL
9F24 POP IX
9F26 RET Return.
Prev: 9EC5 Up: Map Next: 9F27