Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

13KB

Land Map 64 - Specification

Approved by Daniel Covington on 2026-12-03. Changes to this file follow AGENTS.md section 6.

Changes approved by the user since then:

  • 2026-12-03: NTSC frame budget corrected to 17,095 cycles.
  • 2026-12-03: 5-line status area below a 20-row map (R6; R1 and R5 updated; milestone M3 gained the split-screen task).
  • 2026-12-03: R3 reworded for scrolling: while a scroll rebuild runs, people are drawn in the shown buffer during vertical blank; drawing people relative to the view moved from M3.4 to M3.3.

Summary

A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (brown land, grey stone, green grass and trees, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as light red dots, wander the world but are blocked by water and stone. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn.

Original idea, as given:

okay I want to start a c64 project in assembly that will procedurally generate a hi res color bitmap of a map of a land with brown land grey stone green grass and trees and black for roads colors. I would like to see if we can add people as tan dots and use buffer fliping to show movent of the people on the map .. you can ask me questions if this is not cleaar

Smallest useful version: A 2x2-screen world generated from a seed at start-up, shown one screen at a time in multicolour bitmap mode, pixel-smooth scrolling with the cursor keys, 16 light red people moving over land, grass, trees and roads (not water or stone), flicker-free via two flipped buffers with only the people's spots redrawn, and SPACE for a new world.

First release

A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor-key scrolling, a 5-line status area below the map, 16 moving people blocked by water and stone, double-buffered partial redraw, and SPACE for a new world.

In scope

  • Procedural generation of a 2x2-screen world (80x50 cells of 4x8 multicolour pixels) from a seed
  • Terrain colours: brown land (background), grey stone, green grass and trees, blue water, black roads that connect
  • Pixel-smooth scrolling of the view with the cursor keys, using the VIC-II fine-scroll registers and a double-buffered coarse shift
  • 16 people as light red dots (one multicolour pixel each), spread over the world, blocked by water and stone; only those in view are drawn
  • Two bitmap buffers flipped once per update; only the bytes under people are restored and redrawn between scroll steps
  • SPACE generates a new world
  • A 5-line text status area below a 20-row map, using a raster split: title, view position, people in view, a spare line and key help
  • NTSC timing

Out of scope

  • PAL support
  • Worlds larger than 2x2 screens
  • Sprites for people
  • People with goals, pathfinding or interaction
  • Sound and music
  • Saving worlds or seeds
  • Joystick
  • Real-hardware testing (VICE only)
  • C128 native mode

Targets

Target Machine / mode Display Video Artifact Expected behavior
c64 Commodore 64 VIC-II 40x25 text/graphics screen (C64, or C128 40-column) ntsc build/land-map-64.prg Autostarts, shows a short generating message, then a multicolour bitmap view of the world (20 rows): brown land, grey stone, green grass and trees, blue water, black roads, with 5 lines of status text below it. Light red dots move on land and roads. Cursor keys scroll the view smoothly; SPACE generates a new world.

Dual-target and mode notes

Single target.

Display notes

  • c64: VIC-II 40x25 screen. Screen RAM at $0400 by default.

Testing environment

  • Reference emulator: VICE (exact options in docs/toolchain.md).
  • Real hardware: Not requested for this release. VICE is the reference environment; real-hardware steps in docs/manual-tests.md are optional.

Requirements and acceptance criteria

Each criterion is observable. Criteria IDs (for example R1.2) are referenced by milestones and manual tests.

R1 - Generated 2x2-screen world (must)

At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. The generator decides the layout, shapes and counts of features; every world contains brown land, grey stone, green grass and trees, blue water and black roads that connect to each other. The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6).

Acceptance criteria:

  • [R1.1] After autostart in VICE (x64sc, NTSC) the map view appears within 15 seconds
  • [R1.2] Scrolling across the whole world shows all five terrain colours: brown, grey, green, blue and black
  • [R1.3] Roads are continuous black lines that connect to each other
  • [R1.4] No colour clash: every 4x8 cell shows only its intended colours

Capabilities: smooth-animation

R2 - 16 moving people (must)

16 people, each a single light red multicolour pixel, are spread over the world and move on their own. Water and stone block them: they walk only on land, grass, trees and roads. People inside the view are drawn; others keep moving unseen.

Acceptance criteria:

  • [R2.1] Scrolling around the world shows 16 light red dots in total
  • [R2.2] Each visible dot moves at least once per second
  • [R2.3] No dot ever enters a blue (water) or grey (stone) pixel

Capabilities: smooth-animation

R3 - Flicker-free double buffering, partial redraw (must)

While the view is still, people are drawn into the hidden bitmap buffer, which is then flipped into view during vertical blank. While the view scrolls, the hidden buffer is being rebuilt for the next scroll step, so people are restored and drawn in the shown buffer during vertical blank, before the first map line, and the rebuilt buffer is flipped in at the scroll step. Each update restores only the bitmap bytes under people at their previous positions in that buffer and draws them at their new positions; apart from the scroll rebuild, the rest of the map is never redrawn.

Acceptance criteria:

  • [R3.1] No flicker or tearing of the dots is visible in VICE at normal speed
  • [R3.2] After 5 minutes of running and scrolling, the map has no leftover light red trails or damaged terrain
  • [R3.3] A people update (restore, draw, flip) completes within one NTSC frame

Capabilities: smooth-animation, raster-interrupts

R4 - New world on SPACE (must)

Pressing SPACE generates and shows a different world, with the 16 people placed on it.

Acceptance criteria:

  • [R4.1] Pressing SPACE replaces the world with a visibly different one
  • [R4.2] People keep moving on the new world

Capabilities: keyboard-input

R5 - Pixel-smooth scrolling (must)

Holding a cursor key scrolls the view across the world one hires pixel per frame in that direction, using the VIC-II fine-scroll registers ($D016, $D011) in the 20-row map area in 38-column mode. Every 8 pixels the view shifts by one cell: the hidden buffer is rebuilt from the world data over the preceding frames and flipped in at the moment the fine scroll wraps. Scrolling stops at the world edges. The status area below the map does not scroll.

Acceptance criteria:

  • [R5.1] Holding a cursor key moves the view smoothly with no jumps, tearing or half-drawn rows
  • [R5.2] The view stops at all four world edges
  • [R5.3] People and terrain stay aligned while scrolling (no dot drifts across terrain)
  • [R5.4] Scrolling across the whole world in each direction never shows wrong or stale cells

Capabilities: keyboard-input, smooth-animation, raster-interrupts

R6 - Status area (must)

Below the 20-row map, five rows of 40-column text in the upper-case ROM font, light red on brown, show: the title, the view position (top-left cell of the view), the number of people in view out of 16, a spare line, and key help. A raster split switches the VIC-II from multicolour bitmap to text at the boundary every frame; the text area never scrolls.

Acceptance criteria:

  • [R6.1] The five status lines appear below the map whenever the map is shown: title, view position, people in view, a spare line and key help
  • [R6.2] The status text and the split line between map and text stay steady (no jitter, flicker or tearing) while people move and while the view scrolls
  • [R6.3] The view position shown matches the view's top-left cell and changes as the view scrolls; the people-in-view count matches the dots visible in the map

Capabilities: raster-interrupts

Design decisions

“Practical default” means the Foundry proposed it and the user accepted it without a specific preference. It can be changed later through AGENTS.md section 6.

Topic Decision Source
Controls Cursor keys scroll the view. On a real C64 these are CRSR down/right, plus SHIFT for up/left; the keyboard matrix is read directly so a key held down scrolls continuously. VICE maps the PC arrow keys to them. SPACE generates a new world. decided by user
Visuals Multicolour bitmap mode (160x200, double-wide pixels) for a 38-column map area 20 cell rows high, smooth-scrolled; below it a raster split to a fixed 5-row, 40-column text status area in the upper-case ROM font, light red on brown. Brown is the shared background colour; light red is the colour-RAM colour in every cell, so people can be drawn anywhere without colour clash and colour RAM never needs scrolling. The two screen-RAM colours of each 4x8 cell come from grey (stone), green (grass and trees), blue (water) and black (roads). The world is stored as one tile byte per 4x8 cell; each tile is drawn from a small set of 8-byte pixel patterns (including edge and corner patterns) so shorelines and roads look natural. decided by user
Sound None in the first release. practical default
Persistence (save/load) None. Maps and seeds are not saved. practical default
File formats None. A single PRG. practical default
Peripherals Keyboard only. No disk access after loading, no joystick. practical default
Timing and memory budgets NTSC: 60 Hz, 17,095 cycles per frame (263 lines x 65 cycles, the NTSC VIC-II 6567R8 that x64sc emulates). Per frame: fine-scroll update, one slice of the hidden-buffer rebuild (about 7,600 bytes of bitmap and screen RAM, 20 map rows plus one partial row, spread over 8 frames), and restoring and redrawing visible people; together under one frame. World data about 4 KB; two bitmap buffers with their screen RAM about 18 KB. World generation may take several seconds. practical default
Memory layout Buffer A in VIC bank 1 and buffer B in VIC bank 2, each with its own 8 KB bitmap and 1 KB screen RAM; flipping switches bank bits in $DD00 during vertical blank. Each bank also holds a 1 KB status text screen (bank + $0400) and a 2 KB copy of the upper-case ROM font (bank + $0800), at the same offsets so a flip still changes only $DD00. Colour RAM is shared and constant (light red), which is also the status text colour. practical default
Rebuild source The hidden buffer is rebuilt from the tile world, never copied from the visible buffer, so people's dots are never copied into the new view. practical default
Seed The seed comes from the CIA timer at start-up and at each SPACE press. It is not shown or saved in the first release. practical default

Required capabilities

  • keyboard-input: Reading keys from the keyboard.
  • smooth-animation: Several objects updated every frame or every few frames in a steady frame-locked loop.
  • raster-interrupts: Cycle-sensitive raster interrupts, raster splits or stable raster timing.

Assumptions

ID Assumption Status
A1 Light red (C64 colour 10) stands in for tan, as the C64 has no tan. confirmed
A2 The map generator keeps every 4x8 cell to at most two of grey, green, blue and black (besides brown). Where three would meet, for example a road along a shoreline next to grass, it changes the least-represented colour in that cell. default
A3 Each buffer has its own bitmap and screen RAM in a separate VIC bank (banks 1 and 2), flipped via $DD00 in vertical blank; colour RAM is shared and constant. unverified
A4 Rebuilding the hidden buffer from tile patterns (about 7,600 bytes) can be spread over 8 frames alongside the people update within the NTSC frame budget, which allows 1 pixel per frame scrolling. unverified
A5 The smoke test cannot read a bitmap. The program writes a status mirror (“LAND MAP 64”, “MAP READY”) into the unused text screen at $0400 once the first view is shown; the smoke test checks that text, and the VICE screenshot shows the map. default
A6 The catalog has no bitmap-graphics capability. Multicolour bitmap mode and VIC bank switching are documented in Mapping the Commodore 64 (53265 $D011, 53270 $D016, 53272 $D018, 56576 $DD00); a catalog update is proposed separately. unverified
A7 Switching from the fine-scrolled multicolour bitmap to fixed text (and back at the top of the frame) with raster interrupts gives a steady split in VICE x64sc NTSC with no bad-line glitches at the boundary, whatever the map's vertical fine-scroll value. unverified

Unresolved decisions

ID Question Default until decided Status
D1 Should stone block people as well as water? Yes: both water and stone block people (agent's reading of “yes block”). open

Powered by TurnKey Linux.