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,57 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Build Planet Expedition from source and fly its real disks under SDC-DOS."""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("runtime", type=Path)
|
||||
parser.add_argument("core", type=Path)
|
||||
parser.add_argument("roms", type=Path)
|
||||
parser.add_argument("--capture", type=Path, help="save the guest's Mars landing as a PNG")
|
||||
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, PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-planet-expedition-") as tmp:
|
||||
work = Path(tmp)
|
||||
run = work / "run"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
"-I", root / "src", fixture / "run.cpp", core, "-o", run], check=True)
|
||||
for config in ("Debug", "Release"):
|
||||
project = work / config
|
||||
shutil.copytree(root / "examples/cmoc/PlanetExpedition", project)
|
||||
subprocess.run([runtime / "bin/make", "-j3", "VCC_CONFIGURATION=" + config],
|
||||
cwd=project, env=env, check=True)
|
||||
card = project / "EXPED"
|
||||
if {p.name for p in card.iterdir()} != {"EXPLORE.DSK", "EARTH.DSK", "MARS.DSK"}:
|
||||
raise AssertionError("Expected the three practice images in EXPED")
|
||||
originals = {p.name: p.read_bytes() for p in card.iterdir()}
|
||||
capture = bool(args.capture) and config == "Release"
|
||||
subprocess.run([run, roms, card, project / "EXPLORE.BIN", "capture" if capture else "check"],
|
||||
cwd=work, check=True)
|
||||
if {p.name: p.read_bytes() for p in card.iterdir()} != originals:
|
||||
raise AssertionError("The guest changed the practice card or the starter disk")
|
||||
if capture:
|
||||
subprocess.run(["sips", "-s", "format", "png", work / "expedition.ppm",
|
||||
"--out", args.capture.resolve()], check=True)
|
||||
if config == "Release":
|
||||
(project / "assets/mars.txt").write_text("MARS: ICE CAP\nLAND NEAR THE POLE.\n")
|
||||
subprocess.run([runtime / "bin/make", "VCC_CONFIGURATION=Release"], cwd=project, env=env, check=True)
|
||||
if (card / "MARS.DSK").read_bytes() == originals["MARS.DSK"]:
|
||||
raise AssertionError("Editing the Mars landing instructions did not rebuild the data disk")
|
||||
for name in ("EARTH.DSK", "EXPLORE.DSK"):
|
||||
if (card / name).read_bytes() != originals[name]:
|
||||
raise AssertionError(f"Unrelated image {name} changed")
|
||||
subprocess.run([run, roms, card, project / "EXPLORE.BIN", "edited"], cwd=work, check=True)
|
||||
print(f"PASS {config}: directory, disk load, two destinations, missing disk, direct Run and read-only media")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,113 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "../guest-captures.h"
|
||||
|
||||
using namespace BasicDiskTests;
|
||||
|
||||
// The SDC-DOS mount command also needs three punctuation keys.
|
||||
static void enter(Session& guest, const std::string& command)
|
||||
{
|
||||
for (char c : command) {
|
||||
if (c == ',' || c == '.' || c == '/') {
|
||||
guest.machine.setKeyboard(std::uint64_t(1) << (c == ',' ? 44 : c == '.' ? 46 : 47));
|
||||
guest.frames(5);
|
||||
guest.machine.setKeyboard(0);
|
||||
guest.frames(5);
|
||||
} else {
|
||||
guest.type(std::string(1, c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void checkChart(Session& guest)
|
||||
{
|
||||
guest.until("Q QUIT");
|
||||
guest.frames(8);
|
||||
const auto text = guest.machine.copyScreenText();
|
||||
for (auto name : {" EARTH.DSK", " MARS.DSK", " EXPLORE.DSK", "SDC0: EXPLORE.DSK", "SDC1: EMPTY"})
|
||||
require(text.find(name) != text.npos, "Chart is missing " + std::string(name) + "\n" + text);
|
||||
}
|
||||
|
||||
static void checkMounts(Session& guest, const std::string& planet)
|
||||
{
|
||||
const auto disks = guest.sdc->snapshot().drives;
|
||||
require(disks[0].mounted && fs::path(disks[0].name).filename() == "EXPLORE.DSK", "Program disk changed");
|
||||
require(disks[1].mounted && fs::path(disks[1].name).filename() == planet, "Unexpected planet disk");
|
||||
require(disks[1].reads > 0 && !disks[1].writes && !disks[0].writes, "Expected read-only planet visit");
|
||||
}
|
||||
|
||||
static void fly(const fs::path& roms, const fs::path& card, const fs::path& binary, Processor cpu, const std::string& mode)
|
||||
{
|
||||
const std::string mars = mode == "edited" ? "MARS: ICE CAP\nLAND NEAR THE POLE." : "MARS: RED RIDGE\nLAND BEYOND THE DUST FIELD.";
|
||||
Session guest(roms, card / "EXPLORE.DSK", cpu, Profile::sdc, false);
|
||||
guest.sdc->setWriteProtected(true);
|
||||
enter(guest, "DRIVE 0,\"/EXPLORE.DSK\"\r");
|
||||
guest.until("OK");
|
||||
require(fs::path(guest.sdc->snapshot().drives[0].name).filename() == "EXPLORE.DSK", "BASIC did not mount program disk");
|
||||
enter(guest, "LOADM\"EXPLORE:0\":EXEC\r");
|
||||
checkChart(guest);
|
||||
guest.type("1");
|
||||
guest.until("SDC1: EARTH.DSK");
|
||||
guest.until("EARTH: BLUE OCEAN\nSPLASH DOWN BESIDE THE BUOY.");
|
||||
checkMounts(guest, "EARTH.DSK");
|
||||
guest.until("Q QUIT");
|
||||
guest.frames(8);
|
||||
guest.type("2");
|
||||
guest.until("SDC1: MARS.DSK");
|
||||
guest.until(mars);
|
||||
guest.until("Q QUIT");
|
||||
checkMounts(guest, "MARS.DSK");
|
||||
if (mode == "capture" && cpu == Processor::MC6809) {
|
||||
guest.frames(3);
|
||||
saveActiveFrame(*guest.machine.snapshot().frame, "expedition.ppm");
|
||||
}
|
||||
guest.type("3");
|
||||
guest.until("COULD NOT MOUNT /MISSING.DSK");
|
||||
guest.until(mars);
|
||||
guest.until("SDC1: MARS.DSK");
|
||||
checkMounts(guest, "MARS.DSK");
|
||||
guest.until("Q QUIT");
|
||||
guest.frames(8);
|
||||
guest.type("Q");
|
||||
guest.until("EXPEDITION COMPLETE");
|
||||
guest.verifyReturn();
|
||||
guest.verifyMedia();
|
||||
guest.type("CLS\rDIR 0\r");
|
||||
guest.until("EXPLORE");
|
||||
guest.until("BIN");
|
||||
guest.until("OK");
|
||||
guest.frames(12);
|
||||
guest.type("CLS\rDIR 1\r");
|
||||
guest.until("LANDING");
|
||||
guest.until("TXT");
|
||||
guest.until("OK");
|
||||
guest.frames(12);
|
||||
|
||||
// Running the same binary directly uses the card that is still mounted.
|
||||
guest.launch(binary);
|
||||
guest.until("DISKS ON THE PRACTICE CARD");
|
||||
guest.until("Q QUIT");
|
||||
guest.frames(8);
|
||||
guest.until("SDC1: MARS.DSK");
|
||||
guest.type("1");
|
||||
guest.until("SPLASH DOWN BESIDE THE BUOY.");
|
||||
checkMounts(guest, "EARTH.DSK");
|
||||
guest.until("Q QUIT");
|
||||
guest.frames(8);
|
||||
guest.type("Q");
|
||||
guest.until("EXPEDITION COMPLETE");
|
||||
guest.verifyReturn();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
require(argc == 5, "Usage: run ROMDIR CARD BIN CAPTURE");
|
||||
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
|
||||
fly(argv[1], argv[2], argv[3], cpu, argv[4]);
|
||||
std::cout << "PASS " << (cpu == Processor::MC6809 ? "6809" : "6309") << " expedition under SDC-DOS\n";
|
||||
}
|
||||
} catch (const std::exception& error) {
|
||||
std::cerr << error.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user