Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Acceptance fixture only. Python 3 is an explicit custom-recipe dependency.
|
||||
CMOC ?= cmoc
|
||||
PERL ?= perl
|
||||
PYTHON ?= python3
|
||||
WRITECOCOFILE ?= writecocofile
|
||||
VCC_CONFIGURATION ?= Release
|
||||
LIMIT := 7800
|
||||
CFLAGS :=
|
||||
ifeq ($(VCC_CONFIGURATION),CustomGIME)
|
||||
CFLAGS += -DCUSTOM_GIME=1
|
||||
endif
|
||||
ifeq ($(VCC_CONFIGURATION),Fail)
|
||||
LIMIT := 2801
|
||||
endif
|
||||
|
||||
.PHONY: all build disk clean
|
||||
all: disk
|
||||
build: disk
|
||||
disk: fixture.debug.json
|
||||
|
||||
# Always relink so switching Release/Fail cannot reuse an earlier binary.
|
||||
.PHONY: force
|
||||
obj/main.o: main.c Makefile force
|
||||
@mkdir -p obj
|
||||
"$(CMOC)" --coco -O2 --intermediate $(CFLAGS) --intdir=obj -c -o $@ $<
|
||||
|
||||
FIXTURE.BIN: obj/main.o Makefile force
|
||||
ifeq ($(VCC_CONFIGURATION),Fail)
|
||||
@printf 'main.c:1: warning: authored warning before intentional linker-limit failure\n'
|
||||
endif
|
||||
"$(CMOC)" --coco -O2 --intermediate --org=2800 --limit=$(LIMIT) --stack-space=2048 -o $@ obj/main.o -lgime
|
||||
|
||||
FIXTURE.dsk: FIXTURE.BIN Makefile
|
||||
$(PERL) -e 'print chr(255) x (35*18*256)' > $@
|
||||
$(WRITECOCOFILE) $@ FIXTURE.BIN
|
||||
|
||||
fixture.debug.json: FIXTURE.dsk export_debug.py main.c
|
||||
$(PYTHON) export_debug.py $(VCC_CONFIGURATION)
|
||||
|
||||
clean:
|
||||
rm -rf obj
|
||||
rm -f FIXTURE.BIN FIXTURE.map FIXTURE.link FIXTURE.dsk fixture.debug.json
|
||||
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Export this fixture's own unpacked DECB placement; no game/host discovery."""
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
import sys
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
SOURCE_EXTENSIONS = {".c", ".h", ".s", ".asm", ".lwasm", ".inc"}
|
||||
SECTION = re.compile(r"^Section: ([^\s]+) \((.+)\) load at ([0-9A-Fa-f]{4}), length ([0-9A-Fa-f]{4})$")
|
||||
|
||||
|
||||
def digest(path):
|
||||
return hashlib.sha256((ROOT / path).read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def decb(data):
|
||||
segments, used, entry, cursor = [], set(), None, 0
|
||||
while cursor < len(data):
|
||||
if cursor + 5 > len(data):
|
||||
raise ValueError("Truncated fixture DECB record")
|
||||
kind, length, address = struct.unpack_from(">BHH", data, cursor)
|
||||
cursor += 5
|
||||
if kind == 255:
|
||||
if length or cursor != len(data):
|
||||
raise ValueError("Invalid fixture DECB trailer")
|
||||
entry = address
|
||||
break
|
||||
if kind or not length or cursor + length > len(data) or address + length > 0x8000:
|
||||
raise ValueError("Fixture must contain ordinary load segments below $8000")
|
||||
span = set(range(address, address + length))
|
||||
if span & used:
|
||||
raise ValueError("Overlapping fixture DECB segments")
|
||||
used |= span
|
||||
segments.append((address, data[cursor:cursor + length]))
|
||||
cursor += length
|
||||
if entry is None or not segments:
|
||||
raise ValueError("Fixture DECB requires segments and an entry trailer")
|
||||
low = min(address for address, _ in segments)
|
||||
high = max(address + len(payload) for address, payload in segments)
|
||||
image = bytearray(high - low)
|
||||
for address, payload in segments:
|
||||
image[address - low:address - low + len(payload)] = payload
|
||||
return low, high, entry, image
|
||||
|
||||
|
||||
def main():
|
||||
low, high, entry, image = decb((ROOT / "FIXTURE.BIN").read_bytes())
|
||||
placements = []
|
||||
for line in (ROOT / "FIXTURE.map").read_text().splitlines():
|
||||
match = SECTION.fullmatch(line)
|
||||
if match:
|
||||
name, _, address, length = match.groups()
|
||||
address, length = int(address, 16), int(length, 16)
|
||||
if address + length > 0x8000:
|
||||
raise ValueError("Fixture section storage must stay below $8000")
|
||||
placements.append((name, address, length))
|
||||
elif line.startswith("Section:"):
|
||||
raise ValueError("Unsupported fixture linker-map section")
|
||||
if not placements:
|
||||
raise ValueError("Fixture map has no section placements")
|
||||
sections = sorted({name for name, _, _ in placements})
|
||||
if "code" not in sections:
|
||||
raise ValueError("Fixture map has no executable code section")
|
||||
raw = "obj/fixture.raw"
|
||||
(ROOT / raw).write_bytes(image)
|
||||
files = sorted(path.relative_to(ROOT).as_posix() for path in ROOT.rglob("*") if path.is_file())
|
||||
sources = {path: digest(path) for path in files if Path(path).suffix.lower() in SOURCE_EXTENSIONS}
|
||||
artifact_paths = {"FIXTURE.BIN", "FIXTURE.dsk", "FIXTURE.map", raw}
|
||||
artifact_paths.update(path for path in files if Path(path).suffix.lower() in {".o", ".lst"})
|
||||
artifacts = {path: digest(path) for path in sorted(artifact_paths)}
|
||||
# The fixture uses BASIC task 0's standard low-memory mapping. This is a
|
||||
# declaration for these own sections, not an assumption about other apps.
|
||||
logical_pages = set(range(low // 8192, (high - 1) // 8192 + 1))
|
||||
for _, address, length in placements:
|
||||
if length:
|
||||
logical_pages.update(range(address // 8192, (address + length - 1) // 8192 + 1))
|
||||
if any(page >= 4 for page in logical_pages):
|
||||
raise ValueError("Fixture section requires an unsupported MMU mapping")
|
||||
manifest = dict(
|
||||
version=1, entryPoint=entry,
|
||||
binary=dict(path="FIXTURE.BIN", sha256=artifacts["FIXTURE.BIN"]),
|
||||
disk=dict(path="FIXTURE.dsk", sha256=artifacts["FIXTURE.dsk"]),
|
||||
linkMap=dict(path="FIXTURE.map", sha256=artifacts["FIXTURE.map"]),
|
||||
sources=sources, artifacts=artifacts,
|
||||
modules=[dict(id="fixture", sections=sections, codeSections=["code"],
|
||||
image=dict(path=raw, logicalAddress=low),
|
||||
pages=[dict(logicalPage=page, physicalPage=56 + page) for page in sorted(logical_pages)])],
|
||||
framebuffers=[dict(id="page_a", physicalAddress=0x40000, mode="hscreen2"),
|
||||
dict(id="page_b", physicalAddress=0x48000, mode="hscreen2")])
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "CustomGIME":
|
||||
manifest["framebuffers"] = [dict(id="canvas_a", physicalAddress=0, mode="current_gime", canvasBytes=65536),
|
||||
dict(id="canvas_b", physicalAddress=0x20000, mode="current_gime", canvasBytes=65536)]
|
||||
(ROOT / "fixture.debug.json").write_text(json.dumps(manifest, indent=2) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,124 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Authored acceptance fixture: ordinary guest graphics and keyboard input.
|
||||
#include <coco.h>
|
||||
#include <vcc/gime.h>
|
||||
|
||||
volatile unsigned fixture_inputs;
|
||||
volatile unsigned char fixture_last_key;
|
||||
|
||||
// A real exported assembly entry, without a fabricated C statement location.
|
||||
// CMOC appends the return instruction for this pure assembly function.
|
||||
asm void fixture_entry(void)
|
||||
{
|
||||
asm { nop }
|
||||
}
|
||||
|
||||
#ifdef CUSTOM_GIME
|
||||
// Guest-only authored fixture: fill two 64 KiB canvases through an ordinary MMU
|
||||
// window, then use the real GIME registers for a panned 320x225 viewport.
|
||||
static void fill_row(unsigned char bank, unsigned address, unsigned char ink)
|
||||
{
|
||||
// Match the SDK's short MMU critical sections: BASIC IRQ code must never
|
||||
// run with its normal window replaced. Restore mapping before restoring CC.
|
||||
asm {
|
||||
pshs cc,y
|
||||
orcc #$50
|
||||
lda >$ffa4
|
||||
pshs a
|
||||
lda :bank
|
||||
sta >$ffa4
|
||||
ldx :address
|
||||
ldy #256
|
||||
ldb :ink
|
||||
@paint stb ,x+
|
||||
leay -1,y
|
||||
bne @paint
|
||||
ldx :address
|
||||
ldy #8
|
||||
ldb #$33
|
||||
@stripe stb ,x+
|
||||
leay -1,y
|
||||
bne @stripe
|
||||
puls a
|
||||
sta >$ffa4
|
||||
puls cc,y
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_canvas(unsigned char first_bank, unsigned char ink)
|
||||
{
|
||||
unsigned char bank, row;
|
||||
for (bank = 0; bank < 8; ++bank)
|
||||
for (row = 0; row < 32; ++row)
|
||||
fill_row(first_bank + bank, 0x8000 + (unsigned)row * 256, row ? ink : 0x33);
|
||||
}
|
||||
|
||||
static void present_canvas(unsigned char phase)
|
||||
{
|
||||
unsigned origin = (phase ? 0x4000 : 0) + 0x0200; // physical base +4096 bytes
|
||||
*(unsigned char *)0xff98 = 0x80;
|
||||
*(unsigned char *)0xff99 = 0x7e; // 320 pixels, 16 colors, 225 lines
|
||||
*(unsigned char *)0xff9c = 0;
|
||||
*(unsigned char *)0xff9d = origin >> 8;
|
||||
*(unsigned char *)0xff9e = origin;
|
||||
*(unsigned char *)0xff9f = 0xfe; // 256-byte stride; pan252 wraps within a row
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned char key;
|
||||
if (!gime_open())
|
||||
return 1;
|
||||
gime_set_palette(0, 0);
|
||||
gime_set_palette(1, 9);
|
||||
gime_set_palette(2, 18);
|
||||
gime_set_palette(3, 63);
|
||||
#ifdef CUSTOM_GIME
|
||||
{
|
||||
unsigned char phase = 0;
|
||||
fill_canvas(0, 0x11);
|
||||
fill_canvas(16, 0x22);
|
||||
present_canvas(phase);
|
||||
for (;;)
|
||||
{
|
||||
fixture_entry();
|
||||
key = inkey();
|
||||
if (key == 'q' || key == 'Q') break;
|
||||
if (key == 'm' || key == 'M')
|
||||
{
|
||||
phase ^= 1;
|
||||
present_canvas(phase);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Opening displays page A and draws into B. Initialize B, then A;
|
||||
// afterward A is visible and B is an intentionally different hidden page.
|
||||
gime_clear(1);
|
||||
gime_fill_rect(24, 24, 96, 48, 3);
|
||||
if (!gime_present()) { gime_close(); return 2; }
|
||||
gime_clear(2);
|
||||
gime_fill_rect(160, 80, 96, 64, 3);
|
||||
if (!gime_present()) { gime_close(); return 3; }
|
||||
for (;;)
|
||||
{
|
||||
fixture_entry();
|
||||
key = inkey();
|
||||
if (!key)
|
||||
continue;
|
||||
fixture_last_key = key;
|
||||
++fixture_inputs;
|
||||
if (key == 'q' || key == 'Q')
|
||||
break;
|
||||
if (key == 'm' || key == 'M')
|
||||
{
|
||||
gime_fill_rect(8, 144, 48, 24, 3);
|
||||
if (!gime_present())
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gime_close();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"entrySource": "main.c",
|
||||
"makefile": "Makefile",
|
||||
"buildTarget": "disk",
|
||||
"diskTarget": "disk",
|
||||
"cleanTarget": "clean",
|
||||
"binary": "FIXTURE.BIN",
|
||||
"diskImage": "FIXTURE.dsk",
|
||||
"debugManifest": "fixture.debug.json",
|
||||
"launchMode": "disk",
|
||||
"launchCommands": ["LOADM\"FIXTURE\":EXEC"],
|
||||
"jobs": 1,
|
||||
"configurations": [
|
||||
{"name": "Release", "makeArguments": ["VCC_CONFIGURATION=Release"]},
|
||||
{"name": "CustomGIME", "makeArguments": ["VCC_CONFIGURATION=CustomGIME"]},
|
||||
{"name": "Fail", "makeArguments": ["VCC_CONFIGURATION=Fail"]}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user