Prev: BB59 Up: Map Next: BBD4
BB94: Load From Tape
Used by the routine at Action_Load.
Ask for a tape and read a previously saved game state back in.
Print "LOADING. Start tape.".
LoadTape BB94 LD HL,$BE57 HL=Messaging_LoadingStartTape.
BB97 CALL PrintStringAndNewline Call PrintStringAndNewline.
BB9A LD IX,$BBF0 Load the starting address into IX at Table_ItemLocations.
BB9E LD DE,$0144 Set the block length in DE to 0144 bytes.
BBA1 LD A,$FF Set A to FF which indicates this is a data block.
BBA3 SCF Set the carry flag to indicate this is loading.
BBA4 CALL $0556 Call LD_BYTES.
BBA7 JR C,LoadTape_Success Jump to LoadTape_Success if the load worked (carry flag set).
Print "Tape error.".
BBA9 LD HL,$BE6C HL=Messaging_TapeError.
BBAC CALL PrintStringAndNewline Call PrintStringAndNewline.
BBAF RET Return.
There is nothing to unpack when no configurable exits were saved.
LoadTape_Success BBB0 LD A,($BD32) Read the configurable-exit count into A.
BBB3 OR A Return if there are no configurable exits to unpack.
BBB4 RET Z
BBB5 LD B,A Copy the configurable-exit count into B.
BBB6 LD IX,($BD22) IX=*Pointer_ConfigurableExits.
BBBA LD DE,$BC99 DE=LoadSaveBuffer.
BBBD JR LoadTape_Write Jump to LoadTape_Write.
The next saved exit address.
LoadTape_WriteLoop BBBF INC IX Move IX on to the next exit address.
BBC1 INC IX
BBC3 INC DE Move DE on to the next packed exit byte.
LoadTape_Write BBC4 LD L,(IX+$00) Fetch the exit address from *IX into HL.
BBC7 LD H,(IX+$01)
BBCA LD A,(DE) Write that packed exit byte back into the game.
BBCB LD (HL),A
BBCC DJNZ LoadTape_WriteLoop Decrease the unpack counter and loop back to LoadTape_WriteLoop until every exit byte is restored.
BBCE LD E,$00 E=00.
BBD0 CALL Handler_DisplayRoomImage Call Handler_DisplayRoomImage.
BBD3 RET Return.
Prev: BB59 Up: Map Next: BBD4