123 lines
6.8 KiB
C++
123 lines
6.8 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#include "CoreChecks.h"
|
|
#include <cstdio>
|
|
#include <exception>
|
|
#include <cstring>
|
|
int main(int argc, char** argv) {
|
|
if (argc == 5 && std::strcmp(argv[1], "--graphics-rom") == 0) {
|
|
try { CheckGraphicsPreviewRom(argv[2], argv[3], argv[4]); return 0; }
|
|
catch (const std::exception& error) { std::fprintf(stderr, "FAIL: %s\n", error.what()); return 1; }
|
|
}
|
|
if (argc == 4 && std::strcmp(argv[1], "--basic-rom") == 0) {
|
|
try { CheckBasicProgramRom(argv[2],argv[3]); return 0; }
|
|
catch(const std::exception& e) { std::fprintf(stderr,"FAIL: %s\n",e.what()); return 1; }
|
|
}
|
|
if (argc == 6 && std::strcmp(argv[1], "--speech-rom") == 0) {
|
|
try { CheckSpeechSoundRom(argv[2],argv[3],argv[4],argv[5]); return 0; }
|
|
catch(const std::exception& e) { std::fprintf(stderr,"%s\n",e.what()); return 1; }
|
|
}
|
|
if (argc == 5 && std::strcmp(argv[1], "--orchestra-rom") == 0) {
|
|
try { CheckOrchestraRom(argv[2],argv[3],argv[4]); return 0; }
|
|
catch(const std::exception& error) { std::fprintf(stderr,"FAIL: %s\n",error.what()); return 1; }
|
|
}
|
|
if (argc == 3 && std::strcmp(argv[1], "--clipboard-rom") == 0) {
|
|
try { CheckClipboardRom(argv[2]); return 0; }
|
|
catch(const std::exception& error) { std::fprintf(stderr,"FAIL: %s\n",error.what()); return 1; }
|
|
}
|
|
if (argc == 6 && std::strcmp(argv[1], "--nitros9-profile") == 0) {
|
|
try { CheckHardDiskRom(argv[2],argv[3],argv[4],argv[5]); return 0; }
|
|
catch(const std::exception& error) { std::fprintf(stderr,"FAIL: %s\n",error.what()); return 1; }
|
|
}
|
|
if (argc == 6 && std::strcmp(argv[1], "--hard-basic-media") == 0) {
|
|
try { CreateHardBasicMedia(argv[2],argv[3],argv[4],argv[5]); return 0; }
|
|
catch(const std::exception& error) { std::fprintf(stderr,"FAIL: %s\n",error.what()); return 1; }
|
|
}
|
|
if (argc == 5 && std::strcmp(argv[1], "--starter-media") == 0) {
|
|
try { CreateStarterMedia(argv[2],argv[3],argv[4]); return 0; }
|
|
catch(const std::exception& error) { std::fprintf(stderr,"FAIL: %s\n",error.what()); return 1; }
|
|
}
|
|
if (argc != 1 && !(argc == 3 && std::strcmp(argv[1], "--rom") == 0) &&
|
|
!(argc == 4 && std::strcmp(argv[1], "--disk-rom") == 0) &&
|
|
!(argc == 5 && std::strcmp(argv[1], "--hard-disk") == 0)) {
|
|
std::fprintf(stderr, "Usage: VCCCoreChecks [--rom /path/to/coco3.rom | --disk-rom /path/to/coco3.rom /path/to/disk11.rom | --hard-disk /path/to/coco3.rom /path/to/rgbdos.rom /path/to/NitrOS9.vhd]\n"); return 2;
|
|
}
|
|
const char* current = "startup";
|
|
try {
|
|
const struct { const char* name; void (*run)(); } checks[] = {
|
|
{"DriveWireProtocol", CheckDriveWireProtocol},
|
|
{"BasicProgramTokens", CheckBasicProgramTokens},
|
|
{"BasicProgramValidation", CheckBasicProgramValidation},
|
|
{"SessionClipboard", CheckSessionClipboard},
|
|
{"FramePacing", CheckFramePacing},
|
|
{"AudioProgress", CheckAudioProgress},
|
|
{"AcceleratedTiming", CheckAcceleratedTiming},
|
|
{"MachineMemorySettings", CheckMachineMemorySettings},
|
|
{"MachinePresentationSettings", CheckMachinePresentationSettings},
|
|
{"ConfiguredOverclock", CheckConfiguredOverclock},
|
|
{"BinaryParsing", CheckBinaryParsing},
|
|
{"BinaryValidation", CheckBinaryValidation},
|
|
{"BinarySession", CheckBinarySession},
|
|
{"BinaryMappedWrites", CheckBinaryMappedWrites},
|
|
{"DiskImages", CheckDiskImages},
|
|
{"FloppyCommands", CheckFloppyCommands},
|
|
{"FloppyTransfers", CheckFloppyTransfers},
|
|
{"FloppyProtection", CheckFloppyProtection},
|
|
{"BuiltinDeviceBus", CheckBuiltinDeviceBus},
|
|
{"FloppySession", CheckFloppySession},
|
|
{"AudioBuffer", CheckAudioBuffer},
|
|
{"AudioScheduling", CheckAudioScheduling},
|
|
{"AudioRouting", CheckAudioRouting},
|
|
{"CassetteImages", CheckCassetteImages},
|
|
{"CassetteMachine", CheckCassetteMachine},
|
|
{"SessionSoftReset", CheckSessionSoftReset},
|
|
{"SessionKeyboard", CheckSessionKeyboard},
|
|
{"SessionAutomaticBoot", CheckSessionAutomaticBoot},
|
|
{"JoystickComparator", CheckJoystickComparator},
|
|
{"JoystickRamps", CheckJoystickRamps},
|
|
{"JoystickSession", CheckJoystickSession},
|
|
{"SessionVideoOutput", CheckSessionVideoOutput},
|
|
{"GraphicsPreviewModes", CheckGraphicsPreviewModes},
|
|
{"GraphicsPreviewColorSets", CheckGraphicsPreviewColorSets},
|
|
{"SessionLifecycle", CheckSessionLifecycle},
|
|
{"SessionReset", CheckSessionReset},
|
|
{"SessionFrameOwnership", CheckSessionFrameOwnership},
|
|
{"SessionExclusion", CheckSessionExclusion},
|
|
{"SessionRomValidation", CheckSessionRomValidation},
|
|
{"VideoPixels", CheckVideoPixels},
|
|
{"VideoModes", CheckVideoModes},
|
|
{"RasterTiming", CheckRasterTiming},
|
|
{"RasterPixels", CheckRasterPixels},
|
|
{"GimeTimers", CheckGimeTimers},
|
|
{"VideoLifecycle", CheckVideoLifecycle},
|
|
{"FrameStops", CheckFrameStops},
|
|
{"MmuMapping", CheckMmuMapping},
|
|
{"MmuRomAndVectors", CheckMmuRomAndVectors},
|
|
{"MmuLifecycle", CheckMmuLifecycle},
|
|
{"GimeRegisters", CheckGimeRegisters},
|
|
{"PiaRegisters", CheckPiaRegisters},
|
|
{"PiaInterrupts", CheckPiaInterrupts},
|
|
{"MappedCpuExecution", CheckMappedCpuExecution},
|
|
{"6809 execution", Check6809Execution}, {"6309 execution", Check6309Execution},
|
|
{"6809 interrupts", Check6809Interrupts}, {"6309 interrupts", Check6309Interrupts},
|
|
{"6309 native mode", Check6309Native}, {"CPU debugger", CheckCpuDebugHooks},
|
|
{"event scheduler", CheckEventScheduler}, {"RAM disk", CheckRamDisk},
|
|
{"SSC microcontroller", CheckMicrocontroller}, {"SSC bus", CheckCartridgeBus}
|
|
};
|
|
for (const auto& check : checks) {
|
|
current = check.name;
|
|
check.run();
|
|
std::printf("PASS: %s\n", current);
|
|
}
|
|
current = "existing SSC suites";
|
|
if (smoke_cpu() || smoke_sp0256() || smoke_ay8913() || smoke_ssc_core()) return 1;
|
|
std::printf("All %zu core checks passed.\n", sizeof(checks) / sizeof(checks[0]) + 4);
|
|
if (argc == 5) { current = "supplied hard disk integration"; CheckHardDiskRom(argv[2], argv[3], argv[4]); }
|
|
if (argc == 4) { current = "supplied disk ROM integration"; CheckDiskRom(argv[2], argv[3]); }
|
|
if (argc == 3) { current = "supplied ROM integration"; CheckRomBoot(argv[2]); }
|
|
return 0;
|
|
} catch (const std::exception& error) {
|
|
std::fprintf(stderr, "FAIL [%s]: %s\n", current, error.what());
|
|
return 1;
|
|
}
|
|
}
|