Bride of Son of Cheap Video, appendix: Cheap Video Resurfaces

KK Video Overview

normal bus operation

bus operation during video scan

"Cheap Video" basics are explained here.

Cheap Video is a means of outputting video without the need for DMA hardware or a Video Controller chip. The basics of Cheap video are explained on a separate page.

Briefly, the main difference between KIM-1 and KimKlone video is the means for triggering the video circuitry. My KIM-1 uses an ordinary JSR instruction but requires video data to be held within a special block of addresses; those addresses trigger the circuit. But the KimKlone lets you keep video data anywhere, since a special JSR instruction is what triggers the circuitry.

Specific details of the KK implementation are described below.

The SCAN Instruction

The KK Cheap Video instruction is called K3_SCAN. Its 33h op-code is intercepted and replaced with 20h, the JSR Absolute op-code. The accompanying two-byte operand specifies the destination address, an arbitrary location where pixel data is stored.

The CPU does a jump-to-subroutine to that location and seemingly finds a program of all NOPs. But of course as the CPU bus is getting stuffed with illusory NOPs, the actual memory data is getting copied into a shift register (D15, a 74HC166) and shipped out as video.

Microcode treats each entire scan as a single instruction, temporarily freezing itself as the string of NOPs is produced. Eventually the freeze is lifted by a periodic signal that's generated by a timer in one of the KK's 65C22 multi-function peripheral chips. (The timer runs at the CRT's horizontal scan rate, roughly 16kHz.) An RTS (60h) replaces the final two NOPs of the scan, and the CPU returns from the subroutine.

It's noteworthy that, since K3 is used, the JSR and RTS are "far" operations, meaning that memory anywhere in the 16 MB space can contain the video bitmap. It's easy to switch between multiple bitmaps if you want zero-overhead updates of the entire screen. And a hi-res bitmap could theoretically be allowed to exceed 64K as long as none of the individual scans has to cross a bank boundary.

Video Hardware

The KimKlone sends a monochrome, composite video signal to an RCA output jack. Usually I used a small, modified TV as my monitor. But there's also an interface for a bitmapped LCD panel I bought on the surplus market.

There's no Character Generator; the display is bitmapped. (If you want characters, the software draws 'em.) I chose not to implement color: the bitmap is a simple, one-bit-per-pixel plane, so each pixel is either black or white.

The vertical and horizontal resolution are widely variable. VSync pulses are generated by software, so controlling vertical res is a simple matter of the varying the values for the loop that surrounds the K3_SCAN calls. But to achieve variable horizontal res definitely requires some hardware: the KK uses a variable dot clock and load pulses for the shift register that's trotting out the bits, and also a wait-state generator for the CPU. The heart of that circuit is a programmable divider using a 74AC163 counter running at 80 MHz. The counter reloads on wraparound, with a reload value taken from a 4-bit output port. The port is what allows software to set the divide ratio and thus the dot rate. The duration of the horizontal scans is controlled by a VIA, as mentioned above.

KK Index 

Servicing the unserviceable
Main/extra index

copyright notice (Jeff Laughton)