diff --git a/docs/manual-tests.md b/docs/manual-tests.md index f430a33..3f50b28 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -62,6 +62,23 @@ Expected: Verifies: R3 +### MT1.3: View redraw within one frame (c64) + +Setup: VICE x64sc, once with PAL and once with NTSC. +Start: `pwsh -File tools/run.ps1 -Target c64 -Define VIEW_TIMING`, then `pwsh -File tools/run.ps1 -Target c64 -Define VIEW_TIMING -Video ntsc` + +Steps: +1. Wait for the map to appear and watch the border. +2. Close VICE and run `pwsh -File tools/build.ps1` so the normal build is back in build/. + +Expected: +- The border shows a red band. It starts in the bottom border, continues through the top border and ends partway down the screen (PAL: about the middle of the screen; NTSC: just above the status line). Below it the border is black down to the bottom border. +- The border is never red all the way round (that would mean a redraw takes more than one frame) +- In this timing build the dwarves may flicker, because the view is redrawn over them every frame. The normal build does not do that. +- Automated equivalent: `pwsh -File tools/smoke.ps1 -Video ntsc` passes the 'Full view redraw fits in one frame' check + +Verifies: R3.3 + ## M2 - Designation by keyboard, joystick and mouse ### MT2.1: Mark by keyboard and joystick (c64) diff --git a/docs/memory-map.md b/docs/memory-map.md index e391dfe..eb42b48 100644 --- a/docs/memory-map.md +++ b/docs/memory-map.md @@ -28,12 +28,42 @@ these areas. `tools/build.ps1` passes it to cl65 (`resolved.targets[0].build.con `#pragma bss-name (pop)`. `src/map.c` and `src/charset.c` show how. - At run time `main()` checks that `charset` is at `CHARSET_ADDR` (charset.h), that `map` is at `MAP_ADDR` (map.h) and that BSS ends below the charset. If any check fails it shows - `MEMORY CLASH` instead of `CHARSET OK`. This catches a linker config that has drifted from the + `MEMORY CLASH` on row 1 instead of the map, and the smoke test's `layout_ok` check fails. This catches a linker config that has drifted from the headers. - cc65's startup puts the top of the C stack at the end of MAIN ($3800), so the stack and any heap stay below the charset. The game does not use `malloc`. -- Size at M1.1: the program ends at $1702 (about 3.8 KB). That leaves about 6 KB of room below the - stack. +- Size at M1.3: the program ends at $1FC6 (about 6 KB, see build/stonehold-64.map). That leaves + about 4 KB of room below the stack. + +## Tile byte encoding + +Each map byte is also the screen code it is drawn with, and its low nibble is its colour. +Colour RAM keeps only the low 4 bits, so `draw_view` (src/view.s) copies the byte to both +screen RAM and colour RAM. That costs 14 cycles per tile, about 14,900 cycles per full +redraw. Changed in M1.3 with user approval: a glyph/colour lookup table measured 22,754 (PAL) / +23,177 (NTSC) cycles, over one frame. + +| Bits | Meaning | +|---|---| +| 7 | always 1: game glyphs live at codes 128-255 | +| 6 | claimed by a dwarf | +| 5-4 | type: 00 floor, 01 soft rock, 10 hard rock | +| 3-0 | colour: the type's colour, or 7 (yellow) when marked for digging | + +| Code | Tile | Colour | +|---|---|---| +| $8B | floor | 11 dark grey | +| $99 | soft rock | 9 brown | +| $AC | hard rock | 12 grey | +| $97 / $A7 | marked soft / hard rock | 7 yellow | +| $D7 / $E7 | marked and claimed soft / hard rock | 7 yellow | +| $88 | dwarf (drawn over the map, not stored in it) | 8 orange | +| $81 | cursor (drawn over the map, not stored in it) | 1 white | + +Use the macros in src/map.h (`TILE_IS_ROCK`, `TILE_IS_MARKED`, `TILE_MARK`, `TILE_UNMARK`) +instead of testing bits by hand. A new tile state needs a code whose low nibble is its colour, +and a glyph at that code in src/charset.c. charset.c has compile-time checks that keep the +codes and the spec's colours in step. ## If MAIN fills up diff --git a/docs/milestones.md b/docs/milestones.md index 0386228..60c9579 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -25,7 +25,7 @@ Requirements: R1, R2, R3, R7 |---|---|---|---|---| | 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. | R1, R2 | Documented memory map in docs/ and a PRG that still passes the smoke test | build/stonehold-64.map shows no overlap; smoke test passes | | 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. | R2 | PRG that generates a map and shows 'SEED nnnnn' | Manual test MT1.1 | -| 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. | R3 | PRG with a full-view redraw inside one frame | Border-colour timing bar ends before the bottom of the screen on PAL and NTSC | +| M1.3 | Assembly view redraw (draw_view(x, y), C prototype) copying a 40x23 window of the map to screen and colour RAM. Each map byte is its own screen code with its colour in the low nibble (changed from a tile-to-glyph/colour table with user approval on 2026-11-26: the table version measured 22,754 PAL / 23,177 NTSC cycles, over one frame). | R3 | PRG with a full-view redraw inside one frame | Border-colour timing bar ends before the bottom of the screen on PAL and NTSC (manual test MT1.3); smoke check view_fast on PAL and NTSC | | M1.4 | Keyboard cursor (cursor keys and W/A/S/D) with edge scrolling and map-border clamping. Status line: 'STONE 000 SEED nnnnn RUN'. | R3, R7 | PRG in which the cursor moves and the view scrolls | Manual test MT1.2 | Manual verification: see docs/manual-tests.md section M1. diff --git a/docs/toolchain.md b/docs/toolchain.md index 0e529c9..85adb1a 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -43,7 +43,8 @@ Check them with `pwsh -File tools/check-prereqs.ps1`. Lookup order for each tool | Build one target | `pwsh -File tools/build.ps1 -Target ` | | Build with a fixed map seed | `pwsh -File tools/build.ps1 -Define FIXED_SEED=12345` (`tools/run.ps1` takes `-Define` too) | | Run in VICE | `pwsh -File tools/run.ps1 -Target ` (add `-Video ntsc` to try NTSC) | -| Automated smoke test | `pwsh -File tools/smoke.ps1` (exit 0 pass, 1 fail, 2 missing tool, 3 manual only) | +| Automated smoke test | `pwsh -File tools/smoke.ps1` (exit 0 pass, 1 fail, 2 missing tool, 3 manual only; add `-Video ntsc` to run the checks on NTSC) | +| View redraw timing bar | `pwsh -File tools/run.ps1 -Target c64 -Define VIEW_TIMING` (add `-Video ntsc`) | ## Target settings and verification status @@ -80,7 +81,7 @@ cl65 V2.19 Git cc3c40c with `-O` miscompiled an indexed table lookup in a loop ( - [ ] A1: the pointer follows the grabbed host mouse and the left button is detected while the joystick in port 2 and the keyboard still work (before M2 is complete). - [x] A3: memory map settled in M1.1 (2026-11-26): custom ld65 config `cfg/stonehold-64.cfg`, map at $4000-$7FFF, see docs/memory-map.md. Still check build/stonehold-64.map at every milestone. - [ ] A4: measure worst-case pathfinding time with a border-colour timing bar in M3. -- [ ] Frame budget: the view redraw finishes within one frame on PAL and NTSC (timing bar) in M1. +- [x] Frame budget: the view redraw finishes within one frame on PAL and NTSC. M1.3 (2026-11-26) measured 14,962 / 15,131 cycles, and the smoke check `view_fast` verifies it on every run. diff --git a/docs/verification-status.md b/docs/verification-status.md index 1d3f5af..6a3ba36 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -11,7 +11,7 @@ manual = `pending`, `confirmed by user ()`, `problem reported (): #include #include "charset.h" +#include "map.h" #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. */ +/* Each game code carries its colour in the low nibble (see map.h). Fail the build if a +** code and the spec's colour (docs/spec.md, Visuals) ever drift apart. */ +typedef char check_floor [(GLYPH_FLOOR & 15) == COLOR_GRAY1 ? 1 : -1]; +typedef char check_soft [(GLYPH_ROCK_SOFT & 15) == COLOR_BROWN ? 1 : -1]; +typedef char check_hard [(GLYPH_ROCK_HARD & 15) == COLOR_GRAY2 ? 1 : -1]; +typedef char check_marked[(GLYPH_MARKED & 15) == COLOR_YELLOW ? 1 : -1]; +typedef char check_dwarf [(GLYPH_DWARF & 15) == COLOR_ORANGE ? 1 : -1]; +typedef char check_cursor[(GLYPH_CURSOR & 15) == COLOR_WHITE ? 1 : -1]; +typedef char check_tiles [(TILE_FLOOR == GLYPH_FLOOR && TILE_SOFT == GLYPH_ROCK_SOFT && + TILE_HARD == GLYPH_ROCK_HARD && TILE_SOFT_MARKED == GLYPH_MARKED) ? 1 : -1]; + +/* Original game glyphs, 8 bytes each, in the order of glyph_codes[] below. */ static const unsigned char glyphs[] = { /* soft rock: rough solid block */ 0xFF, 0xDD, 0xFF, 0x77, 0xFF, 0xDD, 0xFF, 0x77, @@ -22,6 +34,14 @@ static const unsigned char glyphs[] = { 0xE7, 0x81, 0x81, 0x00, 0x00, 0x81, 0x81, 0xE7 }; +/* Where each glyph goes; marked rock is copied to every marked tile code. */ +static const unsigned char glyph_codes[] = { + GLYPH_ROCK_SOFT, GLYPH_ROCK_HARD, GLYPH_FLOOR, GLYPH_MARKED, GLYPH_DWARF, GLYPH_CURSOR +}; +static const unsigned char marked_copies[] = { + TILE_HARD_MARKED, TILE_SOFT_MARKED | TILE_CLAIMED, TILE_HARD_MARKED | TILE_CLAIMED +}; + /* The 2 KB charset itself, placed at CHARSET_ADDR by the linker (segment CHARSET). */ #pragma bss-name (push, "CHARSET") unsigned char charset[2048]; @@ -48,7 +68,12 @@ void charset_install(void) CPU_PORT = old_port; __asm__("cli"); - memcpy(dst + GLYPH_ROCK_SOFT * 8u, glyphs, sizeof glyphs); + for (i = 0; i < sizeof glyph_codes; ++i) { + memcpy(dst + glyph_codes[i] * 8u, glyphs + i * 8u, 8); + } + for (i = 0; i < sizeof marked_copies; ++i) { + memcpy(dst + marked_copies[i] * 8u, dst + GLYPH_MARKED * 8u, 8); + } /* Screen at $0400 (upper nibble 1), charset at $3800 (bits 1-3 = 7). */ saved_vic_addr = VIC.addr; diff --git a/src/charset.h b/src/charset.h index d80b483..6257bb1 100644 --- a/src/charset.h +++ b/src/charset.h @@ -12,13 +12,16 @@ extern unsigned char charset[2048]; ** 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().) +** +** Each game glyph code has its colour in the low nibble, so the code can be written to +** screen RAM and colour RAM unchanged (map tile codes: see map.h). */ -#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 +#define GLYPH_FLOOR 0x8B /* = TILE_FLOOR, dark grey */ +#define GLYPH_ROCK_SOFT 0x99 /* = TILE_SOFT, brown */ +#define GLYPH_ROCK_HARD 0xAC /* = TILE_HARD, grey */ +#define GLYPH_MARKED 0x97 /* = TILE_SOFT_MARKED, yellow (also at 0xA7, 0xD7, 0xE7) */ +#define GLYPH_DWARF 0x88 /* orange */ +#define GLYPH_CURSOR 0x81 /* white */ /* Build the charset at CHARSET_ADDR and point the VIC-II at it. */ void charset_install(void); diff --git a/src/cycles.h b/src/cycles.h new file mode 100644 index 0000000..770d8eb --- /dev/null +++ b/src/cycles.h @@ -0,0 +1,12 @@ +#ifndef STONEHOLD_CYCLES_H +#define STONEHOLD_CYCLES_H + +/* Cycle counter on CIA2 timer A, for timing checks (cycles.s). */ +void cycles_start(void); +unsigned cycles_read(void); /* cycles since cycles_start(), at most 65535 */ + +/* System clock cycles in one video frame. */ +#define FRAME_CYCLES_PAL 19656u /* 312 lines x 63 */ +#define FRAME_CYCLES_NTSC 17095u /* 263 lines x 65 */ + +#endif diff --git a/src/cycles.s b/src/cycles.s new file mode 100644 index 0000000..aa707a1 --- /dev/null +++ b/src/cycles.s @@ -0,0 +1,36 @@ +; Cycle counter for timing checks, on CIA2 timer A (unused by this game; the KERNAL only +; uses it for RS-232). Counts system clock cycles, at most 65535 between start and read. +; +; C prototypes (cycles.h): +; void cycles_start(void); +; unsigned cycles_read(void); /* cycles since cycles_start(), including call overhead */ + + .export _cycles_start, _cycles_read + +CIA2_TA_LO = $DD04 +CIA2_TA_HI = $DD05 +CIA2_CRA = $DD0E + + .segment "CODE" + +_cycles_start: + lda #$00 + sta CIA2_CRA ; stop timer A + lda #$FF + sta CIA2_TA_LO ; latch = $FFFF + sta CIA2_TA_HI + lda #%00010001 ; force load, start, continuous, count system clock + sta CIA2_CRA + rts + +_cycles_read: + lda #$00 + sta CIA2_CRA ; stop, so the two bytes belong together + lda CIA2_TA_LO ; elapsed = $FFFF - timer = timer XOR $FFFF + eor #$FF + pha + lda CIA2_TA_HI + eor #$FF + tax + pla + rts diff --git a/src/main.c b/src/main.c index a94800d..118ad03 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,8 @@ ** row 24 status line ** ** Build with -D FIXED_SEED=n (tools/build.ps1 -Define FIXED_SEED=n) to always generate seed n. +** Build with -D VIEW_TIMING to redraw the view every frame with a red border while it draws +** (timing bar for R3.3: the red band must end before the next frame starts at the bottom border). */ #include #include @@ -21,6 +23,7 @@ #include "charset.h" #include "map.h" #include "view.h" +#include "cycles.h" #define SCREEN ((unsigned char *)0x0400) #define COLRAM ((unsigned char *)0xD800) @@ -36,6 +39,10 @@ extern unsigned char _BSS_SIZE__[]; unsigned char layout_ok; /* Read by tools/smoke.ps1 for information: map generation time in jiffies (1/60 s). */ unsigned gen_jiffies; +/* Read by tools/smoke.ps1: cycles for one full draw_view(), and 1 if that fits in one frame +** of the detected video standard (R3.3). */ +unsigned view_cycles; +unsigned char view_fast; static unsigned jiffies(void) { @@ -102,7 +109,6 @@ int main(void) } charset_install(); - view_init(); #ifdef FIXED_SEED seed = FIXED_SEED; @@ -116,7 +122,10 @@ int main(void) vx = view_origin(map_start_x, VIEW_W, MAP_W); vy = view_origin(map_start_y, VIEW_H, MAP_H); + cycles_start(); draw_view(vx, vy); + view_cycles = cycles_read(); + view_fast = view_cycles < (get_tv() == TV_NTSC ? FRAME_CYCLES_NTSC : FRAME_CYCLES_PAL); draw_dwarves(vx, vy); gotoxy(0, 24); @@ -127,6 +136,12 @@ int main(void) while (!kbhit()) { wait_frame(); +#ifdef VIEW_TIMING + bordercolor(COLOR_RED); + draw_view(vx, vy); + bordercolor(COLOR_BLACK); + draw_dwarves(vx, vy); +#endif } cgetc(); charset_remove(); diff --git a/src/map.h b/src/map.h index 02818ff..2b3d3a9 100644 --- a/src/map.h +++ b/src/map.h @@ -8,13 +8,34 @@ #define MAP_H 128u #define MAP_ADDR 0x4000u -/* Tile byte: bits 0-1 tile type, bit 6 claimed by a dwarf, bit 7 marked for digging. */ -#define TILE_FLOOR 0x00 -#define TILE_SOFT 0x01 -#define TILE_HARD 0x02 -#define TILE_TYPE 0x03 -#define TILE_CLAIMED 0x40 -#define TILE_MARKED 0x80 +/* Tile byte. Each map byte is also the screen code it is drawn with, and its low nibble is +** its colour (colour RAM keeps only 4 bits), so draw_view copies bytes without a lookup (R3.3). +** bit 7 always 1 (game glyphs live at codes 128-255) +** bit 6 claimed by a dwarf +** bits 5-4 type: 00 floor, 01 soft rock, 10 hard rock +** bits 3-0 colour: the type's colour, or yellow (7) when marked for digging +** charset.c puts a glyph at every code used here; see docs/memory-map.md. */ +#define TILE_FLOOR 0x8B /* type 0, dark grey (COLOR_GRAY1) */ +#define TILE_SOFT 0x99 /* type 1, brown (COLOR_BROWN) */ +#define TILE_HARD 0xAC /* type 2, grey (COLOR_GRAY2) */ +#define TILE_CLAIMED 0x40 +#define TILE_TYPE_MASK 0x30 +#define TILE_TYPE_FLOOR 0x00 +#define TILE_TYPE_SOFT 0x10 +#define TILE_TYPE_HARD 0x20 +#define TILE_COLOR_MASK 0x0F +#define TILE_COLOR_MARKED 0x07 /* COLOR_YELLOW */ + +#define TILE_IS_ROCK(t) (((t) & TILE_TYPE_MASK) != TILE_TYPE_FLOOR) +#define TILE_IS_HARD(t) (((t) & TILE_TYPE_MASK) == TILE_TYPE_HARD) +#define TILE_IS_MARKED(t) (((t) & TILE_COLOR_MASK) == TILE_COLOR_MARKED) +/* Marked version of rock tile t (claim flag kept). Only for rock tiles. */ +#define TILE_MARK(t) ((unsigned char)(((t) & 0xF0) | TILE_COLOR_MARKED)) +/* Unmarked, unclaimed version of rock tile t. */ +#define TILE_UNMARK(t) ((unsigned char)(TILE_IS_HARD(t) ? TILE_HARD : TILE_SOFT)) +/* Marked tiles drawn by charset.c: soft, hard, and both again with the claim bit. */ +#define TILE_SOFT_MARKED 0x97 +#define TILE_HARD_MARKED 0xA7 /* Address of tile (x, y) = MAP_ADDR + y*128 + x; x and y must be 0-127. ** Built from bytes (high = $40 + y/2, low = (y odd ? $80 : 0) + x) because a 16-bit diff --git a/src/view.c b/src/view.c deleted file mode 100644 index 26d4a6f..0000000 --- a/src/view.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Map view (R3). Tile bytes are translated through two 256-entry tables, so the -** marked/claimed flag bits need no special case when drawing. */ -#include -#include "charset.h" -#include "map.h" -#include "view.h" - -#define SCREEN ((unsigned char *)0x0400) -#define COLRAM ((unsigned char *)0xD800) - -unsigned char tile_glyph[256]; -unsigned char tile_color[256]; - -void view_init(void) -{ - unsigned i = 0; - unsigned char t; - do { - t = (unsigned char)i; - if (t & TILE_MARKED) { - tile_glyph[i] = GLYPH_MARKED; tile_color[i] = COLOR_YELLOW; - } else switch (t & TILE_TYPE) { - case TILE_FLOOR: tile_glyph[i] = GLYPH_FLOOR; tile_color[i] = COLOR_GRAY1; break; - case TILE_HARD: tile_glyph[i] = GLYPH_ROCK_HARD; tile_color[i] = COLOR_GRAY2; break; - default: tile_glyph[i] = GLYPH_ROCK_SOFT; tile_color[i] = COLOR_BROWN; break; - } - } while (++i < 256u); -} - -void draw_view(unsigned char vx, unsigned char vy) -{ - unsigned char row, col, t; - const unsigned char *src; - unsigned char *scr = SCREEN + VIEW_TOP * 40u; - unsigned char *clr = COLRAM + VIEW_TOP * 40u; - - for (row = 0; row < VIEW_H; ++row) { - src = MAP_PTR(vx, vy + row); - /* Written with pointer increments: the indexed form (scr[col] = tile_glyph[t]) - ** is miscompiled by cc65 V2.19 cc3c40c with -O (it indexes the table with the - ** low byte of the screen address). M1.3 replaces this loop with assembly. */ - for (col = 0; col < VIEW_W; ++col) { - t = *src++; - *scr++ = tile_glyph[t]; - *clr++ = tile_color[t]; - } - } -} diff --git a/src/view.h b/src/view.h index f003cf3..f4874a0 100644 --- a/src/view.h +++ b/src/view.h @@ -6,12 +6,9 @@ #define VIEW_H 23u #define VIEW_TOP 1u -/* Build the tile-to-glyph/colour tables. Call once after charset_install(). */ -void view_init(void); - /* Draw the VIEW_W x VIEW_H window of the map whose top-left tile is (vx, vy). -** vx must be 0..MAP_W-VIEW_W and vy 0..MAP_H-VIEW_H. -** M1.2: plain C. M1.3 replaces it with an assembly routine with the same prototype. */ -void draw_view(unsigned char vx, unsigned char vy); +** vx must be 0..MAP_W-VIEW_W and vy 0..MAP_H-VIEW_H. Assembly (view.s). +** IRQs are held off while it runs. */ +void __fastcall__ draw_view(unsigned char vx, unsigned char vy); #endif diff --git a/src/view.s b/src/view.s new file mode 100644 index 0000000..6e56ab4 --- /dev/null +++ b/src/view.s @@ -0,0 +1,75 @@ +; draw_view(vx, vy): copy the 40x23 map window with top-left tile (vx, vy) to screen rows 1-23 +; and colour RAM. Each map byte is its own screen code and carries its colour in the low +; nibble (map.h), so the same byte goes to screen RAM and colour RAM: 14 cycles per tile. +; Measured in M1.3: about 14,900 cycles per full redraw (PAL frame 19,656, NTSC 17,095). +; +; Speed: the column loop is outermost (Y = 39..0) and the 23 rows are unrolled inside it, +; so every screen and colour address is a constant. The 23 map source addresses are patched +; into the code (self-modifying) once per call. vx <= 88 keeps map row reads inside one page, +; so no indexed read crosses a page. +; +; C prototype (view.h): void __fastcall__ draw_view(unsigned char vx, unsigned char vy); +; vy arrives in A, vx on the C stack. + + .export _draw_view + .importzp c_sp + .import incsp1 + +SCREEN = $0400 +COLRAM = $D800 +VIEW_TOP = 1 +VIEW_H = 23 +VIEW_W = 40 +MAP_HI = $40 ; map at $4000 + + .segment "BSS" +src_lo: .res 1 +src_hi: .res 1 + + .segment "CODE" + +_draw_view: + ; Row 0 source address = $4000 + vy*128 + vx -> hi = $40 + vy/2, lo = (vy odd ? $80 : 0) + vx + lsr a ; A = vy/2, C = vy & 1 + tax + lda #0 + ror a ; A = $80 if vy odd + ldy #0 + ora (c_sp),y ; + vx (vx < $80) + sta src_lo + txa + clc + adc #MAP_HI + sta src_hi + jsr incsp1 ; drop vx from the C stack + + ; Patch the 23 row source operands, adding 128 for each row. +.repeat VIEW_H, R + lda src_lo + sta .ident(.sprintf("src%d", R)) + 1 + lda src_hi + sta .ident(.sprintf("src%d", R)) + 2 + lda src_lo + eor #$80 + sta src_lo + bmi :+ ; low byte went $0x -> $8x: no carry + inc src_hi +: +.endrep + + php + sei ; keep timing steady; a pending IRQ runs after plp + ldy #VIEW_W - 1 +col_loop: +.repeat VIEW_H, R +.ident(.sprintf("src%d", R)): + lda $4000,y ; operand patched above + sta SCREEN + (VIEW_TOP + R) * 40,y + sta COLRAM + (VIEW_TOP + R) * 40,y +.endrep + dey + bmi done + jmp col_loop +done: + plp + rts diff --git a/tools/smoke.ps1 b/tools/smoke.ps1 index 619a9e5..8ab6464 100644 --- a/tools/smoke.ps1 +++ b/tools/smoke.ps1 @@ -18,12 +18,14 @@ .EXAMPLE pwsh -File tools/smoke.ps1 + pwsh -File tools/smoke.ps1 -Video ntsc # run the same checks on an NTSC machine pwsh -File tools/smoke.ps1 -Target c64 #> [CmdletBinding()] param( [string]$Target, [switch]$NoBuild, + [ValidateSet('pal', 'ntsc')][string]$Video, [int]$TimeoutSeconds = 180 ) . (Join-Path $PSScriptRoot 'lib.ps1') @@ -128,6 +130,7 @@ try { $done = @{} $results = @() foreach ($t in $targets) { + if ($Video) { $t.video = $Video } if (-not $NoBuild) { Invoke-TargetBuild $project $t $done } if (-not $t.smoke) { $results += @{ target = $t.id; status = 'MANUAL'; checks = @(); message = 'No automated smoke check for this target; follow docs/manual-tests.md (M0).' }