Prev: CF43 Up: Map Next: CFB6
CF80: Allocate Memory And Store Character
Used by the routines at ProcessObjectDisplayEntry and E17B.
Creates a new character entry in the character tracking system and adds it to the active character list, storing the character's current state for game logic purposes.
Input
HL Character location co-ordinates
B Character attribute value
AllocateMemoryAndStoreCharacter CF80 PUSH IX Stash the pointer register on the stack.
CF82 LD A,$07 Allocate 07 bytes of memory for the character entry.
CF84 CALL AllocateMemory Call AllocateMemory.
CF87 LD A,($A036) Store *CurrentCharacter_ID in the entry.
CF8A LD (IX+$00),A
CF8D LD (IX+$01),L Store the character's location co-ordinates in the entry.
CF90 LD (IX+$02),H
CF93 LD DE,($A034) Store *RoomDisplayParameter in the entry.
CF97 LD (IX+$03),E
CF9A LD (IX+$04),D
AllocateMemoryAndStoreCharacter_StoreAttribute CF9D LD (IX+$05),B Store the character's attribute value in the entry.
CFA0 LD A,($9FD6) Store *CurrentRoom_ID in the entry.
CFA3 LD (IX+$06),A
CFA6 LD HL,($9FE9) Get the current head of *CharacterListPointer.
CFA9 LD ($9FE9),IX Add this character entry to the front of the active character list.
CFAD LD (IX-$02),L Set up the backward link to maintain the list structure.
CFB0 LD (IX-$01),H
CFB3 POP IX Restore the pointer register from the stack.
CFB5 RET Return.
Prev: CF43 Up: Map Next: CFB6