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

+42
View File
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""Fly the published joystick exercise on both CPUs using the actual guest screen."""
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="folder with CoCo 3 and Disk BASIC ROMs")
parser.add_argument("--capture", type=Path, help="optional PNG of the charged probe in flight")
args = parser.parse_args()
runtime, core, roms = [x.resolve(strict=True) for x 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-survey-probe-") as folder:
work = Path(folder)
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
"-I", root / "src", fixture / "run.cpp", core, "-o", "run"], cwd=work, check=True)
for optimization in ("-O0", "-O2"):
subprocess.run([runtime / "bin/cmoc", "--coco", "--org=2800", optimization, "-Werror",
"-o", "PROBE.BIN", root / "examples/cmoc/manual/probe.c",
"-lgime", "-linput", "-lbcontrol"], cwd=work, env=env, check=True)
(work / "PROBE.DSK").write_bytes(b"\xff" * (35 * 18 * 256))
subprocess.run([runtime / "bin/writecocofile", "PROBE.DSK", "PROBE.BIN"], cwd=work, check=True)
argv = ["./run", roms, "PROBE.DSK", "PROBE.BIN"]
if args.capture and optimization == "-O2":
argv.append("survey.ppm")
print("Checking", optimization, flush=True)
subprocess.run(argv, cwd=work, check=True)
if args.capture:
subprocess.run(["sips", "-s", "format", "png", "survey.ppm", "--out", args.capture.resolve()],
cwd=work, check=True, stdout=subprocess.DEVNULL)
if __name__ == "__main__":
main()
+111
View File
@@ -0,0 +1,111 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../basic-disk-session.h"
using namespace BasicDiskTests;
// Read the completed scanout, including the GIME palette and active-image placement.
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];
}
template<class Predicate>
static void waitFor(Session& session, Predicate ready, const char* failure)
{
for (unsigned n = 0; n < 900; ++n) {
session.frames(1);
const auto frame = session.machine.snapshot().frame;
if (frame && ready(*frame)) return;
}
throw std::runtime_error(failure);
}
static void capture(const Frame& frame, const fs::path& filename)
{
const auto area = frame.activeArea;
std::ofstream out(filename, 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) {
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(), "Failed to write scanout");
}
static void fly(const fs::path& roms, const fs::path& disk, const fs::path& binary,
Processor cpu, bool fromDisk, const fs::path& screenshot)
{
Session session(roms, disk, cpu, Profile::fd);
constexpr auto center = 8191;
auto joystick = [&](unsigned x, unsigned button) {
session.machine.setJoystick(0, x, center, button, 0);
};
if (!fromDisk) {
session.launch(binary); // The workspace's ordinary development Run.
} else {
session.type("LOADM\"PROBE\":EXEC\r");
}
joystick(center, 0);
auto shipAt = [](const Frame& f, unsigned x) {
return pixel(f, x, 57) == 0xffffff && pixel(f, x + 19, 57) == 0xffffff;
};
waitFor(session, [&](const Frame& f) { return shipAt(f, 144); }, "Lander never appeared");
joystick(16383, 0);
waitFor(session, [&](const Frame& f) { return shipAt(f, 214); }, "Steering did not approach the deposit");
joystick(center, 0);
session.frames(16);
const auto initial = session.machine.snapshot().frame;
const auto gold = pixel(*initial, 218, 152);
const auto cyan = pixel(*initial, 219, 158); // Support beneath the deposit.
const auto sky = pixel(*initial, 212, 130);
require(pixel(*initial, 2, 172) != sky && pixel(*initial, 192, 162) == pixel(*initial, 2, 172) &&
pixel(*initial, 2, 162) == sky, "Terrain profile lost its changing heights");
require(gold != cyan && cyan != sky && gold != sky, "Invalid survey palette or missing deposit");
unsigned launchX = 0;
for (unsigned x = 200; x < 240; ++x) {
if (pixel(*initial, x, 57) == 0xffffff) { launchX = x + 9; break; }
}
require(launchX >= 216 && launchX < 242, "Lander did not stop above the deposit");
joystick(center, 1);
waitFor(session, [&](const Frame& f) { return pixel(f, launchX, 67) == cyan; },
"A press did not launch the short probe");
waitFor(session, [&](const Frame& f) { return pixel(f, 56, 10) == gold; }, "Holding did not fill the gauge");
// Give the first probe enough time to disappear; a repeating press would
// leave a probe in the sky, hit the deposit, or increase the final count.
session.frames(60);
const auto charged = session.machine.snapshot().frame;
require(pixel(*charged, 218, 152) == gold, "First probe reached the distant deposit");
for (unsigned y = 66; y < 150; ++y)
require(pixel(*charged, launchX, y) == sky, "Holding the button relaunched a probe");
joystick(center, 0);
waitFor(session, [&](const Frame& f) { return pixel(f, 56, 10) == cyan; }, "Release did not lock the charge");
joystick(center, 1);
waitFor(session, [&](const Frame& f) { return pixel(f, launchX, 104) == cyan; },
"Second launch did not travel beyond the first probe's range");
if (!screenshot.empty()) capture(*session.machine.snapshot().frame, screenshot);
waitFor(session, [&](const Frame& f) { return pixel(f, 218, 152) == cyan; }, "Charged probe missed the deposit");
joystick(center, 0);
session.frames(12);
session.type("Q");
session.until("PROBES LAUNCHED: 2\nDEPOSIT SURVEYED");
session.verifyReturn();
session.verifyMedia();
}
int main(int argc, char** argv)
{
try {
require(argc == 4 || argc == 5, "Usage: run ROM_DIR DISK BIN [CAPTURE.ppm]");
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
const bool captureDirectRun = argc == 5 && cpu == Processor::MC6809;
fly(argv[1], argv[2], argv[3], cpu, false, captureDirectRun ? argv[4] : "");
fly(argv[1], argv[2], argv[3], cpu, true, "");
}
std::cout << "PASS MC6809 and HD6309 direct Run and disk EXEC: steering, two presses, charge, release, deposit and BASIC return\n";
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}