The video sub-system consists of three logic modules; Timing Generator, Video Generator and the TTY logic and also a Font ROM and a shared, dual port Character Code Point RAM.
Not shown in the figure below, is a shared buffer-offset. It is updated by the TTY-logic and is read by the Video Generator to enable automatic scrolling.
For the first PoC, I've also implemented a UAR (Universal Asynchronous Receiver) that will receive test-text from a computer.
The text from the UAR enters the TTY-logic as a series of 7-bit bytes with a strobe-signal. The logic calculates the next RAM-address and stores the character there.
Before diving into the Video Generator, it is important to take a look at the Timing Generator (TG). The TG takes a clock signal and counts pixels on a row, and scan lines. At the appropriate time it asserts the V-sync and the H-sync signals to synchronise the monitor to the video signal.
VGA was created when monitors had CRTs in them, and CRTs works by moving a beam of electrons across a coating of phosphor, making it glow in proportion to the intensity of the beam. The beam is moved using magnetic fields, and those have some inertia, making them unstable when changing direction. To avoid visible distortion, each scan line has some invisible period, and there are some invisible lines at the end of each frame-scanning as well.
The invisible period is itself split into three parts; Front porch, Sync and Back porch. For the TG, the sync pulses are asserted in the purple interval, and the Video On signal is asserted in the blue interval in the figure below.
In the blue interval, the TG provides a horizontal counter, 0-319 and a 0-23 row counter with a 0-9 scan-line counter to the video generator.
The Video Generator, VG uses these counter and combines with the buffer-offset from the TTY-logic to create an address for the character RAM. The data in the character RAM is an ASCII value that forms an address together with the vertical scan-line counter into the Font ROM.
The Font ROM provides one scan-in worth of font data, which is shifted out to the video port.