Prev: 40547 Up: Map Next: 40645
40576: Save Game
Used by the routines at Action_SaveGame and Action_OfferSave.
SaveGame 40576 PUSH IX Stash IX, HL, DE and BC on the stack.
40578 PUSH HL
40579 PUSH DE
40580 PUSH BC
40581 LD A,(48081) A=*Count_SavedStateBytes.
Skip packing the save when there are no state bytes.
40584 OR A Jump to SaveGame_2 if there are no saved state bytes.
40585 JR Z,SaveGame_2
40587 LD B,A B=A.
40588 LD IX,47865 IX=Table_SavedStateAddresses.
40592 LD DE,41172 DE=SavedStateBytes.
40595 JR SaveGame_1 Jump to SaveGame_1.
SaveGame_0 40597 INC IX Move IX on to the next saved-state address.
40599 INC IX
40601 INC DE Move DE on to the next packed state byte.
SaveGame_1 40602 LD L,(IX+0) L=*IX+0.
40605 LD H,(IX+1) H=*IX+1.
40608 LD A,(HL) A=*HL.
40609 LD (DE),A Store that state byte in the packed save buffer.
40610 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 40612 LD HL,40499 HL=Messaging_Saving.
40615 CALL PrintStringAndNewline Call PrintStringAndNewline.
40618 CALL GetUserInput Call GetUserInput.
40621 LD IX,40840 IX=Table_ItemLocations.
40625 LD DE,385 DE=385.
40628 LD A,255 A=255.
40630 CALL 1218 Call SA_BYTES.
40633 LD HL,40547 HL=Messaging_StopTapeSavingComplete.
40636 CALL PrintStringAndNewline Call PrintStringAndNewline.
40639 POP BC Restore BC, DE, HL and IX from the stack.
40640 POP DE
40641 POP HL
40642 POP IX
40644 RET Return.
Prev: 40547 Up: Map Next: 40645