Prev: BB55 Up: Map Next: BB94
BB59: Save Game
Used by the routines at Action_Save and Action_Quit.
Ask for a tape and write the game state out.
SaveGame BB59 LD A,($BD32) Read the configurable-exit count into A.
BB5C OR A Jump to SaveGame_PrintSaving if there are no configurable exits to pack.
BB5D JR Z,SaveGame_PrintSaving
BB5F LD B,A Copy the configurable-exit count into B.
BB60 LD IX,($BD22) IX=*BD22.
BB64 LD DE,$BC99 DE=LoadSaveBuffer.
BB67 JR SaveGame_StoreFlag Jump to SaveGame_StoreFlag.
Move on to the next configurable-exit address.
SaveGame_Copy BB69 INC IX Move IX on to the next exit address.
BB6B INC IX
BB6D INC DE Move DE on to the next packed exit byte.
SaveGame_StoreFlag BB6E LD L,(IX+$00) Fetch the exit address from *IX into HL.
BB71 LD H,(IX+$01)
BB74 LD A,(HL) Copy the exit byte into the packed save buffer.
BB75 LD (DE),A
BB76 DJNZ SaveGame_Copy Decrease the pack counter and loop back to SaveGame_Copy until every exit byte is packed.
Print "SAVING. Start tape,press any key.".
SaveGame_PrintSaving BB78 LD HL,$BE78 HL=Messaging_SavingStartTape.
BB7B CALL PrintStringAndNewline Call PrintStringAndNewline.
BB7E CALL GetUserInput Call GetUserInput.
BB81 LD IX,$BBF0 Load the starting address into IX at Table_ItemLocations.
BB85 LD DE,$0144 Set the block length in DE to 0144 bytes.
BB88 LD A,$FF Set A to FF which indicates this is a data block.
BB8A CALL $04C2 Call SA_BYTES.
Print "Stop tape.Saving complete.".
BB8D LD HL,$BE9A HL=Messaging_StopTape.
BB90 CALL PrintStringAndNewline Call PrintStringAndNewline.
BB93 RET Return.
Prev: BB55 Up: Map Next: BB94