Commodore 64 Graphics

MOS 6502 Video Demonstration with VIC-II Text Mode

Phone: 555-6502

            ╔═══════════════════════════════════════════════════╗
            ║                                                   ║
            ║    ┌────────────────────────────────────────┐     ║
            ║    │                                        │     ║
            ║    │                                        │     ║
            ║    │    **** COMMODORE 64 BASIC V2 ****     │     ║
            ║    │                                        │     ║
            ║    │    64K RAM SYSTEM  38911 BASIC BYTES   │     ║
            ║    │                        FREE            │     ║
            ║    │    READY.                              │     ║
            ║    │    _                                   │     ║
            ║    │                                        │     ║
            ║    └────────────────────────────────────────┘     ║
            ║                                                   ║
            ║       C O M M O D O R E   6 4   V I D E O        ║
            ╚═══════════════════════════════════════════════════╝

Introduction

Welcome to the Commodore 64 Graphics demonstration on the Emulator.ca Systems network.

The Commodore 64---released in August 1982 and eventually selling between 12.5 and 17 million units---remains the best-selling single personal computer model of all time. Its remarkable success was built on an equally remarkable specification: the MOS 6510 CPU (a variant of the legendary 6502), the SID sound chip, and the VIC-II video controller, all working together to produce capabilities that far exceeded what the price tag suggested.

The VIC-II chip was the heart of the C64's visual prowess. In text mode, it displayed a 40-column by 25-row screen with 16 colours---eight foreground colours per character, with a shared background. Each character position drew from a programmable character set stored in ROM or RAM. The C64 used PETSCII (PET Standard Code of Information Interchange), Commodore's own character encoding that included uppercase and lowercase letters, numbers, and a rich set of graphical block characters designed specifically for creating artwork on the screen.

This demonstration brings the C64's text mode to life through a genuine MOS 6502 CPU emulator. The screen RAM at $0400, the colour RAM at $D800, the VIC-II control registers---all faithfully emulated. A 6502 assembly programme runs on the emulated CPU, writing directly to video memory just as a programme would on original hardware. The video adapter reads this memory 30 times per second and renders it to your terminal using the authentic C64 colour palette.

This is a video-mode backend. Unlike text-only services, C64 Graphics renders a graphical framebuffer to your terminal. The display is driven by the emulated 6502 CPU writing to video memory, not by ANSI escape sequences.

Features

Quick Start

  1. Dial 555-6502 from the EC-TTY main menu
  2. The C64 video display initialises automatically
  3. Watch the SLP demo programme execute on the emulated 6502
  4. Type characters to write to the C64 screen via UART input
  5. Hang up to disconnect
ATDT555-6502
CONNECT 14400

*** C64 VIDEO TEST - SLP DEMO ***

Getting Connected

Dialling In

ATDT555-6502

Upon connection, the following sequence occurs:

  1. The MOS 6502 WASM emulator module is loaded
  2. The CPU is created, reset, and placed in raw memory mode
  3. A 40x25 virtual terminal is initialised
  4. Video memory is cleared (spaces with light blue foreground on blue background)
  5. The video BIOS is loaded at $E000
  6. The SLP demo programme is loaded and execution begins
  7. The C64 text adapter begins rendering at 30 frames per second

Modem Profile

C64 Graphics uses the V.32bis modem profile (14,400 baud). The high speed is necessary because the video adapter continuously streams rendered framebuffer data to your terminal.

Terminal Requirements

The VIC-II Display

Screen Layout

The C64 text mode displays 40 columns by 25 rows of characters, for a total of 1,000 character cells. Each cell has an independent foreground colour selected from the 16-colour VIC-II palette.

    Row 0:  ┌──────────── 40 columns ────────────┐
    Row 1:  │                                      │
    ...     │        Screen RAM: $0400-$07E7       │
    Row 23: │        Colour RAM: $D800-$DBE7       │
    Row 24: └──────────────────────────────────────┘

The VIC-II Colour Palette

The C64's 16-colour palette is one of its most recognisable features:

Index Colour Hex Notes
0 Black #000000
1 White #FFFFFF
2 Red #880000
3 Cyan #AAFFEE
4 Purple #CC44CC
5 Green #00CC55
6 Blue #0000AA Default background
7 Yellow #EEEE77
8 Orange #DD8855
9 Brown #664400
10 Light Red #FF7777
11 Dark Grey #333333
12 Grey #777777
13 Light Green #AAFF66
14 Light Blue #0088FF Default foreground
15 Light Grey #BBBBBB

The default configuration sets the background to blue (6) and the border to light blue (14), matching the iconic C64 power-on state.

PETSCII Character Encoding

The C64 uses PETSCII rather than ASCII. While most printable characters (letters, numbers, punctuation) are the same, PETSCII includes additional graphical characters:

When you type on the terminal, ASCII input is converted to PETSCII before being written to screen memory. Lowercase letters (a-z) are mapped to their PETSCII uppercase equivalents.

VIC-II Registers

The emulation provides the key VIC-II control registers:

Address Register Function
$D011 Display Control Screen enable (bit 4), scroll, mode
$D020 Border Colour Border colour (bits 0-3)
$D021 Background Colour Background colour (bits 0-3)

Display Control Register ($D011)

    Bit 7: Raster compare bit 8
    Bit 6: Extended colour mode
    Bit 5: Bitmap mode
    Bit 4: Screen enable (1 = on, 0 = blanked)
    Bit 3: 25/24 row select
    Bits 0-2: Vertical scroll

The demo initialises this register to $1B (display enabled, 25 rows, standard text mode).

Memory Map

Address Range Contents
$0000-$03FF Zero page, stack, system area
$0400-$07E7 Screen RAM (40x25 = 1,000 bytes)
$0800-$9FFF User programme space
$D000-$D02E VIC-II video registers
$D800-$DBE7 Colour RAM (1,000 nybbles)
$E000-$FFFF Video BIOS ROM (8 KB)
$FFFC-$FFFD Reset vector

Input

Characters typed on your terminal are sent to the emulated UART. The running 6502 programme can poll the UART for input. Additionally, typed characters are echoed to the screen at the current cursor position with the active foreground colour (light blue by default).

Supported Input

Key Behaviour
Printable characters Written to screen RAM in PETSCII
ENTER / Return Carriage return (cursor to column 0)
Line Feed Cursor moves down one row, scrolls if at bottom
BACKSPACE / DEL Erases character behind cursor
TAB Advances cursor to next 8-column boundary

The SLP Demo Programme

Upon connection, a pre-compiled 6502 assembly programme is loaded and executed on the emulated CPU. This demonstration programme writes directly to screen RAM and colour RAM to produce animated graphics, showcasing the VIC-II text mode capabilities.

The programme runs at approximately 960,000 cycles per second (9,600 cycles every 10ms), closely matching the C64's NTSC clock rate of 1,022,727 Hz.

Command Reference

Command Description
Any printable key Write PETSCII character to screen at cursor
ENTER Carriage return
BACKSPACE / DEL Erase previous character
TAB Advance to next tab stop
Hang up Disconnect from the demo

Quick Reference Card

╔══════════════════════════════════════════════════════════════════════╗
║  C64 Graphics - QUICK REFERENCE                 Emulator.ca Systems ║
╠══════════════════════════════════════════════════════════════════════╣
║                                                                      ║
║  DIAL: 555-6502                     CATEGORY: Vintage Hardware      ║
║                                                                      ║
║  DISPLAY:   40x25 text mode         ENCODING:  PETSCII             ║
║  COLOURS:   16 (VIC-II palette)     REFRESH:   30 fps              ║
║  CPU:       MOS 6502 @ ~1 MHz       BIOS:      $E000 (8 KB)       ║
║                                                                      ║
║  VIDEO MEMORY:                                                      ║
║    Screen RAM:  $0400-$07E7 (1000 bytes)                            ║
║    Colour RAM:  $D800-$DBE7 (1000 nybbles)                         ║
║    Background:  $D021        Border:  $D020                        ║
║                                                                      ║
║  DEFAULT COLOURS: Light blue on blue (classic C64 power-on)        ║
║                                                                      ║
║  INPUT: Type characters to write to screen. Hang up to disconnect. ║
║                                                                      ║
╚══════════════════════════════════════════════════════════════════════╝

Troubleshooting

Problem: Screen appears blank or does not update

The video adapter renders at 30 fps. If the display control register at $D011 has bit 4 cleared, the screen will be blanked. Under normal operation, the demo programme sets this register correctly. If the display remains blank after several seconds, disconnect and redial.

Problem: Colours appear wrong or missing

The C64 colour palette requires 16-colour ANSI support in your terminal. If your terminal only supports 8 colours, the display will approximate the palette but some colours will be incorrect. Ensure your terminal is configured for full 16-colour or 256-colour ANSI mode.

Problem: Characters appear as wrong symbols

PETSCII encoding differs from ASCII. Lowercase letters you type will appear as uppercase on the C64 screen, and some special characters may render differently. This is authentic C64 behaviour, not a bug.

Problem: Display is slow or choppy

The C64 video backend streams rendered framebuffer data at 30 fps over the modem connection. At lower baud rates, frames may be dropped. The V.32bis profile (14,400 baud) is required for smooth operation.

Problem: Demo programme crashes (display freezes)

The 6502 emulator may encounter an illegal opcode or infinite loop. Disconnect and redial to restart. The CPU is reset and the demo programme is reloaded fresh on each connection.

See Also


Commodore 64 Graphics -- MOS 6502 VIC-II Text Mode Demonstration

Emulator.ca Systems

Document Revision 1.0