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,72 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Qualify the editable Planet Atlas on three Disk BASIC storage setups."""
|
||||
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 Mars trip as a PNG and the input example alongside it with an -input suffix")
|
||||
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]
|
||||
blank = root / "docs/manuals/software-storage-and-peripherals/media/BLANK.DSK"
|
||||
source = root / "examples/cmoc/manual/atlas.c"
|
||||
env = dict(os.environ, VCC_CMOC_COMPAT="1", PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
cards = [b"MERCURY: CRATERS", b"VENUS: CLOUDS", b"EARTH: BLUE SEA", b"MARS: RED RIDGE"]
|
||||
original = b"".join(card.ljust(24, b"\x00") for card in cards)
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-planet-atlas-") as tmp:
|
||||
work = Path(tmp)
|
||||
|
||||
def run(*cmd, **kwargs):
|
||||
return subprocess.run(cmd, cwd=work, env=env, check=True, **kwargs)
|
||||
|
||||
# Earth and an extra Jupiter card surround the edited Mars record.
|
||||
edited = original[:72] + b"MARS: DUST STORM".ljust(24, b"\x00") + b"JUPITER: STORM".ljust(24, b"\x00")
|
||||
full = original[:72] + b"X" * 24
|
||||
for disk, atlas in (("seed.dsk", edited), ("short.dsk", original[:80]), ("full.dsk", full)):
|
||||
shutil.copyfile(blank, work / disk)
|
||||
(work / "ATLAS.DAT").write_bytes(atlas)
|
||||
run(runtime / "bin/writecocofile", "--binary", disk, "ATLAS.DAT")
|
||||
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"):
|
||||
run(runtime / "bin/cmoc", "--coco", opt, "-Werror", "--org=2800",
|
||||
"-o", "ATLAS.BIN", source, "-lvcccompat", "-ldecbfile")
|
||||
shutil.copyfile(work / "seed.dsk", work / "launch.dsk")
|
||||
run(runtime / "bin/writecocofile", "launch.dsk", "ATLAS.BIN")
|
||||
for cpu in ("6809", "6309"):
|
||||
for profile in ("disk", "rgb-hd", "sdc"):
|
||||
for folder, disk in (("blank", blank), ("edited", work / "launch.dsk"),
|
||||
("short", work / "short.dsk"), ("full", work / "full.dsk")):
|
||||
(work / folder).mkdir(exist_ok=True)
|
||||
shutil.copyfile(disk, work / folder / "VOL.DSK")
|
||||
(work / folder / "startup.cfg").write_text("0=VOL.DSK\n")
|
||||
capture = args.capture and (cpu, opt, profile) == ("6809", "-O2", "disk")
|
||||
run("./run", roms, "ATLAS.BIN", cpu, profile, "capture" if capture else "check")
|
||||
for name, before in (("saved", original), ("edited", edited)):
|
||||
actual = run(runtime / "bin/writecocofile", "--stdout", name + "-atlas.dsk", "ATLAS.DAT",
|
||||
stdout=subprocess.PIPE).stdout
|
||||
expected = bytearray(before)
|
||||
expected[95] = ord("V")
|
||||
if actual != expected:
|
||||
raise AssertionError(f"{cpu} {opt} {profile}: unexpected {name} atlas contents")
|
||||
if capture:
|
||||
destination = args.capture.resolve()
|
||||
for suffix in ("", "-input"):
|
||||
run("sips", "-s", "format", "png", f"atlas{suffix}.ppm", "--out",
|
||||
destination.with_stem(destination.stem + suffix))
|
||||
print(f"PASS {cpu} {opt} {profile}: persisted visit, protected refusal, preserved records, "
|
||||
"numeric choices, disk launch and BASIC return", flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "../guest-captures.h"
|
||||
|
||||
using namespace BasicDiskTests;
|
||||
|
||||
static void openAtlas(Session& guest, const fs::path& binary)
|
||||
{
|
||||
guest.launch(binary);
|
||||
guest.until("PICK A PLANET (1-4), THEN ENTER");
|
||||
}
|
||||
|
||||
static void expectTrip(Session& guest, int position, const std::string& chosen, const std::string& visit)
|
||||
{
|
||||
guest.until("YOUR PICK AT BYTE " + std::to_string(position) + "\n" + chosen +
|
||||
"\nHOME BASE\nEARTH: BLUE SEA\nBACK TO YOUR BOOKMARK\n" + chosen +
|
||||
"\nFIRST CARD\nMERCURY: CRATERS\n" + visit);
|
||||
guest.until("OK");
|
||||
}
|
||||
|
||||
static void visitPracticeDisk(const fs::path& roms, const fs::path& binary, Processor cpu, Profile profile, bool capture)
|
||||
{
|
||||
Session guest(roms, "blank/VOL.DSK", cpu, profile);
|
||||
openAtlas(guest, binary);
|
||||
guest.type("4\r");
|
||||
expectTrip(guest, 72, "MARS: RED RIDGE", "VISIT SAVED\nATLAS CLOSED");
|
||||
if (capture) {
|
||||
guest.frames(3);
|
||||
saveActiveFrame(*guest.machine.snapshot().frame, "atlas.ppm");
|
||||
}
|
||||
guest.verifyReturn();
|
||||
saveVolume(guest, "saved-atlas.dsk");
|
||||
|
||||
// A second launch reads the disk flag, without needing to write it again.
|
||||
setVolumeProtected(guest, true);
|
||||
const auto original = volume(guest);
|
||||
openAtlas(guest, binary);
|
||||
guest.type("4\r");
|
||||
expectTrip(guest, 72, "MARS: RED RIDGE", "ALREADY VISITED\nATLAS CLOSED");
|
||||
guest.verifyReturn();
|
||||
|
||||
// Venus is still unvisited. A protected write must fail without damage.
|
||||
openAtlas(guest, binary);
|
||||
guest.type("2X\r");
|
||||
guest.until("EXTRA CHARACTER: X\nPICK A PLANET (1-4), THEN ENTER");
|
||||
if (capture) {
|
||||
guest.frames(3);
|
||||
saveActiveFrame(*guest.machine.snapshot().frame, "atlas-input.ppm");
|
||||
}
|
||||
guest.type("MARS\r");
|
||||
guest.until("START WITH A DIGIT");
|
||||
guest.type("4294967298\r");
|
||||
guest.until("CHOOSE A NUMBER FROM 1 TO 4");
|
||||
guest.type("0X2\r");
|
||||
expectTrip(guest, 24, "VENUS: CLOUDS", "CANNOT SAVE VISIT");
|
||||
guest.verifyReturn();
|
||||
|
||||
openAtlas(guest, binary);
|
||||
guest.type("2\r");
|
||||
expectTrip(guest, 24, "VENUS: CLOUDS", "CANNOT SAVE VISIT");
|
||||
guest.verifyReturn();
|
||||
require(volume(guest) == original, "Protected atlas changed");
|
||||
}
|
||||
|
||||
static void visitEditedDisk(const fs::path& roms, Processor cpu, Profile profile)
|
||||
{
|
||||
Session guest(roms, "edited/VOL.DSK", cpu, profile);
|
||||
guest.type("LOADM\"ATLAS\":EXEC\r");
|
||||
guest.until("PICK A PLANET (1-4), THEN ENTER");
|
||||
guest.type("4\r");
|
||||
expectTrip(guest, 72, "MARS: DUST STORM", "VISIT SAVED\nATLAS CLOSED");
|
||||
guest.verifyReturn();
|
||||
saveVolume(guest, "edited-atlas.dsk");
|
||||
}
|
||||
|
||||
static void visitUnchangedDisk(const fs::path& roms, const fs::path& binary, Processor cpu,
|
||||
Profile profile, const fs::path& disk, const std::string& expected)
|
||||
{
|
||||
Session guest(roms, disk, cpu, profile);
|
||||
openAtlas(guest, binary);
|
||||
guest.type("4\r");
|
||||
guest.until(expected);
|
||||
guest.verifyReturn();
|
||||
guest.verifyMedia();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
require(argc == 6, "Usage: run ROMDIR BIN CPU PROFILE CAPTURE");
|
||||
const auto cpu = std::string(argv[3]) == "6809" ? Processor::MC6809 : Processor::HD6309;
|
||||
const std::string mode = argv[4];
|
||||
const auto profile = mode == "disk" ? Profile::fd : mode == "rgb-hd" ? Profile::rgbHD : Profile::sdc;
|
||||
visitPracticeDisk(argv[1], argv[2], cpu, profile, std::string(argv[5]) == "capture");
|
||||
visitEditedDisk(argv[1], cpu, profile);
|
||||
visitUnchangedDisk(argv[1], argv[2], cpu, profile, "short/VOL.DSK", "CANNOT READ ATLAS CARD");
|
||||
visitUnchangedDisk(argv[1], argv[2], cpu, profile, "full/VOL.DSK", "NO ROOM FOR VISIT MARK\nATLAS CLOSED");
|
||||
} catch (const std::exception& error) {
|
||||
std::cerr << error.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user