Table of Contents
Field timing
Assume l
cycles per line.
Let there be a full-field timer, t
, that runs from cycle 0
to cycle [number of lines]*l
.
So horizontal cycle = t % l
, and vertical line = floor(t / l)
.
Then:
At t = 0
, disable the vertical drawing flag and the horizontal drawing flag.
If it is not already set and floor((t-1)/(2l)) == the start line
, set the vertical drawing flag.
If the vertical drawing flag is set and t%l == the start x position
, set the horizontal drawing flag.
Call the cycle on which the horizontal drawing flag was set q
.
At q+1
copy the number of columns for that line to an internal store.
If this is the first line on which the horizontal drawing flag has been set this field, at q+2
copy the number of rows to an internal store.
If you've completed outputting r
columns and r == the internally copied number of columns for that line
, clear the horizontal drawing flag.
If you've completed output of s
rows where s == the internally copied number of rows for that field
, clear the vertical drawing flag.
Line timing
Meaningful memory accesses begin at q+3
.
At q+3
request the first value from the video matrix. At q+4
request the appropriate value from the character cell space. At q+5
request the second value from the video matrix. At q+6
request the appropriate value from the character cell space. Etc.
The column fetched at (a, a+1)
is output during (a+4, a+5)
.
There is one internal counter, m
, which contains the current matrix address.
The tile pointer is calculated as CPU-set-base + m
.
The character pointer is calculated as CPU-set-base + character value * character height + (character line % character height)
.
Changes to the CPU-set tile or character pointer have immediate effect.
Addressing
In addition to the internal counter, m
, there is a reload copy, r
. There is also a line counter, for addressing character matrices, and a row counter, for determining when to end drawing. All begin each field at 0.
m
increments after each matrix access.
Performed at q+1
: m = r
. if (line counter == 8 and device is set to 8-line characters)
or (line counter == 16)
then reset line counter, increment row counter.
Performed per character: if (line counter == 8 and device is set to 8-line characters)
or (line counter == 16)
then r = m
.
Timing of palette changes
The auxiliary, background and border colours take effect immediately upon being written, affecting column data at the final output stage.
The reverse flag takes effect three pixels after being written.