Publish VCC Plus OSS source distribution for 3.6.2 build 60

This commit is contained in:
Brian Holman committed 2026-11-13 00:14:03 -07:00
commit c652a5276d
1192 files changed
+272368

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""Run the banked landscape lesson on both CoCo CPUs and capture the guest display."""
import argparse
import os
from pathlib import Path
import subprocess
import tempfile
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("runtime", type=Path, help="staged ToolchainBundle")
parser.add_argument("core", type=Path, help="libVCCCore.a")
parser.add_argument("roms", type=Path, help="CoCo 3 and Disk BASIC ROM directory")
parser.add_argument("--captures", type=Path, help="write ridge-earth.png and ridge-mars.png here")
args = parser.parse_args()
runtime, core, roms = [p.resolve(strict=True) for p in (args.runtime, args.core, args.roms)]
fixture = Path(__file__).resolve().parent
root = fixture.parents[2]
env = dict(os.environ, VCC_CMOC_COMPAT="0", PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
with tempfile.TemporaryDirectory(prefix="vcc-ridge-") as folder:
def run(*command):
subprocess.run(command, cwd=folder, env=env, check=True)
run("xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
"-I", root / "src", fixture / "run.cpp", core, "-o", "run")
for opt in ("-O0", "-O2"):
print("Checking", opt, flush=True)
run(runtime / "bin/cmoc", "--coco", "--org=2800", opt, "-Werror", "-o", "RIDGE.BIN",
root / "examples/cmoc/manual/ridge.c", "-lbank", "-lgime", "-lhirestxt")
(Path(folder) / "RIDGE.DSK").write_bytes(b"\xff" * (35 * 18 * 256))
run(runtime / "bin/writecocofile", "RIDGE.DSK", "RIDGE.BIN")
capture = args.captures and opt == "-O2"
run("./run", roms, "RIDGE.DSK", "RIDGE.BIN", *(["capture"] if capture else []))
if capture:
args.captures.mkdir(parents=True, exist_ok=True)
for planet in ("earth", "mars"):
png = args.captures.resolve() / f"ridge-{planet}.png"
run("sips", "-s", "format", "png", f"{planet}.ppm", "--out", png)
if __name__ == "__main__":
main()
+102
View File
@@ -0,0 +1,102 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../basic-disk-session.h"
using namespace BasicDiskTests;
static std::uint32_t pixel(const Frame& frame, unsigned x, unsigned y)
{
const auto area = frame.activeArea;
return frame.pixels[(area.y + y * area.height / 192) * Frame::width + area.x + x * area.width / 320];
}
// The highlighted ridge top and the ship's lower edge both use the header color.
static void expectScene(Session& session, unsigned y, unsigned column,
std::uint32_t accent, bool initial = false)
{
for (unsigned n = 0; n < 900; ++n) {
session.frames(1);
const auto frame = session.machine.snapshot().frame;
if (!frame) continue;
const auto edge = pixel(*frame, 12, 19);
if ((initial || edge == accent) && edge != pixel(*frame, 12, 22) &&
pixel(*frame, column * 16 + 2, 59) == edge &&
pixel(*frame, column * 16 + 2, y) == edge &&
pixel(*frame, column * 16 + 2, y + 3) != edge) {
session.frames(3); // Finish the first scan after the vertical-blank flip.
return;
}
}
throw std::runtime_error("Expected ridge at y=" + std::to_string(y) +
" under probe column " + std::to_string(column) +
"\n" + session.machine.copyScreenText());
}
static void savePicture(const Frame& frame, const fs::path& file)
{
if (file.empty()) return;
const auto area = frame.activeArea;
std::ofstream out(file, std::ios::binary);
out << "P6\n" << area.width << " " << area.height << "\n255\n";
for (int y = 0; y < area.height; ++y)
for (int x = 0; x < area.width; ++x) {
const auto rgb = frame.pixels[(area.y + y) * Frame::width + area.x + x];
out.put(char(rgb >> 16)); out.put(char(rgb >> 8)); out.put(char(rgb));
}
require(out.good(), "Could not save the guest display");
}
static void verify(const fs::path& roms, const fs::path& disk, const fs::path& bin,
Processor cpu, bool fromDisk, bool capture)
{
Session session(roms, disk, cpu, Profile::fd);
if (fromDisk) session.type("LOADM\"RIDGE\":EXEC\r");
else session.launch(bin);
expectScene(session, 132, 10, 0, true);
auto frame = session.machine.snapshot().frame;
const auto earthEdge = pixel(*frame, 12, 19);
if (capture) savePicture(*frame, "earth.ppm");
session.type("D");
expectScene(session, 140, 11, earthEdge);
session.type("A");
expectScene(session, 132, 10, earthEdge);
session.type(" ");
expectScene(session, 152, 10, 0, true);
const auto marsEdge = pixel(*session.machine.snapshot().frame, 12, 19);
require(marsEdge != earthEdge, "The two planets have the same terrain color");
session.type("R");
expectScene(session, 136, 10, marsEdge);
auto byteAt = [&](unsigned address) {
return session.machine.debuggerMemoryRange(address, 1, true).bytes.at(0);
};
require(byteAt(0x5000A) == 132 && byteAt(0x5200A) == 136,
"The screen changed without writing the two documented physical bytes");
session.type(" ");
expectScene(session, 132, 10, earthEdge);
session.type(" ");
expectScene(session, 136, 10, marsEdge);
if (capture) savePicture(*session.machine.snapshot().frame, "mars.ppm");
session.type("Q");
session.until("SURVEY COMPLETE");
session.verifyReturn();
session.verifyMedia();
}
int main(int argc, char** argv)
{
try {
require(argc == 4 || argc == 5, "Usage: run ROMS DISK BIN [capture]");
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
verify(argv[1], argv[2], argv[3], cpu, false, argc == 5 && cpu == Processor::MC6809);
verify(argv[1], argv[2], argv[3], cpu, true, false);
}
std::cout << "PASS MC6809/HD6309 direct Run and disk EXEC: flight, planet switch, "
"physical ridge edit, return visit and BASIC return\n";
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}