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,51 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Exercise guest C printer output and compare the emulator's raw captured bytes."""
|
||||
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 a real guest screen 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, VCC_CMOC_COMPAT="1", PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-printer-") as tmp:
|
||||
work = Path(tmp)
|
||||
|
||||
def run(*cmd):
|
||||
subprocess.run(cmd, cwd=work, 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")
|
||||
card = work / "card"
|
||||
card.mkdir()
|
||||
(card / "startup.cfg").write_text("0=VOL.DSK\n")
|
||||
for opt in ("-O0", "-O2"):
|
||||
for source, binary in ((root / "examples/cmoc/manual/flightreport.c", "FLIGHT.BIN"),
|
||||
(fixture / "qualification.c", "QUAL.BIN")):
|
||||
run(runtime / "bin/cmoc", "--coco", opt, "-Werror", "--org=2800",
|
||||
"-o", binary, source, "-lvcccompat")
|
||||
shutil.copyfile(root / "docs/manuals/software-storage-and-peripherals/media/BLANK.DSK", card / "VOL.DSK")
|
||||
run(runtime / "bin/writecocofile", card / "VOL.DSK", "FLIGHT.BIN")
|
||||
for cpu in ("6809", "6309"):
|
||||
for profile in ("disk", "rgb-hd", "sdc"):
|
||||
capture = args.capture and (cpu, opt, profile) == ("6809", "-O2", "disk")
|
||||
run("./run", roms, cpu, profile, "capture" if capture else "check")
|
||||
if capture:
|
||||
run("sips", "-s", "format", "png", "flight.ppm", "--out", args.capture.resolve())
|
||||
print(f"PASS {cpu} {opt} {profile}: direct and disk launch, capture off/on, raw flight report, "
|
||||
"variadic formatting, device and console hook restoration, BASIC return", flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include <coco.h>
|
||||
#include <stdarg.h>
|
||||
#include <vcc/printer.h>
|
||||
|
||||
static int sendArgs(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int count = vcc_printer_vprintf(format, args);
|
||||
va_end(args);
|
||||
return count;
|
||||
}
|
||||
|
||||
/* A custom console hook receives A and must preserve B, X, Y and U. */
|
||||
static asm void ignoreConsoleCharacter(void)
|
||||
{
|
||||
asm { rts }
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const byte *device = (const byte *)0x006F; /* BASIC DEVNUM */
|
||||
ConsoleOutHook savedHook;
|
||||
int count, invalid, nullFormat, empty, previousDevicePreserved;
|
||||
cls(1);
|
||||
setOutputDevice(DEV_CASSETTE);
|
||||
savedHook = setConsoleOutHook(ignoreConsoleCharacter);
|
||||
count = sendArgs("%04u %-4s %c %%\n", 9U, "IO", 'X');
|
||||
invalid = vcc_printer_printf("PREFIX%f");
|
||||
nullFormat = vcc_printer_printf(NULL);
|
||||
empty = vcc_printer_printf("");
|
||||
previousDevicePreserved = *device == (byte)DEV_CASSETTE;
|
||||
ConsoleOutHook active = setConsoleOutHook(savedHook);
|
||||
setOutputDevice(DEV_SCREEN);
|
||||
if (count != 14 || invalid >= 0 || nullFormat >= 0 || empty != 0 || !previousDevicePreserved ||
|
||||
active != ignoreConsoleCharacter)
|
||||
{
|
||||
printf("FAIL LINE %u COUNT %d\n", (unsigned)__LINE__, count);
|
||||
return 1;
|
||||
}
|
||||
printf("PRINTER CHECKS PASSED\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "../guest-captures.h"
|
||||
|
||||
using namespace BasicDiskTests;
|
||||
|
||||
static void sendReport(Session& guest)
|
||||
{
|
||||
guest.until("PRESS SPACE TO SEND REPORT");
|
||||
guest.type(" ");
|
||||
guest.until("REPORT SENT TO PRINTER PORT");
|
||||
const auto screen = guest.machine.copyScreenText();
|
||||
require(screen.find("BLUE SEA") == std::string::npos && screen.find("RED RIDGE") == std::string::npos,
|
||||
"Printer lines leaked onto the CoCo display");
|
||||
guest.until("OK");
|
||||
}
|
||||
|
||||
static void checkBytes(const PrinterCapture& printer, const std::string& expected)
|
||||
{
|
||||
const auto& actual = printer.bytes();
|
||||
require(std::string(actual.begin(), actual.end()) == expected && printer.droppedBytes() == 0,
|
||||
"Unexpected raw printer data (" + std::to_string(actual.size()) + " bytes): " +
|
||||
std::string(actual.begin(), actual.end()));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
require(argc == 5, "Usage: run ROMDIR CPU PROFILE CAPTURE");
|
||||
const auto cpu = std::string(argv[2]) == "6809" ? Processor::MC6809 : Processor::HD6309;
|
||||
const std::string mode = argv[3];
|
||||
const auto profile = mode == "disk" ? Profile::fd : mode == "rgb-hd" ? Profile::rgbHD : Profile::sdc;
|
||||
Session guest(argv[1], "card/VOL.DSK", cpu, profile);
|
||||
auto& printer = guest.machine.printer();
|
||||
require(!printer.enabled(), "Capture should start off");
|
||||
guest.launch("FLIGHT.BIN");
|
||||
sendReport(guest);
|
||||
checkBytes(printer, "");
|
||||
|
||||
guest.verifyReturn();
|
||||
guest.type("CLS\r");
|
||||
printer.setEnabled(true);
|
||||
guest.launch("FLIGHT.BIN");
|
||||
sendReport(guest);
|
||||
const std::string report = "TP-10 FLIGHT REPORT\r01 EARTH BLUE SEA\r02 MARS RED RIDGE\rEND OF REPORT\r";
|
||||
checkBytes(printer, report);
|
||||
guest.verifyReturn();
|
||||
|
||||
guest.type("CLS\r");
|
||||
guest.type("LOADM\"FLIGHT\":EXEC\r");
|
||||
sendReport(guest);
|
||||
checkBytes(printer, report + report);
|
||||
if (std::string(argv[4]) == "capture") {
|
||||
guest.frames(3);
|
||||
saveActiveFrame(*guest.machine.snapshot().frame, "flight.ppm");
|
||||
}
|
||||
|
||||
guest.verifyReturn();
|
||||
guest.launch("QUAL.BIN");
|
||||
guest.until("PRINTER CHECKS PASSED");
|
||||
guest.verifyReturn();
|
||||
checkBytes(printer, report + report + "0009 IO X %\rPREFIX");
|
||||
guest.verifyMedia();
|
||||
} catch (const std::exception& error) {
|
||||
std::cerr << error.what() << '\n';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user