Sinclair ZX Spectrum Screen Memory Organization Explained
The Sinclair ZX Spectrum utilized a unique and somewhat complex method for organizing screen memory to maximize its limited resources. This article explores the specific memory map, the separation of pixel data and color attributes, and the notorious attribute clash phenomenon resulting from this architecture. Readers will gain a technical understanding of how the Z80 processor accessed video RAM to generate the iconic 256x192 display.
The Video Memory Map
Screen memory begins at decimal address 16384 (hexadecimal 4000) and occupies 6912 bytes in total. This block of RAM is dedicated solely to the display, separate from the basic program area. The organization is split into two distinct sections: the pixel definition data and the color attribute data.
Pixel Data Structure
The first 6144 bytes are reserved for monochrome pixel information. Unlike modern linear framebuffers, the Spectrum’s pixel data is not stored in a simple top-to-bottom sequence. Instead, the screen is divided into three horizontal thirds, each containing 64 character rows. Within these rows, data is stored in 8x8 pixel blocks. To calculate the specific memory address for a pixel, programmers had to manipulate bits to account for the character row, the line within the character, and the horizontal third.
Color Attributes
Following the pixel data, the final 768 bytes of the screen memory are used for color attributes. There is one attribute byte for every 8x8 pixel block on the screen. This byte defines the ink color, paper color, brightness, and flash status for that specific block. Because color information is tied to these 8x8 grids rather than individual pixels, multicolor graphics within a single block were restricted.
The Attribute Clash
This memory structure led to a visual limitation known as attribute clash. Since only two colors could be defined per 8x8 block, detailed sprites or text overlapping different colors would often inherit the background color of the block they occupied. Developers had to carefully design graphics to align with these character boundaries to minimize visual artifacts, a constraint that defined the aesthetic of the era.
Conclusion
The ZX Spectrum’s screen memory organization was a clever engineering compromise that allowed for a color display within tight hardware constraints. While the non-linear addressing scheme complicated programming, it enabled the machine to achieve a resolution of 256x192 pixels with color attributes using only 7KB of video RAM. Understanding this layout remains essential for retro developers and enthusiasts creating software for the classic platform.