Video Display Notes

Author(s): Jim Williams
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n5 (Volume 2, Issue 5)
Date: May 1981
Pages: 8

(Ed. note: This article describes the gut workings of the MicroAce/ZX80 video display and is not intended for beginners. Jim has more extensive notes; check his classified ad on p.16.)

The CPU-driven video in the MicroAce/ZX80 is an incredible mix of software and hardware. the central software is the ROM “idle” routine between 13CH and 1ACH. This subroutine drives the video display, controls vertical sync pulses, and reads the keyboard during those pulses. This information was inferred from the schematic and a disassembled ROM listing (not from the designer) and gives an overall idea of the workings of the video display. Hardware names like U10 (IC9) mean MicroAce (ZX80) components.

The idle routine updates the frame counter used by RND, then checks the keyboard, shifting a 0 through the B register to read all the keyboard half-rows. This routine exists at 188H if a keypress is detected. When it’s ready to display a frame of video, it jumps to a nonexistent part of memory, 32K bytes higher than the real display file. The CPU tries to read from this RAM display file, but A15 is high, the routine is not HALTed and is in an M1 (instruction fetch) cycle, and D6′ is not high, so U20 and 23 (IC16 and 17) allow the open collector buffers U15 and 16 (IC14 and 15) to pull the CPU (unprimed) side of the data bus low. So the CPU sees only zeros– machine code for NOP. Meanwhile, the actual RAM character is stored in an 8-bit latch U6 (IC5), whose inputs are the primed side of the data bus. During the refresh time, that byte is part of a ROM address to get the bit pattern for one of the 8 horizontal lines making up the screen character (stored in the character generator starting at 0E00H). The bit pattern leaves the ROM on the primed data bus, goes through resistors R5-12 (R4-11) and latches into video shift register U10 (IC9). This bit pattern, clocked out at 6.5 MHz, is video.

This process continues as the CPU tries to read consecutive instructions. But eventually, a NEWLINE (76H) appears in the display file. Because NEWLINE has bit 6 high, the open collector NOP writer is not enabled, so the CPU reads 76H as an instruction. In Z80 code, 76H is a HALT command.

The only way out of a Z80 HALT state is an interrupt or a reset. The interrupt line is sampled during refresh time and is connected to address line A6. When the refresh counter in the CPU (preset in the idle routine) comes to an address with A6 low, it generates the interrupt that signals the end of a scan line. One result is a special I/O read cycle, kicking a ripple-through one-shot that generates the horizontal sync pulse and increments the 3-bit counter U14 (IC21) that keeps track of which scan line the ROM gives the bit pattern for. The other result is a CALL to an interrupt handler at 0038H. This routine decrements C, the scans per line counter, and if necessary, B, the lines per display counter. It returns to non-existent memory to either re-read the same characters for another scan, or to read the next line of characters. When done, it returns to the idle routine.

The IN instruction that reads the keyboard also sets the sync line low for the vertical sync pulse. Later, after a carefully timed instruction sequence, an OUT instruction at 196H ends the vertical sync pulse. Of course, the idle routine returns to BASIC when a keypress is detected.