Z80 Assembly 33: Managing Multiple Sprites with a Linked List

The Need for a Dynamic List When creating a game, you don’t want to waste time checking 50 memory locations if only 5 sprites are currently active. A Linked List is the most efficient data structure in Z80 assembly for managing a variable number of objects. The Linked List Principle: Each sprite’s data block (the node) contains a pointer to the next sprite in the sequence. When the CPU finishes processing the current sprite, it simply follows the pointer to the next one. The list ends when a pointer value is zero or another terminator. ...

September 27, 2025

Z80 Assembly 31: Sprite Data Structure and Rendering Logic

Defining a Sprite Data Structure A sprite is a graphic object that moves independently on the screen. We need a memory structure to hold all its properties in one place. This structure is often called a Control Block or a Sprite Descriptor. Example Sprite Descriptor (10 Bytes): Offset Size (Bytes) Purpose +0 2 X-Coordinate (16-bit) +2 2 Y-Coordinate (16-bit) +4 2 Sprite Graphic Address (Pointer to the pixel data) +6 1 Frame Number (If sprite is animated) +7 1 Status (Bitwise flags: Active, Firing, Hit) +8 2 Pointer to Next Sprite (For a linked list) Reading Sprite Properties We use the Index Registers ($IX$ or $IY$) for fast, organized access to these properties. ...

September 27, 2025