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_2 if there are no saved state bytes.
9E89 JR Z,SaveGame_2
9E8B LD B,A B=A.
9E8C LD IX,$BAF9 IX=Table_SavedStateAddresses.
9E90 LD DE,$A0D4 DE=SavedStateBytes.
9E93 JR SaveGame_1 Jump to SaveGame_1.
SaveGame_0 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_1 9E9A LD L,(IX+$00) L=*IX+00.
9E9D LD H,(IX+$01) H=*IX+01.
9EA0 LD A,(HL) A=*HL.
9EA1 LD (DE),A Store that state byte in the packed save buffer.
9EA2 DJNZ SaveGame_0 Decrease the pack counter and loop back to SaveGame_0 until every state byte is packed.
Print "Press REC & PLAY on tape... Then press any key.".
SaveGame_2 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 DE=0181.
9EB4 LD A,$FF A=FF.
9EB6 CALL $04C2 Call SA_BYTES.
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