ComputerSpaceDesign ‐ Motion Board - SteBuTOS/ComputerSpaceDesign GitHub Wiki

cs_pcb_docu-motion

Concept of Drifting Counters (aka Splipping Counters)

To understand the concept of drifting counters, it is necessary to have a basic understanding of composite video signals and how they are processed by an CRT in the first place:

CRT/Composite excursion

Imagine you have a special flashlight (the Electron Gun) inside the big glass tube (the CRT). This flashlight doesn't shoot light, but a thin, invisible beam of tiny particles called electrons.

The screen at the front of the tube isn't just glass; its inside surface is coated with special stuff called phosphor. When the electron beam hits this phosphor, it glows, creating a tiny dot of light.

Now, how does the Composite Video Signal fit in? Think of it like a single package of instructions coming down a wire. This package contains three main types of information all mixed together:

  • Brightness Information (Luminance): This tells the electron gun how strong the beam should be at any given moment. A stronger beam makes the phosphor dot glow brighter; a weaker beam makes it dimmer. If the beam is turned off completely, the spot is black.
  • Color Information (Chrominance - for color TVs): This tells the system what color the dot should be. As CS is only b/w, this can be ignored for now.
  • Timing Information (Sync Pulses): This is like the director shouting commands! It tells the electron beam exactly where to point and when. Horizontal Sync: Tells the beam, "Okay, you've finished drawing one line across the screen from left to right. Quickly zip back to the left side and move down just a tiny bit to start the next line!" Vertical Sync: Tells the beam, "Alright, you've drawn all the lines and reached the bottom right corner. Quickly jump all the way back to the top left corner to start drawing the whole picture (frame) over again!"

back to Drifting counters

So generating a composite video signal is very much about timing. The circuitry that is generating a valid video signal must adjust the voltage level at the right time to either "paint" a dot or to signal an end of line (H-sync) or the end of the frame (V-Sync).

On CS, this is mainly the job of the horizontal and vertical sync counters on the sync board. All static objects, like starfield and counter/timer digits, and also the H-sync and V-sync signal are counted and generated there. It is necessary, that the counting is advancing with the right speed, so that the last "pixel" of a line is generated, when the indepentently advancing beam on the CRT is reaching the end of the line. This is, why an accurate value for the clock crystal is so importand (on CS it is a 5.82 MHz crystal).

The idea of drifting counters is an intentional asynchronity between the position counters of the moving objects, relative to the sync counters. It is like a race of the two different counters, so if...

  • the counter of the moving object has to process less counts then the sync counter to a specific target, it finishes counting earlier, which results in a position of the moving object, relative to the static image, more to the left.
  • the counter of the moving object has to process more counts then the sync counter to a specific target, it finishes counting later, which results in a postion of the moving object, relative to the static image, more to the right.

The same principle applies for line counts on the vertical axis.

As long as the counter/timing differential remains the same, the counting delays (or advances) of the moving objects are accumulating, which results in an ongoing motion.

There are some advantages of this concept, like...

  • the circuitry, responsible for the position of moving object (motion board) has no need to know the actual sync counter values
  • only one set of counters is necessary to manage the actual position and the movement
  • no need for an up-/down-counter, a simple up-counter is sufficient

The downside of the concept is...

  • interaction (e.g. colission detection, alignment) between moving and static objects is not possible