diff --git a/docs/manual-tests.md b/docs/manual-tests.md index c1d0ad4..f430a33 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -21,7 +21,8 @@ Steps: Expected: - tools/smoke.ps1 prints `[PASS] c64`; screenshot in build/smoke/c64/. -- Row 0: 'STONEHOLD 64'. Row 1: 'CHARSET OK' (or 'MEMORY CLASH' if the program has grown over the charset at $3800). Rows 3-21: a sample patch of map drawn with the custom glyphs: brown soft rock with grey hard-rock flecks, a dark-grey floor cave in the middle with three orange dwarves, two yellow marked rock tiles and a white cursor bracket. Row 23: a glyph legend (ROCK, HARD, FLOOR, DWARF, DIG). Row 24: 'STONE 000 FRAME nnn ANY KEY EXITS' with the frame counter changing every frame. Any key restores the normal character set and returns to BASIC. +- (Since M1.2) Row 0: 'STONEHOLD 64'. Row 24 briefly shows 'GENERATING MAP' (about 2 seconds). Then rows 1-23 show the part of a random map around the starting cave, drawn with the custom glyphs: brown soft rock, grey hard-rock veins, dark-grey floor, three orange dwarves on floor in the starting cave. Row 24: 'STONE 000 SEED nnnnn ANY KEY EXITS'. If the memory map is wrong, row 1 shows 'MEMORY CLASH' instead. Any key restores the normal character set and returns to BASIC. +- (M0 starter, before M1.2) Row 1 showed 'CHARSET OK', rows 3-21 a fixed sample patch, row 23 a glyph legend and row 24 a frame counter. - Autostarts to the Stonehold screen drawn with the custom character set: title on row 0, a map view on rows 1-23, status line (stone counter, seed, RUN/PAUSED) on row 24. Three dwarves move on their own to mine tiles the player marks with the mouse, joystick or keyboard. ## M1 - World and view @@ -33,12 +34,16 @@ Start: `pwsh -File tools/run.ps1 -Target c64` Steps: 1. Start the game and note the seed on row 24. -2. Reset VICE and start the game again; note the seed. +2. Close VICE, run the start command again, and note the seed. (Machine > Reset only returns to BASIC; the program is not reloaded.) +3. Fixed seed (R2.3): run `pwsh -File tools/run.ps1 -Target c64 -Define FIXED_SEED=12345`, take a screenshot (or note the visible map), close VICE and run the same command again. +4. Run `pwsh -File tools/build.ps1` afterwards so the normal (random-seed) build is back in build/. Expected: -- Row 24 shows 'SEED nnnnn' each time -- The two seeds differ and the visible maps differ -- Three dwarves stand on floor tiles inside a cave +- Row 24 shows 'GENERATING MAP' for about 2 seconds, then 'STONE 000 SEED nnnnn ANY KEY EXITS' +- Steps 1 and 2: the two seeds differ and the visible maps differ +- Step 3: both runs show 'SEED 12345' and exactly the same map +- Three orange dwarves stand on dark-grey floor tiles inside an open cave in the middle of the view +- The map shows brown soft rock, grey hard-rock veins and (often) part of a dark cavern; no letters or stray symbols inside the map area Verifies: R1, R2 diff --git a/docs/toolchain.md b/docs/toolchain.md index bb90ab1..0e529c9 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -41,6 +41,7 @@ Check them with `pwsh -File tools/check-prereqs.ps1`. Lookup order for each tool | Check prerequisites | `pwsh -File tools/check-prereqs.ps1` | | Build all targets | `pwsh -File tools/build.ps1` | | 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) | @@ -70,6 +71,10 @@ Smoke hooks in the source: - ca65 programs: the `smoke_ready` label. - BASIC programs: `POKE 679,1` (BASIC V2) or `POKE 3071,1` (BASIC 7.0) after the first screen is drawn. +## Known compiler issue + +cl65 V2.19 Git cc3c40c with `-O` miscompiled an indexed table lookup in a loop (`scr[col] = tile_glyph[t]`, src/view.c, found in M1.2). It used the low byte of the destination address as the table index. If a C lookup table gives wrong results, look at the generated assembly (`cc65 -t c64 -O -I src -o out.s src/.c`) before you suspect the logic. + ## Assumptions still to verify - [ ] 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). diff --git a/docs/verification-status.md b/docs/verification-status.md index 6610c9f..1d3f5af 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -10,7 +10,7 @@ manual = `pending`, `confirmed by user ()`, `problem reported (): )`, `problem reported (): -#include #include #include "smoke.h" #include "frame.h" #include "charset.h" #include "map.h" +#include "view.h" #define SCREEN ((unsigned char *)0x0400) #define COLRAM ((unsigned char *)0xD800) +#define JIFFY_LO (*(volatile unsigned char *)0xA2) +#define JIFFY_MID (*(volatile unsigned char *)0xA1) /* Linker symbols. cfg/stonehold-64.cfg already stops the build if an area overflows; ** this run-time check also catches a config that disagrees with charset.h / map.h. */ extern unsigned char _BSS_RUN__[]; extern unsigned char _BSS_SIZE__[]; -static void put_tile(unsigned char x, unsigned char y, unsigned char code, unsigned char color) +/* Read by tools/smoke.ps1: 1 when the memory map is as expected. */ +unsigned char layout_ok; +/* Read by tools/smoke.ps1 for information: map generation time in jiffies (1/60 s). */ +unsigned gen_jiffies; + +static unsigned jiffies(void) { - unsigned off = (unsigned)y * 40u + x; - SCREEN[off] = code; - COLRAM[off] = color; + unsigned char lo, mid; + do { + mid = JIFFY_MID; + lo = JIFFY_LO; + } while (mid != JIFFY_MID); + return ((unsigned)mid << 8) | lo; } -static void draw_sample_map(void) +static void draw_dwarves(unsigned char vx, unsigned char vy) { - unsigned char x, y; - for (y = 3; y <= 21; ++y) { - for (x = 0; x < 40; ++x) { - if ((unsigned char)((x * 7u + y * 13u) % 11u) == 0) { - put_tile(x, y, GLYPH_ROCK_HARD, COLOR_GRAY2); - } else { - put_tile(x, y, GLYPH_ROCK_SOFT, COLOR_BROWN); - } + unsigned char i, sx, sy; + unsigned off; + for (i = 0; i < DWARF_COUNT; ++i) { + sx = (unsigned char)(map_dwarf_x[i] - vx); + sy = (unsigned char)(map_dwarf_y[i] - vy); + if (sx < VIEW_W && sy < VIEW_H) { + off = (unsigned)(sy + VIEW_TOP) * 40u + sx; + SCREEN[off] = GLYPH_DWARF; + COLRAM[off] = COLOR_ORANGE; } } - /* Starting cave. */ - for (y = 9; y <= 15; ++y) { - for (x = 14; x <= 25; ++x) { - put_tile(x, y, GLYPH_FLOOR, COLOR_GRAY1); - } - } - put_tile(17, 12, GLYPH_DWARF, COLOR_ORANGE); - put_tile(19, 11, GLYPH_DWARF, COLOR_ORANGE); - put_tile(21, 13, GLYPH_DWARF, COLOR_ORANGE); - put_tile(26, 12, GLYPH_MARKED, COLOR_YELLOW); - put_tile(26, 13, GLYPH_MARKED, COLOR_YELLOW); - put_tile(24, 14, GLYPH_CURSOR, COLOR_WHITE); } -static void draw_legend(void) +/* Top-left of a view centred on (x, y), kept inside the map. */ +static unsigned char view_origin(unsigned char centre, unsigned char size, unsigned char limit) { - textcolor(COLOR_GRAY3); - put_tile(0, 23, GLYPH_ROCK_SOFT, COLOR_BROWN); - cputsxy(2, 23, "ROCK"); - put_tile(8, 23, GLYPH_ROCK_HARD, COLOR_GRAY2); - cputsxy(10, 23, "HARD"); - put_tile(16, 23, GLYPH_FLOOR, COLOR_GRAY1); - cputsxy(18, 23, "FLOOR"); - put_tile(25, 23, GLYPH_DWARF, COLOR_ORANGE); - cputsxy(27, 23, "DWARF"); - put_tile(34, 23, GLYPH_MARKED, COLOR_YELLOW); - cputsxy(36, 23, "DIG"); + unsigned char half = (unsigned char)(size / 2); + if (centre < half) { + return 0; + } + centre = (unsigned char)(centre - half); + return centre > (unsigned char)(limit - size) ? (unsigned char)(limit - size) : centre; } int main(void) { - unsigned char frames = 0; - unsigned char charset_ok; + unsigned seed, t0; + unsigned char vx, vy; bordercolor(COLOR_BLACK); bgcolor(COLOR_BLACK); @@ -90,31 +84,49 @@ int main(void) /* Memory map (assumption A3, docs/memory-map.md): program below the charset, ** charset and map exactly where the VIC-II setup and the C code expect them. */ - charset_ok = (unsigned)_BSS_RUN__ + (unsigned)_BSS_SIZE__ <= CHARSET_ADDR - && (unsigned)charset == CHARSET_ADDR - && (unsigned)map == MAP_ADDR; + layout_ok = (unsigned)_BSS_RUN__ + (unsigned)_BSS_SIZE__ <= CHARSET_ADDR + && (unsigned)charset == CHARSET_ADDR + && (unsigned)map == MAP_ADDR; textcolor(COLOR_WHITE); cputsxy(0, 0, "STONEHOLD 64"); - if (charset_ok) { - charset_install(); - cputsxy(0, 1, "CHARSET OK"); - draw_sample_map(); - draw_legend(); - } else { + if (!layout_ok) { textcolor(COLOR_LIGHTRED); cputsxy(0, 1, "MEMORY CLASH"); + textcolor(COLOR_WHITE); + cputsxy(0, 24, "STONE 000 ANY KEY EXITS"); + smoke_capture(); + smoke_ready(); + cgetc(); + return 1; } - textcolor(COLOR_WHITE); - cputsxy(0, 24, "STONE 000 FRAME ANY KEY EXITS"); + + charset_install(); + view_init(); + +#ifdef FIXED_SEED + seed = FIXED_SEED; +#else + seed = map_random_seed(); +#endif + cputsxy(0, 24, "GENERATING MAP"); + t0 = jiffies(); + map_generate(seed); + gen_jiffies = jiffies() - t0; + + vx = view_origin(map_start_x, VIEW_W, MAP_W); + vy = view_origin(map_start_y, VIEW_H, MAP_H); + draw_view(vx, vy); + draw_dwarves(vx, vy); + + gotoxy(0, 24); + cprintf("STONE 000 SEED %05u ANY KEY EXITS", map_seed); smoke_capture(); smoke_ready(); while (!kbhit()) { wait_frame(); - gotoxy(18, 24); - cprintf("%3u", (unsigned)frames++); } cgetc(); charset_remove(); diff --git a/src/map.c b/src/map.c index 16d2a2e..40a8f06 100644 --- a/src/map.c +++ b/src/map.c @@ -1,6 +1,162 @@ -/* World map storage. Generation comes in M1.2. */ +/* World map storage and the seeded map generator (R2). */ +#include +#include #include "map.h" +/* Generation runs once per game; static locals make cc65 code much faster here. */ +#pragma static-locals (on) + #pragma bss-name (push, "MAP") unsigned char map[MAP_W * MAP_H]; #pragma bss-name (pop) + +unsigned map_seed; +unsigned char map_start_x, map_start_y; +unsigned char map_dwarf_x[DWARF_COUNT]; +unsigned char map_dwarf_y[DWARF_COUNT]; + +/* Generation tuning. */ +#define VEIN_COUNT 56u +#define CAVERN_MIN 8u +#define CAVERN_TRIES 40u +#define START_KEEPOUT_X 24u /* caverns stay this far from the map centre ... */ +#define START_KEEPOUT_Y 18u /* ... in x or in y, so the starting cave stays separate */ + +/* 16-bit xorshift (7, 9, 8): full period 65535, never returns 0 from a non-zero state. */ +static unsigned rng; + +static unsigned rnd(void) +{ + rng ^= rng << 7; + rng ^= rng >> 9; + rng ^= rng << 8; + return rng; +} + +/* Eight directions, clockwise from north. */ +static const signed char dir_dx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }; +static const signed char dir_dy[8] = { -1, -1, 0, 1, 1, 1, 0, -1 }; + +unsigned map_random_seed(void) +{ + unsigned s; + s = (unsigned)CIA1.ta_lo | ((unsigned)CIA1.ta_hi << 8); + s ^= (unsigned)VIC.rasterline << 5; + s ^= (unsigned)(*(unsigned char *)0xA2) << 8; /* jiffy clock, low byte */ + s ^= *(unsigned char *)0xA1; /* jiffy clock, middle byte */ + return s ? s : 1u; +} + +/* Hard-rock veins: wandering lines, sometimes two tiles wide. Rows/columns 0 and 127 stay soft rock. */ +static void make_veins(void) +{ + unsigned char v, len, x, y, dir, thick; + unsigned r; + + for (v = 0; v < VEIN_COUNT; ++v) { + r = rnd(); + x = (unsigned char)(r & 0x7F); + y = (unsigned char)((r >> 7) & 0x7F); + dir = (unsigned char)((r >> 14) | ((r & 0x80) ? 4 : 0)); + thick = (unsigned char)(rnd() & 1); + len = (unsigned char)(24u + (rnd() & 63u)); + while (len--) { + if (x == 0 || x >= 127 || y == 0 || y >= 127) { + break; + } + *MAP_PTR(x, y) = TILE_HARD; + if (thick && x < 126) { + *MAP_PTR(x + 1, y) = TILE_HARD; + } + r = rnd(); + if ((r & 3) == 0) { + dir = (unsigned char)((dir + ((r & 4) ? 1 : 7)) & 7); + } + x = (unsigned char)(x + dir_dx[dir]); + y = (unsigned char)(y + dir_dy[dir]); + } + } +} + +/* Carve a 2x2 block of floor with its top-left at (x, y). Caller keeps x, y in 2..124. */ +static void carve2x2(unsigned char x, unsigned char y) +{ + unsigned char *p = MAP_PTR(x, y); + p[0] = TILE_FLOOR; + p[1] = TILE_FLOOR; + p[MAP_W] = TILE_FLOOR; + p[MAP_W + 1] = TILE_FLOOR; +} + +/* Caverns: random walks that carve 2x2 floor, kept away from the map centre. */ +static void make_caverns(void) +{ + unsigned char made = 0, tries, count, x, y, dir; + unsigned steps; + unsigned r; + + count = (unsigned char)(CAVERN_MIN + (rnd() & 3u)); + for (tries = 0; tries < CAVERN_TRIES && made < count; ++tries) { + r = rnd(); + /* 8..119 in each axis */ + x = (unsigned char)(8u + (((r & 0x7Fu) * 7u) >> 3)); + y = (unsigned char)(8u + ((((r >> 7) & 0x7Fu) * 7u) >> 3)); + if ((unsigned char)(x > 64 ? x - 64 : 64 - x) < START_KEEPOUT_X && + (unsigned char)(y > 64 ? y - 64 : 64 - y) < START_KEEPOUT_Y) { + continue; + } + ++made; + steps = 100u + (rnd() & 127u); + while (steps--) { + carve2x2(x, y); + r = rnd(); + dir = (unsigned char)((r & 3u) << 1); /* N, E, S or W */ + x = (unsigned char)(x + dir_dx[dir]); + y = (unsigned char)(y + dir_dy[dir]); + if (x < 2) x = 2; else if (x > 124) x = 124; + if (y < 2) y = 2; else if (y > 124) y = 124; + } + } +} + +/* Half-widths of the starting cave, one per row from cy-4 to cy+4. */ +static const unsigned char start_half[9] = { 3, 5, 6, 7, 7, 7, 6, 5, 3 }; + +/* Starting cave: a rough ellipse about 15x9 near the centre, carved last so it is always open. */ +static void make_start_cave(void) +{ + unsigned char row, half, x, y, cx, cy; + unsigned char *p; + + cx = (unsigned char)(60u + (rnd() & 7u)); + cy = (unsigned char)(60u + (rnd() & 7u)); + for (row = 0; row < 9; ++row) { + half = (unsigned char)(start_half[row] + (rnd() & 1u)); + y = (unsigned char)(cy - 4 + row); + p = MAP_PTR(cx - half, y); + for (x = 0; x <= (unsigned char)(half * 2); ++x) { + p[x] = TILE_FLOOR; + } + } + map_start_x = cx; + map_start_y = cy; + + /* Rows cy-1..cy+1 are at least 7 tiles wide each side, so these are always floor (R2.4). */ + map_dwarf_x[0] = (unsigned char)(cx - 2); map_dwarf_y[0] = cy; + map_dwarf_x[1] = cx; map_dwarf_y[1] = (unsigned char)(cy - 1); + map_dwarf_x[2] = (unsigned char)(cx + 2); map_dwarf_y[2] = (unsigned char)(cy + 1); +} + +void map_generate(unsigned seed) +{ + if (seed == 0) { + seed = 1; + } + map_seed = seed; + rng = seed; + + memset(map, TILE_SOFT, sizeof map); + make_veins(); + make_caverns(); + make_start_cave(); +} diff --git a/src/map.h b/src/map.h index 805deea..02818ff 100644 --- a/src/map.h +++ b/src/map.h @@ -8,6 +8,36 @@ #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 + +/* 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 +** shift by 7 is slow in cc65. */ +#define MAP_PTR(x, y) ((unsigned char *)( \ + ((unsigned)(unsigned char)((MAP_ADDR >> 8) + ((unsigned char)(y) >> 1)) << 8) | \ + (unsigned char)((((unsigned char)(y) & 1) ? 0x80 : 0) | (unsigned char)(x)))) + +#define DWARF_COUNT 3 + extern unsigned char map[MAP_W * MAP_H]; +/* Results of map_generate(). */ +extern unsigned map_seed; /* 1-65535 */ +extern unsigned char map_start_x, map_start_y; /* centre of the starting cave */ +extern unsigned char map_dwarf_x[DWARF_COUNT]; /* dwarf start tiles (floor) */ +extern unsigned char map_dwarf_y[DWARF_COUNT]; + +/* A seed from the timers and the raster line at the moment of the call (never 0). */ +unsigned map_random_seed(void); + +/* Fill map[] from seed: soft rock, hard-rock veins, caverns, starting cave near the centre. +** The same seed always gives the same map. Seed 0 is treated as 1. */ +void map_generate(unsigned seed); + #endif diff --git a/src/view.c b/src/view.c new file mode 100644 index 0000000..26d4a6f --- /dev/null +++ b/src/view.c @@ -0,0 +1,48 @@ +/* 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 new file mode 100644 index 0000000..f003cf3 --- /dev/null +++ b/src/view.h @@ -0,0 +1,17 @@ +#ifndef STONEHOLD_VIEW_H +#define STONEHOLD_VIEW_H + +/* The map view: screen rows VIEW_TOP .. VIEW_TOP+VIEW_H-1, all 40 columns. */ +#define VIEW_W 40u +#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); + +#endif diff --git a/tools/build.ps1 b/tools/build.ps1 index a2082a9..e4808a1 100644 --- a/tools/build.ps1 +++ b/tools/build.ps1 @@ -12,15 +12,19 @@ .EXAMPLE pwsh -File tools/build.ps1 pwsh -File tools/build.ps1 -Target c64 + pwsh -File tools/build.ps1 -Define FIXED_SEED=12345 # extra cl65 -D define(s) for this build #> [CmdletBinding()] -param([string]$Target) +param([string]$Target, [string[]]$Define) . (Join-Path $PSScriptRoot 'lib.ps1') try { $project = Get-ProjectConfig $done = @{} - foreach ($t in Get-ProjectTargets $project $Target) { Invoke-TargetBuild $project $t $done } + foreach ($t in Get-ProjectTargets $project $Target) { + if ($Define) { $t.build.defines = @($t.build.defines) + $Define } + Invoke-TargetBuild $project $t $done + } Write-Host "Build complete." } catch [MissingToolException] { Write-Host $_.Exception.Message -ForegroundColor Yellow diff --git a/tools/run.ps1 b/tools/run.ps1 index d863059..8460194 100644 --- a/tools/run.ps1 +++ b/tools/run.ps1 @@ -10,11 +10,13 @@ .EXAMPLE pwsh -File tools/run.ps1 pwsh -File tools/run.ps1 -Target c128-80 + pwsh -File tools/run.ps1 -Target c64 -Define FIXED_SEED=12345 # extra cl65 -D define(s) #> [CmdletBinding()] param( [string]$Target, [switch]$NoBuild, + [string[]]$Define, [ValidateSet('pal', 'ntsc')][string]$Video ) . (Join-Path $PSScriptRoot 'lib.ps1') @@ -22,6 +24,7 @@ param( try { $project = Get-ProjectConfig $t = if ($Target) { Get-ProjectTargets $project $Target } else { @($project.resolved.targets)[0] } + if ($Define) { $t.build.defines = @($t.build.defines) + $Define } if (-not $NoBuild) { Invoke-TargetBuild $project $t @{} } if ($t.build.kind -eq 'none' -and -not $t.disk) { throw "Target $($t.id) is built on the Commodore; follow docs/toolchain.md to load it." } $emu = Get-ToolPath $project $t.emulator.binary