Prev: 9E63 Up: Map Next: 9EC5
9E80: Save Game
Used by the routines at Action_SaveGame and Action_OfferSave.
SaveGame 9E80 PUSH IX Stash IX, HL, DE and BC on the stack.
9E82 PUSH HL
9E83 PUSH DE
9E84 PUSH BC
9E85 LD A,($BBD1) A=*Count_SavedStateBytes.
Skip packing the save when there are no state bytes.
9E88 OR A Jump to SaveGame_PrintSaving if there are no saved state bytes.
9E89 JR Z,SaveGame_PrintSaving
9E8B LD B,A Set B to the number of state bytes to pack.
9E8C LD IX,$BAF9 IX=Table_SavedStateAddresses.
9E90 LD DE,$A0D4 DE=SavedStateBytes.
9E93 JR SaveGame_StoreFlag Jump to SaveGame_StoreFlag.
The next saved address.
SaveGame_Copy 9E95 INC IX Move IX on to the next saved-state address.
9E97 INC IX
9E99 INC DE Move DE on to the next packed state byte.
SaveGame_StoreFlag 9E9A LD L,(IX+$00) Fetch the state address from *IX into HL.
9E9D LD H,(IX+$01)
9EA0 LD A,(HL) Copy the state byte into the packed save buffer.
9EA1 LD (DE),A
9EA2 DJNZ SaveGame_Copy Decrease the pack counter and loop back to SaveGame_Copy until every state byte is packed.
Print "Press REC & PLAY on tape... Then press any key.".
SaveGame_PrintSaving 9EA4 LD HL,$9E33 HL=Messaging_Saving.
9EA7 CALL PrintStringAndNewline Call PrintStringAndNewline.
9EAA CALL GetUserInput Call GetUserInput.
9EAD LD IX,$9F88 IX=Table_ItemLocations.
9EB1 LD DE,$0181 Set the block length in DE to 0181 bytes.
9EB4 LD A,$FF Set A to FF which indicates this is a data block.
9EB6 CALL $04C2 Call SA_BYTES.
Print "Saving Complete...Stop Tape.".
9EB9 LD HL,$9E63 HL=Messaging_StopTapeSavingComplete.
9EBC CALL PrintStringAndNewline Call PrintStringAndNewline.
9EBF POP BC Restore BC, DE, HL and IX from the stack.
9EC0 POP DE
9EC1 POP HL
9EC2 POP IX
9EC4 RET Return.
Prev: 9E63 Up: Map Next: 9EC5