Prev: AC6D Up: Map Next: ACEA
ACA8: Load From Tape
Used by the routine at Action_Load.
Read a save block back from tape into the configurable exits.
LoadTape ACA8 LD HL,$B01F Print "LOADING. Start tape." and start a new line.
ACAB CALL PrintStringAndNewline
ACAE LD IX,$AD76 Load the starting address into IX at the item-location table.
ACB2 LD DE,$0186 Set the block length in DE to 0186 bytes.
ACB5 LD A,$FF Set A to FF which indicates this is a data block.
ACB7 SCF Set the carry flag to indicate this is loading.
ACB8 CALL $0556 Call LD_BYTES.
ACBB JR C,LoadTape_Success Branch to LoadTape_Success if the block loaded without error (carry flag set).
ACBD LD HL,$B034 Print "Tape error. Press any key to restart." and start a new line.
ACC0 CALL PrintStringAndNewline
ACC3 SCF Set the carry flag to report that the load failed, so Action_Load restarts the game.
ACC4 RET Return.
There is nothing to unpack when no configurable exits were saved.
LoadTape_Success ACC5 LD A,($AEFA) Read the configurable-exit count into A.
ACC8 OR A Return if there are no configurable exits to unpack.
ACC9 RET Z
B counts the exits, IX walks their addresses and DE the save buffer.
ACCA LD B,A Take the exit count and point at the exit table and the save buffer.
ACCB LD IX,($AEE6)
ACCF LD DE,$AE9B
ACD2 JR LoadTape_Write Restore the first configurable exit.
The next saved exit address.
LoadTape_Restore ACD4 INC IX Move IX on to the next exit address and DE on to the next packed exit byte.
ACD6 INC IX
ACD8 INC DE
LoadTape_Write ACD9 LD L,(IX+$00) Fetch the exit address from *IX into HL, write that packed exit byte back into the game, and repeat until every exit byte is restored.
ACDC LD H,(IX+$01)
ACDF LD A,(DE)
ACE0 LD (HL),A
ACE1 DJNZ LoadTape_Restore
ACE3 LD E,$00 Show the room picture only when it has not already been seen.
ACE5 CALL HandlerDisplayRoomImage
ACE8 AND A Clear the carry flag to report that the load worked, so Action_Load goes back to the game.
ACE9 RET Return.
Prev: AC6D Up: Map Next: ACEA