lab

Picture and voice

lab · hardware · Commodore 64 · VIC-II · IEC · PCM5102A

80 by 44 picture with sharp subtitles

A PAL C64 is running the screen-on player in multicolor character mode. The picture is 80×44, four shades, drawn from a fixed 256-slot charset and updated with cell deltas over a Device 17 SA3 2-bit IEC burst. The screen stays on. Subtitles are hires glyphs on the rows under the picture. The voice is 16 kHz signed 16-bit mono from a PCM5102A on the ESP32, fed to the C64C audio input. It does not travel on the IEC bus. The picture and the voice are not in sync.

Emulator clip, a few seconds from the start. The picture and the sharp subtitles. The voice is not in the emulator.

Picture

The encoder scales to 80×44 and quantizes to four shades: black, dark grey 11, medium grey 12, and light grey 15. Each 2×2 block is one of 256 charset slots, every legal pair quad. The charset is 2048 bytes, sent once, and sits at $3800. A full frame is 880 screen codes, 40×22, plus a 2-byte index. A delta lists the cells that changed, each an offset and a tile. The smaller of the full frame and the delta is what is sent.

The player is multicolor text with the screen on: $D011 = $1B, $D016 = $18, $D018 = $1E, screen at $0400. The composed frame is copied from $9C00 into $0400. This is not a bitmap and not a Koala frame. Sprites are held off ($D015 = 0). Sprite DMA would land inside the 70-cycle burst window.

Subtitles

ROM chargen is copied to $3000 and stamped into the letter slots of the shade charset. Color RAM bit 3 is clear on the caption cells, so those cells are hires under multicolor mode. The stroke is $D021. The field is black. The lines are on rows 22 and 24, with a blank row under the picture and a blank row between the two lines. There is no mid-frame $D016 / $D018 switch. That split rolled the picture on the machine and was removed. $D021 is light grey for the letter ink, the multicolor pairs are rotated once so the four picture shades stay the same, and $D021 is not rewritten during the frame. The captions follow the picture.

IEC

Device 17, secondary address $63. Two bits move on CLK and DATA. The C64 samples $DD00 at cycles 10, 27, 43 and 59, and acknowledges on DATA at cycle 70. The clock edge is the C64 releasing DATA. ATN stays released. If ATN falls, the burst aborts. It is not stock one-bit serial, and ATN is not the clock.

The screen stays on. After the ESP raises CLK, the player waits until the next 70 cycles will not cross a badline. Phases 0 and 4 through 7 always do that wait. Phases 1 through 3 do it only in the border, lines 0–48 and lines 244 and up. The receiver was timed on this PAL machine: 63 cycles by 312 lines.

Voice

The PCM5102A is on the ESP32-S3 I2S peripheral. GPIO 17 is the bit clock, GPIO 18 the word clock, GPIO 8 the data, and SCK is tied to ground. The DAC clock is Philips I2S at 48 kHz, signed 16-bit stereo. The bit clock is 1.536 MHz. The file carries the voice as 16 kHz signed 16-bit mono, one packet per frame, 1812 frames, 181.2 seconds. Each 16 kHz sample is repeated three times and halved, so the DAC stays at 48 kHz. Those packets are stripped on the ESP. The bytes on the IEC bus are the picture, the charset, and the subtitles.

The DAC is written only while the IEC handler is outside LISTEN and TALK. Each fill is limited to about 2 ms, so a cache sync does not land in the middle of a byte.

The analog path is the C64C audio input. A 2.2k resistor in series and a 1µF film capacitor go into AV pin 5. The AV ground joins the ESP and DAC ground once. There is no second ground on the serial plug.

The player never writes $D418. After a reset the SID external input stays muted until the volume is opened with POKE 54296,15. This is not digitized SID audio, and the samples do not go into SID pin 26. With the volume open, the voice comes out of the C64C.

Sync

The voice runs at normal speed from the first bytes the C64 reads. The picture is still limited by the IEC transfer, so the voice runs ahead of the picture. The stream loaded with the voice is the heavy cut, a full frame every five frames, which does not catch the voice.

The light cut, with the PCM stripped, closed in 2:43. The measured session wall was 163.5 seconds, 18 seconds before the end of the 181.2 second talk. That is the measured headroom for holding frames. That cut is not what is loaded.

The hold build releases a full or delta frame when milliseconds since the voice started, plus 40, have reached the frame index times 100. Frame 0 is released immediately, which is what starts the voice. That build is not on the chip. The USB plug was out, so it was not loaded. The picture and the voice are not in sync.