{ "schemaVersion": "1.0", "status": "approved", "approval": { "approvedBy": "example user (Foundry demo)", "approvedOn": "2026-11-26", "notes": "Demo brief produced with the normal interview workflow." }, "interview": { "startedOn": "2026-11-26", "stage": "review", "openQuestions": [], "notes": [ "The user wants a native 80-column utility. The Foundry confirmed it must run in C128 native mode with the 40/80 key down (VDC). A C64-mode or 40-column fallback is out of scope.", "File type and encoding were left to the Foundry. Proposed default: SEQ files in PETSCII with CR line endings, tolerant of LF and CR LF so text copied from a PC also reads correctly." ] }, "project": { "name": "C128 Text Viewer", "slug": "c128-text-viewer", "idea": "A native 80-column C128 utility that opens a sample text file from disk and shows it in a paged view.", "summary": "A small Commodore 128 utility for the 80-column (VDC) screen. It loads a sequential text file from drive 8 into memory and shows it a page at a time. The header shows the file name and page number, and a status line lists the keys. Long lines wrap. Missing files produce a clear message instead of a hang or crash.", "kind": "utility", "smallestUsefulVersion": "Loads the SEQ file SAMPLE from drive 8 and shows it in pages of 23 rows on the 80-column screen. SPACE goes to the next page, B to the previous page, and Q quits. A missing file shows 'FILE NOT FOUND' with the drive status." }, "destination": "../Foundry Projects/c128-text-viewer", "targets": [ { "id": "c128-80", "name": "Commodore 128, native mode, 80-column VDC screen (PAL primary)", "platform": "c128-native", "display": "vdc-80", "video": "pal-ntsc", "expectedBehavior": "Autostarts from the disk image in C128 mode, switches to (or stays on) the 80-column VDC screen and shows the viewer. Starter: title, file line, 'SAMPLE OPENED OK: 6423 BYTES' and drive status '00, ok,00,00' (the drive sends unshifted PETSCII, which the upper/lower-case character set shows in lower case).", "autostart": "disk", "disk": { "name": "textviewer,tv", "format": "d64", "files": [ { "source": "$artifact", "name": "viewer", "type": "prg" }, { "source": "fixtures/sample.txt", "name": "sample", "type": "seq", "convert": "ascii-to-petscii", "lineEndings": "cr" }, { "source": "fixtures/lf-sample.txt", "name": "lfsample", "type": "seq", "convert": "ascii-to-petscii", "lineEndings": "keep" }, { "source": "fixtures/crlf-sample.txt", "name": "crlfsample", "type": "seq", "convert": "ascii-to-petscii", "lineEndings": "keep" } ] } } ], "dualTarget": null, "buildLocation": "windows-cross", "onCommodore": null, "testing": { "emulator": "vice", "realHardware": { "requested": false, "reason": "" } }, "scope": { "firstRelease": "View SEQ text files from drive 8 on the 80-column screen with paging, wrapping, tolerant line-ending handling and clear error messages.", "inScope": [ "SEQ files on drive 8 (1541/1571/1581 or compatible), PETSCII text", "Default file SAMPLE; prompt for another file name", "Paged view of 23 text rows with header and status line on the VDC 80x25 screen", "Next/previous/first/last page and one-line scrolling", "Wrapping of lines longer than 80 characters", "Clear messages for a missing file, a missing drive and files too large to load fully" ], "outOfScope": [ "Editing or saving text", "ASCII-to-PETSCII conversion on the C128 (files must be PETSCII; the host build converts fixtures)", "PRG, USR and REL files, and directories", "40-column mode and C64 mode", "Search, bookmarks, printing" ] }, "requirements": [ { "id": "R1", "title": "Native 80-column display", "priority": "must", "text": "The program runs in C128 native mode and uses the VDC 80x25 text screen. Row 0 is the header (reverse video): program name, file name, and 'PAGE p/n'. Rows 1-23 hold text. Row 24 is the status line with key help.", "acceptance": [ "With VICE x128 -80col, the program appears in the VDC window with 80 usable columns", "Memory location $D7 (MODE) is $80 while the program runs (checked by tools/smoke.ps1)", "The header shows 'PAGE 1/5' for SAMPLE" ], "capabilities": ["vdc-80col", "text-ui"] }, { "id": "R2", "title": "File type and loading", "priority": "must", "text": "The viewer opens a SEQ file by name on drive 8 (open string ',s,r') and loads it into memory, up to 24,000 bytes. Larger files load the first 24,000 bytes and show 'TRUNCATED' in the header. After loading, it reads the drive error channel; any status other than 00 is treated as an error (R7).", "acceptance": [ "SAMPLE (6,423 bytes) loads completely; the starter reports 'SAMPLE OPENED OK: 6423 BYTES'", "A file over 24,000 bytes shows its first 24,000 bytes and 'TRUNCATED' in the header" ], "capabilities": ["disk-seq-io"] }, { "id": "R3", "title": "Encoding", "priority": "must", "text": "Files are PETSCII and are shown with the upper/lower-case character set. Printable bytes ($20-$7F, $A0-$FF) are shown as PETSCII. Other control bytes, except the line endings in R4, are shown as a reverse-video '?'. Byte $09 (tab) expands to spaces up to the next multiple of 8 columns.", "acceptance": [ "SAMPLE line 1 shows 'C128 TEXT VIEWER SAMPLE FILE' in capitals and line 2 shows mixed case exactly as in fixtures/sample.txt", "No colour, cursor or clear-screen control codes take effect while viewing" ], "capabilities": ["text-ui"] }, { "id": "R4", "title": "Line endings", "priority": "must", "text": "CR ($0D) ends a line. LF ($0A) alone also ends a line, and CR followed by LF counts as one line ending. A final line without a line ending is still shown.", "acceptance": [ "SAMPLE (CR), LFSAMPLE (LF) and CRLFSAMPLE (CR LF) each show their lines with no blank rows between them", "LFSAMPLE and CRLFSAMPLE both show exactly 5 lines" ], "capabilities": ["text-ui"] }, { "id": "R5", "title": "Long lines", "priority": "must", "text": "A line longer than 80 characters wraps onto further screen rows at column 80, with no hyphenation or marker. A line of exactly 80 characters uses exactly one row. Pages are counted in screen rows (23 per page), so a wrapped line may continue on the next page.", "acceptance": [ "SAMPLE line 010 (200 characters) occupies 3 rows (80 + 80 + 40) and ends with ''", "SAMPLE line 015 (exactly 80 characters, ending in '|') occupies one row, and line 016 follows directly on the next row", "SAMPLE has 102 screen rows = 5 pages; page 2 starts with 'Line 022:'" ], "capabilities": ["text-ui"] }, { "id": "R6", "title": "Navigation", "priority": "must", "text": "SPACE or F1: next page. B or F3: previous page. HOME: first page. E: last page. CRSR DOWN / CRSR UP: scroll one screen row. Q or RUN/STOP: quit to BASIC with the screen cleared. Keys that would move past the first or last page do nothing.", "acceptance": [ "From page 1, SPACE x4 reaches 'PAGE 5/5', whose last text row is 'Line 100: END OF SAMPLE FILE'; a fifth SPACE changes nothing", "B returns one page; HOME returns to 'PAGE 1/5'; E goes to 'PAGE 5/5'", "CRSR DOWN on page 1 makes 'Stored as ASCII...' (line 2) the first text row", "Q returns to the BASIC READY prompt in 80-column mode" ], "capabilities": ["keyboard-input"] }, { "id": "R7", "title": "Missing file and drive errors", "priority": "must", "text": "If the file does not exist, the viewer shows 'FILE NOT FOUND: ' and the drive status line (for example '62, FILE NOT FOUND,00,00'), then 'PRESS ANY KEY'. Any key returns to the file prompt. If drive 8 does not respond, it shows 'DRIVE 8 NOT RESPONDING'. The program never hangs and never shows a partial page as if it were the file.", "acceptance": [ "Entering the name NOSUCHFILE shows 'FILE NOT FOUND: NOSUCHFILE' and a status starting with '62'", "With no disk attached in VICE, opening SAMPLE shows an error message within 5 seconds instead of hanging" ], "capabilities": ["disk-seq-io"] }, { "id": "R8", "title": "Choosing a file", "priority": "should", "text": "At start the viewer prompts 'FILE NAME (RETURN = SAMPLE):'. The user can type a name of up to 16 characters. RETURN on an empty line opens SAMPLE.", "acceptance": [ "RETURN on its own opens SAMPLE; typing LFSAMPLE opens that file" ], "capabilities": ["keyboard-input"] } ], "design": { "controls": { "value": "Keyboard only: SPACE/F1 next, B/F3 previous, HOME first, E last, CRSR UP/DOWN scroll a row, Q or RUN/STOP quit, RETURN accepts the file name.", "source": "default" }, "visuals": { "value": "VDC 80x25 text. Header row in reverse video, text rows in the default colour, status row in reverse video. Upper/lower-case character set.", "source": "default" }, "sound": { "value": "None.", "source": "n/a" }, "persistence": { "value": "Read-only; nothing is saved.", "source": "n/a" }, "fileFormats": { "value": "Input: Commodore SEQ file, PETSCII, CR line endings (LF and CR LF tolerated), any length up to 24,000 bytes loaded. Fixtures are kept as ASCII in fixtures/ and converted to PETSCII when tools/build.ps1 writes the D64 image.", "source": "default" }, "peripherals": { "value": "Disk drive 8 (1541, 1571 or 1581 compatible). Test disk: build/c128-text-viewer-c128-80.d64 holding VIEWER, SAMPLE, LFSAMPLE and CRLFSAMPLE. 80-column RGBI monitor (VICE: VDC window).", "source": "default" }, "budgets": { "value": "24,000-byte text buffer in bank 0, plus a line index of 2 bytes per screen row (max 1,200 rows). Page redraw under 0.5 s; no frame-rate requirement. Program under 12 KB.", "source": "default" } }, "capabilities": ["vdc-80col", "text-ui", "keyboard-input", "disk-seq-io"], "assumptions": [ { "id": "A1", "text": "cc65's c128 conio writes to the VDC screen after videomode(VIDEOMODE_80COL) and handles the upper/lower-case character set.", "status": "confirmed" }, { "id": "A2", "text": "Users have PETSCII files. ASCII files from a PC show with swapped letter case; this is acceptable for the first release.", "status": "default" }, { "id": "A3", "text": "The VDC has at least 16 KB of RAM (all C128 models). Only the standard text screen and attribute memory are used.", "status": "default" }, { "id": "A4", "text": "VICE x128 with true drive emulation (default) behaves like a real 1541 for the error channel and SEQ reads.", "status": "unverified" } ], "openDecisions": [], "toolchain": { "recipe": "cc65", "language": "c", "recommended": { "recipe": "cc65", "language": "c" }, "reasons": [ "C with cc65 targets C128 native mode directly (cl65 -t c128). Its conio library supports the 80-column VDC screen through videomode(), and the cbm_open/cbm_read library gives SEQ file I/O and the drive error channel.", "A pager has no tight timing: C is fast enough to redraw a page well under half a second, and is much easier to read and change than assembly.", "BASIC 7.0 could print to the 80-column screen. But loading 24 KB with GET# and indexing wrapped lines would be very slow, and paging backwards would need the whole file in memory with string handling." ], "alternatives": [ { "option": "BASIC 7.0", "whyNot": "Byte-by-byte loading and line wrapping in interpreted BASIC would take minutes for a 24 KB file." }, { "option": "6502 assembly (ca65)", "whyNot": "Not needed for speed. It would add effort, and VDC access would have to be written by hand." }, { "option": "C + assembly", "whyNot": "No subsystem needs assembly. A fast VDC block-copy routine can be added later if page redraw proves slow." } ], "override": null, "assumptionsToVerify": [ "A4: Compare the missing-file status and SEQ reading in VICE with a real C128 + 1571 if hardware becomes available.", "Page redraw time with conio on the VDC stays under 0.5 s (measure in M1)." ] }, "starter": { "screenTitle": "C128 TEXT VIEWER - 80 COLUMNS", "expectedScreen": "On the 80-column (VDC) screen. Row 0: 'C128 TEXT VIEWER - 80 COLUMNS'. Row 1: 'FILE: SAMPLE (SEQ, PETSCII, CR LINE ENDINGS, DRIVE 8)'. Row 2: 'SAMPLE OPENED OK: 6423 BYTES'. Row 3: 'DRIVE STATUS: 00, ok,00,00' (lower-case 'ok' is how the upper/lower-case set shows the drive's reply). Row 5: the starter key help.", "smokeChecks": [ { "row": 0, "col": 0, "text": "C128 TEXT VIEWER - 80 COLUMNS", "description": "Title on VDC row 0" }, { "row": 2, "col": 0, "text": "SAMPLE OPENED OK: 6423 BYTES", "description": "SAMPLE loaded from disk, full size (VDC row 2)" }, { "row": 3, "col": 0, "text": "DRIVE STATUS: 00, ok,00,00", "description": "Drive reports no error (VDC row 3)" } ], "filesDir": "files", "requirements": ["R2"] }, "milestones": [ { "id": "M1", "title": "Load SAMPLE and show the first pages", "goal": "SAMPLE is loaded into memory and shown page by page, with correct encoding, line endings and wrapping, and an automated check confirms page 1 on the 80-column screen.", "tasks": [ { "id": "M1.1", "text": "Load the named SEQ file into a 24,000-byte buffer, read the error channel, and keep the byte count and truncation flag.", "requirements": ["R2"], "outcome": "VIEWER loads SAMPLE into memory (starter screen shows the same byte count)", "check": "tools/smoke.ps1 passes; MT1.1" }, { "id": "M1.2", "text": "Build a screen-row index: handle CR/LF/CR LF line endings and wrap at 80 columns. Render a page of 23 rows with the R3 control-code rules.", "requirements": ["R3", "R4", "R5"], "outcome": "VIEWER draws page 1 of SAMPLE", "check": "MT1.2 and MT1.3" }, { "id": "M1.3", "text": "Header (file, PAGE p/n, TRUNCATED) and status line. Update starter.smokeChecks and the c128-80 smoke checks in project.json so the automated test verifies page 1: header row 0 contains 'PAGE 1/5' and text row 1 is 'C128 TEXT VIEWER SAMPLE FILE'.", "requirements": ["R1", "R3"], "outcome": "VIEWER shows the full page layout; the smoke test checks the loaded page on the VDC", "check": "tools/smoke.ps1 passes with the new checks; MT1.2" } ], "manualTests": [ { "id": "MT1.1", "title": "Load SAMPLE", "target": "c128-80", "setup": "pwsh -File tools/build.ps1 (creates the D64 with VIEWER, SAMPLE, LFSAMPLE, CRLFSAMPLE).", "steps": ["pwsh -File tools/run.ps1 -Target c128-80", "Look at the VDC (80-column) window."], "expected": ["Within about 5 seconds of autostart the viewer appears in the VDC window, not the VIC-II window", "No error message; the header names SAMPLE"], "requirements": ["R1", "R2"] }, { "id": "MT1.2", "title": "Page 1 content and layout", "target": "c128-80", "setup": "Viewer showing SAMPLE page 1.", "steps": ["Read the header, the first three text rows and the status line.", "Find line 010 and line 015."], "expected": ["Header: file SAMPLE, 'PAGE 1/5'", "Text row 1: 'C128 TEXT VIEWER SAMPLE FILE'; row 2: 'Stored as ASCII in the repo; ...' in mixed case; row 3 blank", "Line 010 fills two full rows and part of a third, ending ''", "Line 015 fills exactly one row ending in '|', followed directly by 'Line 016:'"], "requirements": ["R1", "R3", "R5"] }, { "id": "MT1.3", "title": "Line-ending tolerance", "target": "c128-80", "setup": "Temporarily change the default file to LFSAMPLE, then CRLFSAMPLE (or use the prompt once R8 is done).", "steps": ["View LFSAMPLE.", "View CRLFSAMPLE."], "expected": ["Each shows exactly 5 lines, 'LINE ENDING TEST' to 'Line 5: END', with no blank rows between them"], "requirements": ["R4"] } ] }, { "id": "M2", "title": "Navigation", "goal": "All navigation keys work, with correct limits at the first and last page.", "tasks": [ { "id": "M2.1", "text": "Next/previous/first/last page and quit keys.", "requirements": ["R6"], "outcome": "VIEWER pages through SAMPLE", "check": "MT2.1" }, { "id": "M2.2", "text": "One-row scrolling with CRSR UP/DOWN.", "requirements": ["R6"], "outcome": "VIEWER scrolls by one row", "check": "MT2.2" }, { "id": "M2.3", "text": "Automated navigation check: extend tools/smoke.ps1 with an optional per-target key sequence (VICE -keybuf) and a second ready point after the keys are handled, then check that page 2 starts with 'Line 022:'.", "requirements": ["R5", "R6"], "outcome": "tools/smoke.ps1 verifies paging without a person", "check": "tools/smoke.ps1 passes, including the page-2 check" } ], "manualTests": [ { "id": "MT2.1", "title": "Paging", "target": "c128-80", "setup": "Viewer showing SAMPLE page 1.", "steps": ["Press SPACE four times.", "Press SPACE once more.", "Press B, then HOME, then E.", "Press Q."], "expected": ["After 4 x SPACE: 'PAGE 5/5', last text row 'Line 100: END OF SAMPLE FILE'", "The extra SPACE changes nothing", "B -> PAGE 4/5, HOME -> PAGE 1/5, E -> PAGE 5/5", "Q: screen clears to the BASIC READY prompt, still in 80 columns"], "requirements": ["R6"] }, { "id": "MT2.2", "title": "Scrolling", "target": "c128-80", "setup": "Viewer on page 1.", "steps": ["Press CRSR DOWN once.", "Press CRSR UP once."], "expected": ["First text row becomes 'Stored as ASCII in the repo; ...'", "Back to 'C128 TEXT VIEWER SAMPLE FILE'"], "requirements": ["R6"] } ] }, { "id": "M3", "title": "File prompt and errors", "goal": "Choose a file by name and get clear, non-hanging errors.", "tasks": [ { "id": "M3.1", "text": "File-name prompt with SAMPLE as the default.", "requirements": ["R8"], "outcome": "VIEWER asks for a file name", "check": "MT3.1" }, { "id": "M3.2", "text": "Missing-file and missing-drive handling, returning to the prompt. Add a test fixture over 24,000 bytes and show TRUNCATED.", "requirements": ["R7", "R2"], "outcome": "VIEWER reports errors and truncation", "check": "MT3.2, MT3.3 and MT3.4" } ], "manualTests": [ { "id": "MT3.1", "title": "Choose a file", "target": "c128-80", "setup": "Viewer at the file prompt.", "steps": ["Press RETURN.", "Quit, run again, type LFSAMPLE and press RETURN."], "expected": ["RETURN opens SAMPLE", "LFSAMPLE opens and shows 5 lines"], "requirements": ["R8"] }, { "id": "MT3.2", "title": "Missing file", "target": "c128-80", "setup": "Viewer at the file prompt.", "steps": ["Type NOSUCHFILE and press RETURN.", "Press any key."], "expected": ["'FILE NOT FOUND: NOSUCHFILE' with a drive status starting '62'", "Back at the file prompt; no hang"], "requirements": ["R7"] }, { "id": "MT3.3", "title": "No disk", "target": "c128-80", "setup": "In VICE, start the viewer, then detach the disk (File > Detach disk image > Drive 8).", "steps": ["Open SAMPLE."], "expected": ["An error message within 5 seconds; no hang"], "requirements": ["R7"] }, { "id": "MT3.4", "title": "Large file", "target": "c128-80", "setup": "Disk image with the large fixture added in M3.2.", "steps": ["Open the large file."], "expected": ["Header shows TRUNCATED; paging works up to the end of the first 24,000 bytes"], "requirements": ["R2"] } ] } ] }