Entity: Difference between revisions
Piranhaplant (talk | contribs) Created page with "Entities are used to run multiple distinct things at the same time through a cooperative multitasking system. Almost all code in the game is run as part of an entity. Monsters, the players, weapon projectiles, and even the main game loop are separate entities. == Overview == Each entity is allocated the following: * 0x80 bytes in RAM. The direct page will be set to this area, so it can be accessed with $00-$7F. * 0x30 bytes of stack. An entity is created by calling ..." |
(No difference)
|
Revision as of 19:43, 7 December 2023
Entities are used to run multiple distinct things at the same time through a cooperative multitasking system. Almost all code in the game is run as part of an entity. Monsters, the players, weapon projectiles, and even the main game loop are separate entities.
Overview
Each entity is allocated the following:
- 0x80 bytes in RAM. The direct page will be set to this area, so it can be accessed with $00-$7F.
- 0x30 bytes of stack.
An entity is created by calling $80:825E and providing a pointer to the start of the entity code in the Y register and accumulator. Upon creation, 10 bytes ($00-$09) are copied from the current direct page to the direct page of the new entity. This can be used to provide various parameters to the entity.
$80:8353 is called to yield control to other entities. The accumulator contains the number of frames before this entity is resumed. Control resumes immediately following the call to $80:8353.