The Zx Spectrum Ula How To Design A Microcomputer Zx Design Retro Computer Portable Instant

Here's a pseudo-code outline for the main loop:

// Core 0: ULA + Z80 emulation (actually, bus master)
while(1) 
    // During display active period (first 192 scanlines)
    for(y=0; y<192; y++) 
        // Generate 256 pixels of "video" from RAM 0x4000 + y*32
        uint8_t *screen_line = ram + 0x4000 + (y * 32);
        render_line_to_framebuffer(screen_line, y, border_color);
    // Steal cycles from Z80 for each of the 32 bytes (contended memory)
    for(byte=0; byte<32; byte++) 
        wait_for_z80_cycle_end();
        tri_state_z80_bus();    // ULA takes over
        read_ram_and_refresh();
        release_z80_bus();
// Blanking period: let Z80 run free, refresh DRAM, scan keyboard
handle_keyboard();
audio_mix();
sd_card_poll();

On Core 1: Drive the SPI LCD at 60fps from the framebuffer.

Critical: The Z80 must see RAM access times <200ns. The RP2040 can do this via tight PIO + DMA.

Recreating the ZX Spectrum experience hinges on reproducing both function and timing. Using an FPGA to implement a modern ULA lets you preserve the machine’s behavioral quirks (what made the Spectrum special) while adding modern conveniences for portability. Start with a focused FPGA video/DRAM prototype, iterate with a simple ROM and Z80 core, and build outward—balancing authenticity and usability to produce a compact, lovable retro microcomputer.

If you want, I can: provide a sample FPGA ULA block diagram, draft a minimal memory map and port list, or outline a parts list with specific component models. Which would you prefer next?

The ZX Spectrum ULA: How to Design a Microcomputer by Chris Smith is widely considered the definitive technical resource for understanding the "heart" of the Sinclair ZX Spectrum. Through painstaking reverse-engineering down to the transistor level, Smith reveals how a single custom chip—the Ferranti Uncommitted Logic Array (ULA)—managed almost all of the computer's operations, from video generation to keyboard scanning. Key Technical Insights

The book goes beyond historical trivia, providing a deep dive into the engineering compromises that made the Spectrum affordable:

Video Generation: Detailed analysis of how the ULA creates a PAL video signal and manages the 16KB of "contended" RAM where display data is stored.

Design Flaws & Quirks: Smith explains the origin of famous hardware "bugs," such as the "Snow Effect" (caused by memory contention) and the non-standard composite sync pulses that many modern TVs struggle to process.

Hardware Architecture: It covers the timing diagrams and circuit drawings essential for anyone looking to replicate the machine using modern FPGAs or CPLDs. Who Is This Book For? Book review: The ZX Spectrum ULA - librador.com


The Silicon Alchemist: The ZX Spectrum ULA and the Art of Efficient Design

In the pantheon of retro computing history, the ZX Spectrum is often celebrated for its quirks: the rubber keyboard, the "attribute clash," and its distinctive cassette loading screech. However, beneath this eccentric exterior lies a masterclass in engineering minimalism. At the heart of Sir Clive Sinclair’s revolutionary machine was the ULA (Uncommitted Logic Array), a chip that redefined how microcomputers were designed. Understanding the ULA is not merely an exercise in nostalgia; it provides a blueprint for modern engineers seeking to create portable retro computers that balance authenticity with practicality.

To understand the significance of the ULA, one must look at the computing landscape of the early 1980s. Competitors like the BBC Micro or the Commodore 64 relied on a sprawl of discrete logic chips—counters, multiplexers, and buffers—scattered across large printed circuit boards (PCBs). This consumed space, generated heat, and increased manufacturing costs. Sinclair’s approach was radically different. The ULA, designed by Richard Altwasser, acted as the system’s "glue logic," consolidating dozens of functions into a single custom chip. It handled memory addressing, video generation, and I/O management. This integration was the key to the Spectrum’s legendary low cost and compact size.

From a design perspective, the ULA represented a pivot toward "system-on-a-chip" thinking long before the acronym became an industry standard. For the modern designer building a portable retro computer, the lessons of the ULA are vital. The primary constraint in portable design is real estate. A modern handheld cannot accommodate the sprawling PCBs of 1980s originals. Designers today often use CPLDs (Complex Programmable Logic Devices) or FPGAs (Field-Programmable Gate Arrays) to mimic the behavior of the original ULA. By replicating the ULA’s logic in a modern FPGA, a designer can reproduce the Spectrum’s video output and memory banking while shrinking the hardware footprint to the size of a postage stamp.

However, the ULA also teaches a lesson in compromise, a critical concept for portable design. The original Spectrum suffered from "contended memory" issues because the ULA had to share the RAM between the CPU and the video circuitry. When the ULA needed to read memory to draw the screen, it paused the CPU. This created the distinctive timing quirks of the machine. When designing a portable emulation device, one faces a similar resource battle: battery life versus screen brightness, or CPU cycles dedicated to emulation versus those needed for the operating system. The ULA serves as a reminder that the most elegant engineering solutions often arise from the strictest constraints.

Furthermore, the video signal generation of the ULA provides a specific hurdle—and opportunity—for portable design. The original ULA generated a PAL RF signal or composite video, intended for CRT televisions. Modern portable devices utilize LCD or OLED panels. A direct port of ULA logic to an FPGA would result in a raw digital video stream, which requires a controller to scale it to a modern resolution. Here, the modern designer must iterate on the ULA concept: retaining the logic that defines the machine’s identity (the exact pixel timing that creates the "flash" attribute effect) while discarding the analog output stage in favor of direct digital drive to a modern screen.

Finally, the ULA symbolizes the ethos of the "home computer" era: accessibility through efficiency. Clive Sinclair wanted a computer that could fit into a briefcase and sell for under £100. The ULA was the engine of that democratization. Today, the "portable retro computer" market is booming, driven by devices like the Raspberry Pi Zero or dedicated FPGA handhelds. These devices owe their existence to the design philosophy proven by the ULA—that the soul of a computer does not require a massive chassis, but rather efficient, integrated logic.

In conclusion, the ZX Spectrum ULA was more than just a chip; it was a statement of intent. It proved that complexity could be condensed without losing functionality. For the modern retro computer designer, the ULA remains a textbook example of how to design a microcomputer. It teaches that integration is the pathway to portability, and that understanding the timing and logic of the past is the only way to build authentic, portable experiences for the future.

The ZX Spectrum remains a masterpiece of minimalist engineering. At its heart lies the Uncommitted Logic Array (ULA), a custom chip that defined the machine’s capabilities and its quirks. Designing a modern microcomputer based on this retro architecture requires understanding how to balance 1980s constraints with today’s portable technology.

The ZX Spectrum ULA: Designing a Modern Portable Microcomputer

The original ZX Spectrum, released by Sinclair Research in 1982, was a marvel of cost-cutting. While competitors used expensive off-the-shelf chipsets, Sir Clive Sinclair and lead designer Richard Altwasser relied on the Ferranti ULA. This single chip handled video generation, memory timing, and I/O, allowing the Spectrum to be small, affordable, and iconic. Today, the "ZX Design" philosophy inspires a new generation of hobbyists to build portable, DIY microcomputers. Understanding the Role of the ULA

The ULA was the "glue" that held the Spectrum together. In a standard Z80-based system, you would need dozens of discrete logic chips to manage the interface between the CPU and the RAM. The ULA condensed this into one package. Its primary jobs included:

Generating the television signal (PAL/NTSC).Managing "Contended Memory," where the CPU and ULA competed for access to RAM.Handling the keyboard matrix and the tape ear/mic ports.Producing the famous (and limited) one-channel "beeper" sound. Here's a pseudo-code outline for the main loop:

To design a modern microcomputer, you must decide whether to use a physical ULA, an FPGA implementation, or a microcontroller-based emulation. The Evolution of ZX Design: From Desktop to Portable

Creating a portable ZX Spectrum-compatible device involves shrinking the footprint without losing the "soul" of the machine. The original design used a rubber chiclet keyboard that was notoriously difficult to type on, but essential for the Spectrum’s aesthetic.

Modern designs often swap the bulky CRT output for an integrated LCD panel. Using an SPI or parallel interface screen allows for a handheld form factor. However, timing is critical. The ULA must hit specific clock cycles to ensure that classic games run at the correct speed and that the "attribute clash" (the Spectrum’s unique way of handling color) looks authentic. How to Design Your Own Microcomputer

If you are starting a retro computer project, follow these core architectural steps:

Select Your ProcessorWhile the Zilog Z80 is still in production, many designers use the Z80 CMOS version for lower power consumption in portable builds. Alternatively, an ESP32 or Raspberry Pi Pico can emulate the Z80 instruction set with ease.

Implement the Logic (The ULA Replacement)For an authentic hardware feel, use a CPLD (Complex Programmable Logic Device) or FPGA. These chips can be programmed to behave exactly like the Ferranti ULA. If you prefer a software-defined approach, a high-speed microcontroller can "bit-bang" the video signal and manage memory timings.

Memory MappingThe Spectrum used a 64KB address space, typically split into 16KB of ROM and 48KB of RAM. In a portable design, you can use a single SRAM chip. Ensure your design accounts for the "contention" cycles where the video hardware pauses the CPU to read display data.

Power ManagementPortability requires a LiPo battery and a charging circuit. Because vintage logic chips can be power-hungry, using 3.3V modern equivalents instead of the original 5V parts will significantly extend battery life. The Appeal of Retro Portable Computing

Why build a ZX Spectrum clone in the age of smartphones? It is about the transparency of the machine. When you design a microcomputer from the ULA up, you understand every gate and every cycle. There is no operating system layer hiding the hardware from the programmer.

By following the ZX design ethos—simplicity, clever shortcuts, and a focus on essential features—you can create a portable device that captures the magic of 1982 in a pocket-sized form factor. Whether you are using a real Z80 or a modern FPGA, the spirit of the ULA lives on in every pixel of attribute clash.

💡 Pro Tip: If you're building a portable, focus on the keyboard. The Spectrum's "one-key-word" entry system makes it uniquely suited for small devices where a full QWERTY layout might be cramped.

Is your goal a faithful recreation or a modernized version with SD card support?

I can provide schematics, code snippets, or component lists based on your choice.

The Heart of the Machine: The ZX Spectrum ULA and Retro Microcomputer Design

The Sinclair ZX Spectrum stands as a masterclass in cost-effective engineering, largely due to a single custom component: the Uncommitted Logic Array (ULA)

. For any hobbyist or engineer aiming to design a retro-style microcomputer, understanding the ULA is essential, as it represents the "glue" that bound together the Z80 CPU, memory, and video output into a functional system. Amazon.com The Role of the ULA

In an era when computers typically required dozens of discrete logic chips, Sinclair utilized the Ferranti ULA to consolidate these functions into one piece of silicon. Its primary responsibilities included: Universidad de Valladolid Video Generation:

It read data from the "lower" RAM (0x4000 to 0x7FFF) to generate the raster signal for television sets. Memory Contention:

Because both the CPU and ULA needed access to the same RAM, the ULA managed "contention" by stopping the Z80’s clock when the video circuitry needed priority access. System Timing:

It generated the 3.5 MHz clock for the Z80 CPU from a master 14 MHz crystal. I/O Handling:

It managed keyboard scanning, the speaker "beeper," and the cassette tape interface. Designing Your Own Retro Computer

When designing a modern "retro" microcomputer or a portable handheld, you have three primary paths to replicate or replace the original ULA: 1. The FPGA Approach Modern implementations like the ZX Spectrum Next Field-Programmable Gate Arrays (FPGAs) to recreate the ULA's logic. Advantages:

FPGAs allow for 100% timing accuracy and the addition of modern features like VGA/HDMI output or SD card support. Implementation:

You can use Hardware Description Languages (VHDL or Verilog) to define the logic gates, effectively "programming" the silicon to behave like the original Ferranti chip. 2. Discrete Logic (The "No ULA" Build) On Core 1: Drive the SPI LCD at 60fps from the framebuffer

For a deeper educational experience, some builders reconstruct the Spectrum using standard 74-series logic chips or EPROMs to handle the raster generation. How it works:

An EPROM can be used as a look-up table to generate the complex timing signals required for video output. Design Challenge:

You must manually manage the timing windows where the CPU can write to video memory without causing "snow" or screen corruption. 3. Emulation on Microcontrollers For portable, handheld designs, the Raspberry Pi Pico is a popular choice. Raspberry Pi PicoZX Project: Projects like the

use the Pico to emulate the Z80 and ULA in software, outputting to a small IPS display. Portability:

This is the most efficient path for a handheld device, requiring only a few custom PCBs to house the microcontroller, a battery, and a tactile keyboard. Raspberry Pi Technical Resources for Designers

The year was 1982, and the air in Richard’s workshop was thick with the scent of solder and ozone. On his desk sat a "dead" ZX Spectrum

, its iconic rainbow stripe mocking him while its screen remained a stubborn, frozen pattern of black and white blocks.

Richard wasn’t just a hobbyist; he was a dreamer who wanted to shrink the power of Clive Sinclair's masterpiece into something that could fit in a coat pocket. To do it, he had to master the "Black Box" at the heart of the machine: the Uncommitted Logic Array (ULA) The Secret Heart

In those days, most computers were a mess of dozens of tiny chips. But the Spectrum was different. The

was a custom-designed piece of silicon that did the work of forty chips at once. It handled the video display, managed the memory timing, and even "spoke" to the tape recorder [2, 3].

Richard spent nights poring over blurry technical manuals. He learned that the ULA was the gatekeeper

. It had to constantly "steal" time from the Z80 processor to draw the screen, a delicate dance called contended memory

[3]. If the timing was off by even a microsecond, the whole system crashed. The Portable Vision

"It needs to be smaller," Richard muttered, sketching a clamshell design in his notebook. His plan for the "ZX-Portable" Replacing the ULA:

Since original Ferranti ULA chips were hard to find, he decided to use a modern CPLD (Complex Programmable Logic Device) to mimic the old silicon's logic [4]. The Screen: Instead of a heavy CRT television, he wired up a 3.5-inch used for car backup cameras. He swapped the bulky power brick for a Lithium-Polymer battery

, using a voltage regulator to keep the delicate 5V rails steady. The First Boot

After six months of burnt fingertips and thousands of lines of code to simulate the ULA's video timing, the moment arrived. He flicked the toggle switch.

The tiny LCD flickered. For a second, it was just static. Then, the legendary crisp white background appeared, and at the bottom of the screen, the words he had worked half a year to see: © 1982 Sinclair Research Ltd Richard tapped the rubber keys he’d salvaged. 10 PRINT "IT LIVES!" 20 GOTO 10

. As the words scrolled infinitely on his handheld creation, he realized he hadn't just built a computer; he’d bottled lightning. specific logic equations used to replicate the ULA, or should we look at the PCB layout requirements for a portable build?

Designing a modern microcomputer based on the ZX Spectrum requires a deep understanding of its custom "heart": the Ferranti Uncommitted Logic Array (ULA)

. This chip combined disparate logic functions—video generation, keyboard scanning, and memory management—into a single, cost-effective package. Amazon.com The Role of the ULA in ZX Design The ULA was the bridge between the

and the rest of the system. In any retro or portable recreation, you must account for its primary responsibilities: Video Generation: It reads the lower 6.75 KB of RAM (Video RAM) to generate a pixel display. Memory Contention:

To avoid hardware conflicts, the ULA has priority access to "contended memory" (the first 16 KB of RAM). It can physically stop the Z80's clock to take control of the bus. I/O Management: It handles Port , which manages the border color, beeper sound, and the keyboard matrix. Universidad de Valladolid How to Design Your Own Microcomputer

Whether building a desktop replica or a portable "Speccy," there are three main hardware paths: Discrete Logic (The "Harlequin" Method): Projects like the Harlequin board available on replace the unobtainable ULA with standard TTL logic chips The Silicon Alchemist: The ZX Spectrum ULA and

. This is the most educational approach for understanding digital circuits. FPGA Implementation (Modern & Flexible): Most modern clones, such as the ZX Spectrum Next Field-Programmable Gate Array (FPGA) to mimic the ULA's logic. Intel Quartus Prime or Xilinx Vivado to program the hardware logic in

FPGAs allow for enhancements like VGA/HDMI output, SD card storage for instant game loading, and even "ULAPlus" for expanded color palettes. No-ULA Design: Some hobbyists, featured on

to handle the logic usually reserved for the ULA, simplifying the build for those who want to use a real Z80 but avoid complex gate arrays. Portable Design Considerations

To make your microcomputer portable, you'll need to integrate:

Designing a retro microcomputer based on the ZX Spectrum involves understanding its "heart"—the Uncommitted Logic Array (ULA). This custom chip replaced dozens of discrete logic components, making the original Spectrum affordable and compact. The Core: The ZX Spectrum ULA

The ULA is the central manager for the microcomputer's timing and peripherals.

Video Generation: It reads the lower 6,912 bytes of RAM 50 times per second to generate the 256x192 pixel display and 32x24 attribute grid.

Clock Management: It takes a 14 MHz master clock, dividing it to provide a 7 MHz pixel clock and a 3.5 MHz clock for the Z80 CPU.

Memory Contention: To avoid collisions, the ULA has priority access to the "lower RAM" (0x4000 to 0x7FFF) for video drawing. If the CPU tries to access this area at the same time, the ULA halts the CPU clock, a behavior known as contention.

Peripherals: It handles keyboard scanning, border color control, and the "beeper" sound output/input. Designing a Modern Retro Microcomputer

To build a functional clone or inspired design today, you have three primary paths: 1. Discrete Logic (The "Harlequin" Method)

You can replicate the ULA's functions using standard, off-the-shelf logic chips.

Project Example: The Harlequin is a 100% compatible Spectrum clone that uses discrete through-hole parts instead of the custom ULA.

Advantage: Uses readily available parts and avoids "ULA bugs" like the "snow effect". 2. FPGA-Based Design

Field-Programmable Gate Arrays (FPGAs) can be programmed to act exactly like the original hardware at a gate level. Hardware: Boards like the or ZX Spectrum Next

use FPGAs to run "cores" that simulate the ULA and Z80 with high accuracy.

Enhancements: This path allows for modern features like VGA/HDMI output, SD card storage (via interfaces like DivMMC), and "ULAplus" for expanded color palettes. 3. Microcontroller Emulation

For a simpler, more portable build, use a powerful microcontroller to emulate the hardware in software. Example: The Raspberry Pi Pico Go to product viewer dialog for this item.

can run emulators that mimic the Z80 and ULA, driving a small LCD screen for a handheld device.

Connectivity: These often use a matrix-wired tactile keyboard connected to the microcontroller's I/O pins. Creating a Portable "Pocket" Design

If your goal is a portable device, focus on these integration steps: Building a Pocket ZX Spectrum | PDF - Scribd


  • Preserve attribute-based color system and flash/bright behaviors, border handling, and contention timing for accurate effects.
  • Offer scanline and scaling modes in a menu (but keep original timing available).
  • Before designing a portable replacement, we must understand exactly what the ULA did in the original 48K/128K models.

    | Function | Description | |----------|-------------| | Video Generation | Produces 15.625 kHz horizontal and 50 Hz vertical sync (PAL). Outputs 256×192 pixels, 1-bit per pixel, with attribute clash. | | Memory Arbitration | Interleaves Z80 access and video fetch during the 6.5 MHz clock. CPU runs at ~3.5 MHz but is halted during video display (contended memory). | | I/O Decoding | Decodes port 0xFE for keyboard reading, sound (beeper), and cassette mic/ear. | | DRAM Refresh | Provides RAS/CAS timing for 4116-style DRAMs. | | Clock Generation | Divides a 14.21818 MHz master clock down to 3.5469 MHz (Z80) and pixel clock. |

    Critical timing detail: The ULA reads 40 bytes of screen data per line (6.5 µs fetch) then the Z80 runs (6.5 µs). This “contended memory” model is the single most difficult feature to emulate accurately.

  • ROM: 16KB or 32KB ROM(s) for BASIC/firmware; store alternate ROMs (48K BASIC, 128K + AY drivers) in SPI flash or on SD and boot-selectable.
  • The ZX Spectrum, released in 1982 by Sinclair Research, defined home computing for a generation. At its heart lies the ULA (Uncommitted Logic Array), a custom chip that integrated video generation, memory arbitration, I/O, and system timing. This paper explores how to design a portable, battery-powered ZX Spectrum-compatible computer by understanding, emulating, or replacing the ULA with modern hardware. We examine the ULA’s original functions and present a practical architecture for a handheld retro device using FPGA or discrete microcontroller techniques.