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,108 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "../basic-disk-session.h"
|
||||
|
||||
using namespace BasicDiskTests;
|
||||
|
||||
static void start(Session& guest, const fs::path& binary, char selection)
|
||||
{
|
||||
guest.launch(binary);
|
||||
guest.until("SELECT SDC TEST");
|
||||
guest.type(std::string(1, selection));
|
||||
guest.until("SDC CHECKS PASSED");
|
||||
}
|
||||
|
||||
static void available(const fs::path& roms, const fs::path& disk, Processor cpu,
|
||||
const fs::path& binary, bool protect)
|
||||
{
|
||||
Session guest(roms, disk, cpu, Profile::sdc);
|
||||
guest.sdc->setWriteProtected(protect);
|
||||
start(guest, binary, protect ? 'S' : 'W');
|
||||
const auto state = guest.sdc->snapshot();
|
||||
require(state.currentDirectory == "/" && state.drives[0].name == "/BOOT.DSK" &&
|
||||
state.drives[1].name == "/SURVEY/MARS.DSK", "Wrong final SDC mount or current directory");
|
||||
require(state.drives[1].reads > 0 && !state.drives[1].writes, "Unexpected SDC activity");
|
||||
guest.verifyReturn();
|
||||
// SDC-DOS must still be able to take over the controller from the SDK.
|
||||
guest.type("DIR 1\r");
|
||||
guest.until("ROVER");
|
||||
guest.type("DIR 0\r");
|
||||
guest.until("BOOTMAP");
|
||||
guest.verifyMedia();
|
||||
}
|
||||
|
||||
static void unavailable(const fs::path& roms, const fs::path& disk, Processor cpu,
|
||||
const fs::path& binary, bool split)
|
||||
{
|
||||
Session guest(roms, disk, cpu, split ? Profile::sdc : Profile::fd);
|
||||
if (split) {
|
||||
// The ROM still identifies as SDC while all controller I/O goes to a real FD-502.
|
||||
guest.floppy = std::make_shared<Fd502Device>(readFile(roms / "disk11.rom"));
|
||||
guest.floppy->mount(0, DiskImage::load(guest.original));
|
||||
guest.machine.cartridges().configure({nullptr, nullptr, nullptr, guest.floppy, guest.sdc}, true, 4);
|
||||
guest.machine.cartridges().writePort(0x7f, 0x32);
|
||||
}
|
||||
const auto before = guest.floppy->snapshot();
|
||||
const auto reads = guest.floppy->readEvents(0);
|
||||
start(guest, binary, 'F');
|
||||
const auto after = guest.floppy->snapshot();
|
||||
require(after.drive == before.drive && after.track == before.track && after.sector == before.sector &&
|
||||
after.motor == before.motor && before.head == after.head && guest.floppy->readEvents(0) == reads,
|
||||
"SDC probing touched the FD-502");
|
||||
const auto& bus = guest.machine.cartridges();
|
||||
require(bus.romSlot() == 4 && bus.ioSlot() == (split ? 3 : 4), "Guest changed MPI routing");
|
||||
if (split) guest.machine.cartridges().writePort(0x7f, 0x33);
|
||||
guest.verifyReturn();
|
||||
guest.verifyMedia();
|
||||
}
|
||||
|
||||
// Inject a stuck BUSY bit into two otherwise genuine SDC-DOS transactions.
|
||||
// Leaving command mode permits the next transaction to proceed normally.
|
||||
class BusyController final : public CartridgeDevice {
|
||||
public:
|
||||
explicit BusyController(SDCDevice& device) : sdc(device) {}
|
||||
unsigned remaining = 2;
|
||||
void reset() override { sdc.reset(); }
|
||||
void horizontalSync(DeviceHost& host) override { sdc.horizontalSync(host); }
|
||||
std::uint8_t readMemory(std::uint16_t address) const override { return sdc.readMemory(address); }
|
||||
std::uint8_t readPort(std::uint8_t port, DeviceHost& host) override {
|
||||
return stall && port == 0x48 ? 1 : sdc.readPort(port, host);
|
||||
}
|
||||
void writePort(std::uint8_t port, std::uint8_t value, DeviceHost& host) override {
|
||||
if (port == 0x48 && remaining) stall = true;
|
||||
if (port == 0x40 && value == 0 && stall) { stall = false; --remaining; }
|
||||
sdc.writePort(port, value, host);
|
||||
}
|
||||
private:
|
||||
SDCDevice& sdc;
|
||||
bool stall = false;
|
||||
};
|
||||
|
||||
static void timeout(const fs::path& roms, const fs::path& disk, Processor cpu, const fs::path& binary)
|
||||
{
|
||||
Session guest(roms, disk, cpu, Profile::sdc);
|
||||
auto fault = std::make_shared<BusyController>(*guest.sdc);
|
||||
guest.machine.cartridges().configure({nullptr, nullptr, nullptr, nullptr, fault}, true, 4);
|
||||
start(guest, binary, 'T');
|
||||
require(fault->remaining == 0, "Both timed-out commands must release the controller");
|
||||
guest.verifyReturn();
|
||||
guest.verifyMedia();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
require(argc == 4, "Usage: run ROMS DISK BIN");
|
||||
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
|
||||
available(argv[1], argv[2], cpu, argv[3], true);
|
||||
available(argv[1], argv[2], cpu, argv[3], false);
|
||||
unavailable(argv[1], argv[2], cpu, argv[3], false);
|
||||
unavailable(argv[1], argv[2], cpu, argv[3], true);
|
||||
timeout(argv[1], argv[2], cpu, argv[3]);
|
||||
std::cout << "PASS " << (cpu == Processor::MC6809 ? "6809" : "6309")
|
||||
<< " SDC-DOS, FD-502, split MPI, stuck BUSY recovery and Disk BASIC reads\n";
|
||||
}
|
||||
} catch (const std::exception& error) {
|
||||
std::cerr << error.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user