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

+209
View File
@@ -0,0 +1,209 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../guest-captures.h"
using namespace BasicDiskTests;
static void atPrompt(Session& g)
{
g.verifyReturn();
g.type("CLS\r");
g.frames(15);
}
static std::string basicSource(const fs::path& path)
{
auto bytes = readFile(path);
return {bytes.begin(), bytes.end()};
}
static void basic(Session& g, const std::string& source)
{
g.machine.basicLoadSource(source, true);
}
static void selectC(Session& g, const char* binary, const char* prompt, const char* choice)
{
g.launch(binary);
g.until(prompt);
g.type(choice);
}
static void play(Session& g, const Bytes& image, TapeFormat format = TapeFormat::CAS)
{
auto& tape = g.machine.cassette();
tape.mount(image, format);
tape.play();
}
static Bytes finishRecording(Session& g, const char* marker)
{
g.until(marker);
g.until("OK");
auto& tape = g.machine.cassette();
require(tape.snapshot().writeEvents && !tape.snapshot().motor, "Recording should finish with the motor off");
auto image = tape.exportImage();
require(!image.empty(), "Recorder did not produce an image");
atPrompt(g);
return image;
}
static void checkScreen(Session& g, const std::string& expected)
{
auto screen = g.machine.copyScreenText();
require(screen.find(expected) != std::string::npos, "Unexpected flight records:\n" + screen);
}
static std::size_t blockSync(const Bytes& tape, unsigned type)
{
const Bytes pattern = {0x55, 0x3c, static_cast<std::uint8_t>(type)};
auto p = std::search(tape.begin(), tape.end(), pattern.begin(), pattern.end());
require(p != tape.end(), "Expected filename/data/EOF block in the real recording");
return static_cast<std::size_t>(p - tape.begin()) + 1;
}
int main(int argc, char** argv)
{
try {
require(argc == 7, "Usage: run ROM-DIRECTORY DISK CPU LESSONS STARTER-CAS SETUP");
const fs::path lessons = argv[4];
const auto reader = basicSource(lessons / "flightread.bas");
const auto writer = basicSource(lessons / "flightwrite.bas");
const auto cpu = std::string(argv[3]) == "6809" ? Processor::MC6809 : Processor::HD6309;
const std::string setup = argv[6];
const auto profile = setup == "sdc" ? Profile::sdc : setup == "rgb-hd" ? Profile::rgbHD : Profile::fd;
const auto format = setup == "wav" ? TapeFormat::WAV : TapeFormat::CAS;
Session g(argv[1], argv[2], cpu, profile);
auto& tape = g.machine.cassette();
tape.record(format);
selectC(g, "FLIGHT.BIN", "W WRITE R READ", "W");
const auto fromC = finishRecording(g, "FLIGHT SAVED");
play(g, fromC, format);
basic(g, reader);
g.until("END OF FLIGHT");
checkScreen(g, "EARTH BLUE SEA\nMARS RED RIDGE\nEND OF FLIGHT");
atPrompt(g);
tape.record(format);
basic(g, writer);
const auto fromBASIC = finishRecording(g, "FLIGHT SAVED");
play(g, fromBASIC, format);
selectC(g, "FLIGHT.BIN", "W WRITE R READ", "R");
g.until("END OF FLIGHT");
checkScreen(g, "EARTH TIDE POOL\nMARS DUST DEVIL\nEND OF FLIGHT");
g.until("OK");
g.frames(3);
if (setup != "disk") {
atPrompt(g);
g.verifyMedia();
return 0;
}
saveActiveFrame(*g.machine.snapshot().frame, "flight.ppm");
atPrompt(g);
tape.record(TapeFormat::CAS);
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "W");
play(g, finishRecording(g, "CASSETTE CHECK PASSED"));
basic(g, "10 OPEN \"I\",#-1,\"Flight\"\n20 IF NOT EOF(-1) THEN PRINT \"FAIL LINE 20\":END\n"
"30 CLOSE #-1:PRINT \"EMPTY IN BASIC\"\n");
g.until("EMPTY IN BASIC");
atPrompt(g);
tape.record(TapeFormat::CAS);
basic(g, "10 OPEN \"O\",#-1,\"Flight\"\n20 CLOSE #-1:PRINT \"BASIC EMPTY SAVED\"\n");
play(g, finishRecording(g, "BASIC EMPTY SAVED"));
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "E");
g.until("CASSETTE CHECK PASSED");
atPrompt(g);
tape.record(TapeFormat::CAS);
basic(g, "10 OPEN \"O\",#-1,\"FLIGHT\"\n20 PRINT #-1,STRING$(180,65)\n"
"30 PRINT #-1,STRING$(180,66)\n40 PRINT #-1,\"\"\n45 PRINT #-1,\"TAIL\";\n50 CLOSE #-1:PRINT \"BLOCKS SAVED\"\n");
play(g, finishRecording(g, "BLOCKS SAVED"));
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "B");
g.until("CASSETTE CHECK PASSED");
atPrompt(g);
tape.record(TapeFormat::CAS);
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "P");
play(g, finishRecording(g, "CASSETTE CHECK PASSED"));
basic(g, "10 CLEAR 1024:OPEN \"I\",#-1,\"FLIGHT\"\n"
"20 FOR I=65 TO 66:LINE INPUT #-1,A$\n"
"30 IF A$<>STRING$(180,I) THEN PRINT \"FAIL LINE 30\":END\n40 NEXT I\n"
"50 LINE INPUT #-1,A$:IF LEN(A$)<>0 THEN PRINT \"FAIL LINE 50\":END\n"
"60 IF NOT EOF(-1) THEN PRINT \"FAIL LINE 60\":END\n70 CLOSE #-1:PRINT \"C BLOCKS VERIFIED\"\n");
g.until("C BLOCKS VERIFIED");
atPrompt(g);
// The reader must pass an unrelated named file, consume a too-long line, then read the next.
tape.record(TapeFormat::CAS);
basic(g, "5 OPEN \"O\",#-1,\"OTHER\":PRINT #-1,\"IGNORE ME\":CLOSE #-1\n" + writer);
play(g, finishRecording(g, "FLIGHT SAVED"));
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "L");
g.until("CASSETTE CHECK PASSED");
atPrompt(g);
// Program files can have consecutive blocks with short leaders. Search past the
// bundled tokenized BASIC program to reach a BASIC-written sequential data file.
auto mixed = readFile(argv[5]);
mixed.insert(mixed.end(), fromBASIC.begin(), fromBASIC.end());
for (bool fast : {false, true}) {
tape.setFast(fast);
play(g, mixed);
selectC(g, "FLIGHT.BIN", "W WRITE R READ", "R");
g.until("END OF FLIGHT");
checkScreen(g, "EARTH TIDE POOL\nMARS DUST DEVIL\nEND OF FLIGHT");
atPrompt(g);
}
tape.setFast(false);
// Cut the real BASIC recording within a data block, at the end marker, and before its checksum.
const auto data = blockSync(fromBASIC, 1);
const auto end = blockSync(fromBASIC, 255);
for (auto length : {data + 6, end, end + 3}) {
play(g, Bytes(fromBASIC.begin(), fromBASIC.begin() + length));
selectC(g, "FLIGHT.BIN", "W WRITE R READ", "R");
g.until("TAPE ERROR");
const auto screen = g.machine.copyScreenText();
require(screen.find("END OF FLIGHT") == screen.npos, "A short tape was accepted as EOF");
require(!tape.snapshot().motor, "C left the motor running after a read error");
atPrompt(g);
}
play(g, Bytes(fromBASIC.begin(), fromBASIC.begin() + end));
selectC(g, "QUAL.BIN", "EMPTY OR BLOCK CHECK", "T");
g.until("MOUNT GOOD TAPE AND PRESS R");
require(!tape.snapshot().motor, "Close after read error left motor on");
play(g, fromBASIC);
g.type("R");
g.until("CASSETTE CHECK PASSED");
atPrompt(g);
auto damaged = fromC;
const auto dataSync = blockSync(damaged, 1);
damaged[dataSync + 3 + damaged.at(dataSync + 2)] ^= 1; // corrupt only the checksum
play(g, damaged);
basic(g, reader);
g.until("?IO ERROR");
// Reset the ROM after its error before starting the separate physical-end test.
g.machine.softReset();
g.machine.resume();
g.frames(300);
g.type("CLS\r");
g.frames(15);
// The unmodified BASIC ROM has no missing-carrier timeout. Check the guest at physical end,
// then observe another five guest seconds; a truncated C tape must never yield the EOF marker.
play(g, Bytes(fromC.begin(), fromC.begin() + blockSync(fromC, 255)));
basic(g, reader);
for (unsigned i = 0; i < 1500 && tape.snapshot().position < tape.snapshot().length; ++i) g.frames(1);
require(tape.snapshot().position == tape.snapshot().length, "BASIC did not reach the cut");
g.frames(300);
const auto screen = g.machine.copyScreenText();
require(screen.find("END OF FLIGHT") == screen.npos && tape.snapshot().motor &&
tape.snapshot().mode == TapeMode::Stopped, "BASIC reported a completed file on a truncated tape:\n" + screen);
g.verifyMedia();
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}