Explorar el Código

M0.1: game glyphs at screen codes 128+ so conio text stays readable

cc65 conio writes capital letters as screen codes 65-90, which collided
with the game glyphs at 64-69. Copy ROM codes 0-127 from the lower/upper-case
set and move the glyphs to 128-133. Spec Visuals decision and project.json
updated to match (approved by user). M0 smoke passes; manual check pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Daniel Covington hace 1 semana
padre
commit
6377e896de
Se han modificado 6 ficheros con 38 adiciones y 26 borrados
  1. +1
    -1
      docs/spec.md
  2. +2
    -1
      docs/verification-status.md
  3. +1
    -1
      project.json
  4. +19
    -13
      src/charset.c
  5. +13
    -8
      src/charset.h
  6. +2
    -2
      src/main.c

+ 1
- 1
docs/spec.md Ver fichero

@@ -177,7 +177,7 @@ Capabilities: text-ui
| Topic | Decision | Source |
|---|---|---|
| Controls | Commodore 1351 mouse in control port 1 (proportional mode): a sprite pointer, the dig cursor is the tile under the pointer, the left button marks/unmarks, the pointer at a view edge scrolls the map. Joystick in port 2: move the cursor, fire marks/unmarks. Keyboard: cursor keys or W/A/S/D move, D marks/unmarks, SPACE pauses/resumes. All three can be used together. | decided by user |
| Visuals | Character mode with an original custom character set at $3800 (VIC bank 0, screen at $0400): codes 0-63 copied from the uppercase ROM set so text stays readable, codes 64+ hold the game's own glyphs (soft rock, hard rock, floor, marked rock, dwarf, cursor). Colours: rock brown, hard rock grey, floor dark grey, marked rock yellow, dwarves orange, cursor white, on a black background. The mouse pointer is hardware sprite 0. | decided by user |
| Visuals | Character mode with an original custom character set at $3800 (VIC bank 0, screen at $0400): codes 0-127 copied from the lower/upper-case ROM set so conio text (capital letters at screen codes 65-90) stays readable, codes 128+ hold the game's own glyphs (soft rock, hard rock, floor, marked rock, dwarf, cursor). Colours: rock brown, hard rock grey, floor dark grey, marked rock yellow, dwarves orange, cursor white, on a black background. The mouse pointer is hardware sprite 0. | decided by user |
| Sound | SID effects only: a mark/unmark click and a pick strike while mining. No music. | decided by user |
| Persistence (save/load) | None. Nothing is saved in the first release. | not applicable |
| File formats | None. A single PRG. | not applicable |


+ 2
- 1
docs/verification-status.md Ver fichero

@@ -8,7 +8,7 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n

| Item | Automated check | Manual verification by user |
|---|---|---|
| M0.1 Run tools/check-prereqs.ps1, then tools/smoke.ps1 for every target. | not run | pending |
| M0.1 Run tools/check-prereqs.ps1, then tools/smoke.ps1 for every target. | passed (2026-11-26, `pwsh -File tools/check-prereqs.ps1` exit 0; `pwsh -File tools/build.ps1` exit 0; `pwsh -File tools/smoke.ps1` exit 0, [PASS] c64, 4/4 checks). Run on the working tree including the uncommitted src/charset.c/.h edit (glyphs at codes 128+), see Notes. | pending |
| M1.1 Settle the memory map (A3): where the 16 KB map, the charset and the program live. Add a check that fails the build or shows an error if they overlap. | not run | pending |
| M1.2 Map generator in C: seeded PRNG, soft rock, hard-rock veins, caverns, starting cave near the centre. Show the seed on row 24. | not run | pending |
| M1.3 Assembly view redraw (draw_view(x, y), C prototype) copying a 40x23 window of the map to screen and colour RAM via a tile-to-glyph/colour table. | not run | pending |
@@ -22,4 +22,5 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n

## Notes

- 2026-11-26, open question (spec vs code): cc65 conio writes capital letters as screen codes 65-90. The spec's Visuals decision (codes 0-63 from the uppercase ROM, game glyphs at 64+) would put glyphs on the letters A-E and blank F-Z. The uncommitted working-tree edit to src/charset.c/.h copies ROM codes 0-127 from the lower/upper-case set and puts the game glyphs at 128-133. The M0 smoke run and screenshot used that edit. The user approved the change on 2026-11-26; docs/spec.md (Visuals), project.json and the src/main.c header now describe codes 0-127 = ROM lower/upper-case set, 128+ = game glyphs. Build and smoke re-run after the doc update (see M0.1).
- Generated 2026-11-26. Starter verification at generation time is reported by the Foundry; re-run `pwsh -File tools/smoke.ps1` on your machine and record the result in row M0.1.

+ 1
- 1
project.json Ver fichero

@@ -215,7 +215,7 @@
"source": "user"
},
"visuals": {
"value": "Character mode with an original custom character set at $3800 (VIC bank 0, screen at $0400): codes 0-63 copied from the uppercase ROM set so text stays readable, codes 64+ hold the game's own glyphs (soft rock, hard rock, floor, marked rock, dwarf, cursor). Colours: rock brown, hard rock grey, floor dark grey, marked rock yellow, dwarves orange, cursor white, on a black background. The mouse pointer is hardware sprite 0.",
"value": "Character mode with an original custom character set at $3800 (VIC bank 0, screen at $0400): codes 0-127 copied from the lower/upper-case ROM set so conio text (capital letters at screen codes 65-90) stays readable, codes 128+ hold the game's own glyphs (soft rock, hard rock, floor, marked rock, dwarf, cursor). Colours: rock brown, hard rock grey, floor dark grey, marked rock yellow, dwarves orange, cursor white, on a black background. The mouse pointer is hardware sprite 0.",
"source": "user"
},
"sound": {


+ 19
- 13
src/charset.c Ver fichero

@@ -3,25 +3,27 @@
#include <c64.h>
#include "charset.h"

#define CPU_PORT (*(unsigned char *)0x01)
#define CHARROM ((const unsigned char *)0xD000)
#define CPU_PORT (*(unsigned char *)0x01)
#define CHARROM_MIX ((const unsigned char *)0xD800) /* lower/upper-case ROM set */

/* Original game glyphs, 8 bytes each, in screen-code order starting at GLYPH_ROCK_SOFT. */
static const unsigned char glyphs[] = {
/* 64 soft rock: rough solid block */
/* soft rock: rough solid block */
0xFF, 0xDD, 0xFF, 0x77, 0xFF, 0xDD, 0xFF, 0x77,
/* 65 hard rock: dense crosshatch */
/* hard rock: dense crosshatch */
0xFF, 0x99, 0xFF, 0x66, 0xFF, 0x99, 0xFF, 0x66,
/* 66 floor: sparse pebbles */
/* floor: sparse pebbles */
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00,
/* 67 marked rock: framed X */
/* marked rock: framed X */
0xFF, 0xC3, 0xA5, 0x99, 0x99, 0xA5, 0xC3, 0xFF,
/* 68 dwarf: hooded figure */
/* dwarf: hooded figure */
0x18, 0x3C, 0x18, 0x7E, 0x5A, 0x18, 0x24, 0x66,
/* 69 cursor: corner brackets */
/* cursor: corner brackets */
0xE7, 0x81, 0x81, 0x00, 0x00, 0x81, 0x81, 0xE7
};

static unsigned char saved_vic_addr;

void charset_install(void)
{
unsigned char *dst = (unsigned char *)CHARSET_ADDR;
@@ -30,12 +32,13 @@ void charset_install(void)

memset(dst, 0, 2048);

/* Map the character ROM in at $D000 (clear CHAREN) to copy codes 0-63. */
/* Map the character ROM in at $D000 (clear CHAREN) and copy codes 0-127
** of the lower/upper-case set, so conio text keeps its normal shapes. */
__asm__("sei");
old_port = CPU_PORT;
CPU_PORT = (unsigned char)(old_port & 0xFB);
for (i = 0; i < 64u * 8u; ++i) {
dst[i] = CHARROM[i];
for (i = 0; i < 128u * 8u; ++i) {
dst[i] = CHARROM_MIX[i];
}
CPU_PORT = old_port;
__asm__("cli");
@@ -43,10 +46,13 @@ void charset_install(void)
memcpy(dst + GLYPH_ROCK_SOFT * 8u, glyphs, sizeof glyphs);

/* Screen at $0400 (upper nibble 1), charset at $3800 (bits 1-3 = 7). */
VIC.addr = 0x1E;
saved_vic_addr = VIC.addr;
VIC.addr = (unsigned char)((saved_vic_addr & 0xF0) | 0x0E);
}

void charset_remove(void)
{
VIC.addr = 0x15; /* screen $0400, ROM uppercase set */
if (saved_vic_addr != 0) {
VIC.addr = saved_vic_addr;
}
}

+ 13
- 8
src/charset.h Ver fichero

@@ -4,18 +4,23 @@
/* Custom character set location (VIC bank 0, 2 KB). See docs and assumption A3. */
#define CHARSET_ADDR 0x3800u

/* Game glyph screen codes (codes 0-63 keep the ROM letter shapes). */
#define GLYPH_ROCK_SOFT 64
#define GLYPH_ROCK_HARD 65
#define GLYPH_FLOOR 66
#define GLYPH_MARKED 67
#define GLYPH_DWARF 68
#define GLYPH_CURSOR 69
/* Game glyph screen codes.
** cc65 runs the C64 in the lower/upper-case character set, where conio puts
** capital letters at screen codes 65-90. Codes 0-127 therefore keep the ROM
** lower/upper-case shapes, and the game's own glyphs live at 128 and up.
** (Codes 128-255 are the reverse-video copies in ROM; this game does not use revers().)
*/
#define GLYPH_ROCK_SOFT 128
#define GLYPH_ROCK_HARD 129
#define GLYPH_FLOOR 130
#define GLYPH_MARKED 131
#define GLYPH_DWARF 132
#define GLYPH_CURSOR 133

/* Build the charset at CHARSET_ADDR and point the VIC-II at it. */
void charset_install(void);

/* Point the VIC-II back at the ROM uppercase set. */
/* Point the VIC-II back at the character set that was active before charset_install(). */
void charset_remove(void);

#endif

+ 2
- 2
src/main.c Ver fichero

@@ -5,8 +5,8 @@
** (wait_frame() from frame.s) with a visible frame counter.
**
** Character set layout:
** codes 0-63 copied from the uppercase ROM set (letters, digits, punctuation)
** codes 64-69 game glyphs (see charset.h)
** codes 0-127 copied from the lower/upper-case ROM set (conio puts capitals at 65-90)
** codes 128-133 game glyphs (see charset.h)
**
** Screen layout (40x25 text, VIC-II):
** row 0 title


Cargando…
Cancelar
Guardar

Powered by TurnKey Linux.