Prev: AF7F Up: Map Next: AFD9
AFA9: Backup Entity And Game State
Used by the routine at Initialise_New_Game.
Backup entity and game state walking the entity tables at StateData_SimpleEntities / StateData_Boney.
Measure and copy Boney's complex entity state into the backup buffer at Buffer_EntityStateBackup.
Backup_Entity_And_Game_State AFA9 LD HL,$90B7 Point HL at State Data: Scenery Entities (StateData_SceneryEntities).
AFAC LD DE,$8EE9 Point DE at Boney's complex entity state (StateData_Boney).
AFAF AND A Clear the success marker and test whether A is zero.
AFB0 SBC HL,DE Subtract DE from HL with carry.
AFB2 LD ($72A3),HL Store HL in the entity-state copy length (CopyLength_EntityStateData).
AFB5 LD B,H Copy the high byte of the pointer into B.
AFB6 LD C,L Copy the low byte of the pointer into C.
AFB7 LD HL,$8EE9 Point HL at Boney's complex entity state (StateData_Boney).
AFBA LD DE,$FA0E Point DE at the entity-state backup buffer (Buffer_EntityStateBackup).
AFBD LDIR Copy the block at HL to DE.
AFBF INC DE Advance the pointer in DE by one.
AFC0 LD ($72A7),DE Store DE in Pointer: Entity State Backup End (Pointer_EntityStateBackupEnd).
AFC4 PUSH DE Stash DE on the stack.
Measure and copy the task/game-status block that follows the entity backup.
AFC5 LD HL,$72E8 Point HL at saved room index (SavedRoomIndex).
AFC8 LD DE,$72AE Point DE at the current task index (CurrentTaskIndex).
AFCB SBC HL,DE Subtract DE from HL with carry.
AFCD LD ($72A5),HL Store HL in the game-state copy length (CopyLength_GameState).
AFD0 LD B,H Copy the high byte of the pointer into B.
AFD1 LD C,L Copy the low byte of the pointer into C.
AFD2 LD HL,$72AE Point HL at the current task index (CurrentTaskIndex).
AFD5 POP DE Restore DE from the stack.
AFD6 LDIR Copy the block at HL to DE.
AFD8 RET Return.
Prev: AF7F Up: Map Next: AFD9