Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

23KB

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.
  • 2026-12-03: A4 status recorded from the M3.4 measurement as partly met; the user accepted the occasional one-frame scroll pause.
  • 2026-12-03: Background (land, border and status area) changed from brown (colour 9) to light brown: C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette (new assumption A8). Tree trunks stay colour 9.
  • 2026-12-03: Terrain all over the world (“the different land spaces need to be all over the map, not just here and there”): R1 reworded; new criteria R1.5 (every view shows at least three terrain kinds) and R1.6 (each world rolls its own random terrain mix). Roads stay a grid and cross water on bridges. New milestone M4.
  • 2026-12-03: Worn paths instead of roads (“keep track of where the people walk and when the counter hits 128 then it is a path/road but the number can be reduced by one every certain number of cycles”; “remove their creation”): the generator makes no roads (R1 text, R1.2, R1.3); new R7 worn paths (dark brown patches, appear at 128, fade below 64, counts go down by one every 60 seconds, all chosen by the user); new milestone M5.
  • 2026-12-03: People's attributes (“now we need to give each person attributes like D&D”): new R8. Each person has six scores (strength, dexterity, constitution, intelligence, wisdom, charisma), rolled 3d6 when a world is made and stored one byte each; shown only, they do not change behaviour. P (a letter key, chosen by the user instead of Tab, which the C64 does not have) steps through the people; status line 4 (the spare line, R6) shows the chosen person's number and scores, and that person's dot blinks on the map. New milestone M6.
  • 2026-12-04: Status area shows only the chosen person, who also gets a name and a sex (“we dont need land map 64 text, view, or people in view or the directions on how to move the screen or new world or person; we do want the person's attributes; also every person needs a random name and needs to be male or female”): the title, view position, people-in-view count and key help are removed from the status area (R6); the keys all still work. R8 adds a random sex (50/50, shown as M or F) and a random name of 2-3 syllables from male or female syllable lists (up to 10 letters); line 1 shows number, name and sex, line 2 the scores, lines 3-5 are blank (layout chosen by the user). New task M6.2.
  • 2026-12-04: A changing number of people (“if I make the people count 32 it messes up memory location and attributes dont show correctly”; “# of people can be dynamic so the memory needs to place in a way that it can expand or contract”): R2 now has 1-255 people, 16 in a new world; + adds a person and - removes the last one while the program runs (keys, maximum and change-while-running chosen by the user). The people's tables move to one 256-byte page per field in free RAM inside the video banks. R3: people are drawn only into the hidden buffer and flipped in; with many people the main loop may take more than a frame, and then the picture (and the scroll) updates less often while every person keeps walking at the same speed (“keep speed, drop frames”, chosen by the user). R8: status line 1 shows P001/016: the person's number and the number of people. New milestone M7.

Summary

A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people at first (1-255, + and - change the number), drawn as white dots, wander the world but are blocked by water and stone. Where they walk often they wear dark brown paths into the land, which fade again when they are no longer used. 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 white people moving over land, grass, trees and paths (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 showing the chosen person, 16 moving people (1-255 with + and -) 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: light brown land (background), grey stone, green grass and trees, blue water, dark brown paths worn in by the people
  • 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 white dots (one multicolour pixel each), spread over the world, blocked by water and stone; only those in view are drawn (since M7: 1-255 people, + and - while running)
  • 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: the chosen person's number, name, sex and scores
  • A random name, a sex (M or F) and six D&D-style scores (3d6 each) per person, shown one person at a time; P picks the next person, whose dot blinks
  • NTSC timing

Out of scope

  • PAL support
  • Worlds larger than 2x2 screens
  • Sprites for people
  • People with goals, pathfinding or interaction; scores that change how people behave
  • 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): light brown land, grey stone, green grass and trees, blue water, with the chosen person's name, sex and scores in the text area below it. White dots move on the land and wear paths into it. 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. Terrain covers the whole world: lakes, meadows with trees, rocky outcrops and open light brown land are spread all over it, not gathered in a few places. Each world rolls its own mix of the four terrain kinds (land, grass and trees, water, stone), so one world may be wet and another rocky. No roads are generated: paths appear where the people walk (R7). 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 four terrain colours: light brown, grey, green and blue
  • [R1.3] The generated world has no roads: only land, grass and trees, stone and water (paths are worn in later, R7)
  • [R1.4] No colour clash: every 4x8 cell shows only its intended colours
  • [R1.5] Every 40x20-cell view of the world shows at least three of the four terrain kinds (land, grass and trees, water, stone), each covering at least 8 cells
  • [R1.6] Different worlds have different terrain mixes: over several SPACE presses, some worlds are visibly wetter, rockier or greener than others

Capabilities: smooth-animation

R2 - Moving people, 1 to 255 (must)

A new world starts with 16 people, each a single white multicolour pixel, spread over the world; they move on their own. Water and stone block them: they walk only on land, grass, trees and paths. People inside the view are drawn; others keep moving unseen. While the program runs, + adds a person (a new name, sex and scores, on a random walkable spot) and - removes the last one; there are always 1 to 255 people. Held, + and - repeat. Each person steps every 8 frames however many people there are; with many people the picture updates less often instead (R3).

Acceptance criteria:

  • [R2.1] Scrolling around a new world shows 16 white dots in total
  • [R2.2] Each visible dot moves at least once per second, also with 255 people
  • [R2.3] No dot ever enters a blue (water) or grey (stone) pixel
  • [R2.4] + adds one person (up to 255) and - removes the last one (down to 1); held, they repeat; the status line shows the new number of people (R8.2) and the new person's dot appears and moves

Capabilities: smooth-animation

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

People are drawn only into the hidden bitmap buffer, never into the shown one, and the hidden buffer is flipped into view during vertical blank. While the view scrolls, the hidden buffer is rebuilt for the next scroll step; once it is complete the people are drawn into it, and it 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 and changed path cells, the rest of the map is never redrawn. (Since M7; before, people were drawn into the shown buffer during vertical blank while a rebuild ran, which does not scale beyond about 16 people.) With up to about 64 people every frame is a new picture; with more, the main loop takes longer than a frame and the picture and the scroll update every 2nd to 4th frame, while people keep their walking speed.

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 white trails or damaged terrain
  • [R3.3] With 16 people a people update (restore, draw, flip) completes within one NTSC frame; with more people the vertical blank work still ends before the first map line, and people keep their speed

Capabilities: smooth-animation, raster-interrupts

R4 - New world on SPACE (must)

Pressing SPACE generates and shows a different world, with 16 people placed on it (however many there were before).

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, white on light brown. Since M6.2 they show only the chosen person (R8): line 1 their number, name and sex, line 2 their six scores; lines 3-5 are blank. (Before M6.2 they showed the title, the view position, the number of people in view, the scores and key help; the user removed those.) 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 status lines appear below the map whenever the map is shown: line 1 the chosen person's number, name and M or F, line 2 their six scores (R8)
  • [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] Lines 3-5 are blank: no title, view position, people-in-view count or key help is shown

Capabilities: raster-interrupts

R7 - Worn paths (must)

Every cell of the world keeps a walk count. Each time a person steps into a cell its count goes up by one; every 60 seconds every count goes down by one. A land, grass or tree cell whose count reaches 128 becomes a path: a worn, dark brown patch. A path whose count falls below 64 turns back into the terrain it was. People walk on paths like on land. The counts and paths belong to the world: SPACE starts again with no paths.

Acceptance criteria:

  • [R7.1] Each time a person steps into a cell, that cell's walk count goes up by one (it stops at 255)
  • [R7.2] Every 60 seconds every walk count goes down by one (it stops at 0)
  • [R7.3] A land, grass or tree cell whose count reaches 128 becomes a dark brown path cell; the change appears in the map without flicker, tearing, trails or wrong pixels, also while the view scrolls and while people stand on it
  • [R7.4] A path cell whose count falls below 64 turns back into the land, grass or trees it was
  • [R7.5] People walk on paths; water and stone never become paths; SPACE gives a new world with all counts at 0 and no paths

Capabilities: smooth-animation

R8 - People's attributes (must)

Each person is male or female (at random, 50/50) and has a random name of two or three syllables from a male or female syllable list (up to 10 letters), and six scores, as in D&D: strength, dexterity, constitution, intelligence, wisdom and charisma. Each score is rolled with three six-sided dice (3-18) when a world is made, and stored as one byte. For now the scores are only shown; they do not change how people move. The status lines show one person at a time: P001/016 ALDRIC M (person number / number of people, since M7) and STR12 DEX09 CON15 INT10 WIS08 CHA13. Each press of P shows the next person (after the last comes 1); holding P does not repeat. If the shown person is removed with -, the new last person is shown. The chosen person's dot blinks on the map (left out for 16 of every 32 frames) so it can be found. SPACE rolls new names, sexes and scores for the new world and shows person 1.

Acceptance criteria:

  • [R8.1] Every person has six scores from 3 to 18, rolled 3d6 when a world is made; SPACE rolls new ones
  • [R8.2] Status line 1 shows the chosen person's number and the number of people (P001/016), name and M or F; line 2 their six scores, labelled STR, DEX, CON, INT, WIS and CHA; person 1 is shown after a new world
  • [R8.3] Each press of P shows the next person, after the last comes 1; a held P counts once
  • [R8.4] The chosen person's dot blinks about twice a second, wherever they are in the view, without disturbing the map or the other dots
  • [R8.5] The scores do not change how people move
  • [R8.6] Every person is male or female at random and has a random name of 2-3 syllables (up to 10 letters) from the male or female syllable list; SPACE gives new ones

Capabilities: keyboard-input

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. P shows the next person's scores (R8; a letter key, chosen by the user: the C64 has no Tab key). + adds a person and - removes the last one (R2, M7; held, they repeat after half a second, about 12 times a second). Known limitation (accepted by the user, 2026-12-03): SHIFT applies to both cursor keys, so only the Right + Down and Left + Up diagonals work; Up + Right and Down + Left come out as Up + Left (VICE sends the PC Up and Left arrows as SHIFT + CRSR). 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, white on light brown. Light brown (C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette) is the shared background colour; white 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 dark brown (paths). 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 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 with up to about 64 people (measured in M7: 128 people take 2 frames per main-loop pass, 255 take 4; people keep their speed, M7). World data about 4 KB; two bitmap buffers with their screen RAM about 18 KB. World generation may take several seconds (since M4.1 about 4 seconds, behind the generating message; the map is ready about 7 seconds after power-on). 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 (white), which is also the status text colour. Program, tables and variables (world tiles) lie below $4000; the 4,000 walk counts (R7) use the free RAM at $C000-$CF9F. The people's tables (since M7) are one 256-byte page per field, indexed by person 0-254, in the RAM the video banks leave free: positions $4C00-$4FFF, direction, sex and the six scores $5800-$5FFF, the saved bytes under the dots of both buffers $8C00-$91FF, and the ten name letters $9200-$9BFF (the VIC sees the character ROM at $9000-$9FFF in bank 2, so the CPU RAM there is free). 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. Since M4.1 the rebuild first puts back the bytes under the buffer's own people and then skips every cell whose tile is already drawn there (most cells, as terrain comes in areas), so textured terrain everywhere still rebuilds within 8 frames. 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 People and status text are white (C64 colour 1) so the dots stand out (changed from light red, colour 10, by the user on 2026-12-03). confirmed
A2 The map generator keeps every 4x8 cell to at most two of grey, green, blue and black (besides the light brown background). 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. partly met (measured 2026-12-03 in VICE x64sc NTSC, accepted by the user): since M4.1 the rebuild skips cells already drawn; in the long tour 99% of rebuilds take 6-8 frames, 13 of 1,928 take 9 or more, pausing the scroll for one frame in 0.8% of scrolling frames (M3.4, before terrain everywhere: 1.7%); not noticeable in use
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
A8 C64 colour 8 looks light brown in VICE with the pepto-pal palette, which tools/run.ps1 selects. With VICE's default NTSC colours it looks salmon-orange, and on real hardware it depends on the machine and TV. default

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.