ch81/videogen
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Michael Hope 334aea068c
All checks were successful
/ core (push) Successful in 5m37s
ch81: add a LICENSE and README
2026-05-14 12:13:31 +02:00
..
boards ch81: use a timer channel for the back porch 2025-06-01 12:38:56 +00:00
src ch81: add a LICENSE and README 2026-05-14 12:13:31 +02:00
CMakeLists.txt ch81: add a genrule for the font 2025-06-09 10:52:43 +00:00
genfont ch81: add a genrule for the font 2025-06-09 10:52:43 +00:00
prj.conf ch81: use a timer channel for the back porch 2025-06-01 12:38:56 +00:00
README.md ch81: switch to NTSC and a different VSYNC pattern 2025-05-31 14:15:09 +00:00

videogen, a composite video generator

videogen generates ZX81-like composite video.

Characteristics

  • 24 rows of 32 characters, i.e. 192 lines
  • 128 characters, 64 normal and 64 reversed

Timing:

  • Based off a 6.5 MHz clock
  • Line width: 64 us
  • HSYNC: 5 us
  • VSYNC: 400 us

Timing details:

  • PAL non-interlaced is 312 lines
    • 8 lines of sync
    • 16 unspecified lines
    • 288 display lines
    • "Text safe" area is 230 lines
  • 1.7 us front porch before HSYNC
  • 5.7 us back porch after HSYNC
  • 32 8 bit characters on 6.5 MHz is 39 us

Signal levels:

See ZX81 Video Display System or Batsocks for more.

Method

Use TIM1. CH2 is on the same trigger set as SPI TX, so CH2 can trigger the first write and SPI TX all following writes.

Signal looks like it would benefit from a front and a back porch.

SPI clock is 48/7 or ~6.86 MHz. A SPI byte is ~1.17 us, so there are ~54.9 bytes/line.

Front porch is black and 1.65 us, so 2 bytes.

Back porch is black and 5.7 us, so 5 bytes.

HSYNC is 4 us, so 4 bytes.

v1 using 16 bit SPI takes 105 us to render and write a line. Writing is 27*16 bits = 63 us, so the render is 42 us.

Rendering at -O2 gives 86 s, so the render time is 23 us.

PC6 is MOSI, PD2 is SYNC.