Prev: 6E9C Up: Map Next: 6EBC
6EAB: Add object entry to a set
Finds an empty slot or end-of-set marker in the object set and writes a 3-byte entry (C, B, D). Each entry represents an object with X position, Y offset, and type.
  • Searches forward through set, 3 bytes per entry
  • Skips non-empty entries until finding SET_MARKER_EMPTY_SLOT or SET_MARKER_END_OF_SET
Input
B Y offset (usually 0 for new objects)
C X position
D Object type/definition
HL Pointer to start of object set
add_object_to_set 6EAB LD A,(HL) Load current entry's first byte. If empty slot, jump to write.
6EAC CP $00
6EAE JP Z,write_object_to_set
6EB1 CP $FF If end-of-set marker, jump to write (will extend set).
6EB3 JP Z,write_object_to_set
6EB6 INC HL Entry occupied: advance HL by 3 bytes and loop.
6EB7 INC HL
6EB8 INC HL
6EB9 JP add_object_to_set
Prev: 6E9C Up: Map Next: 6EBC