From f27e331462e7a204bba1aae207173e144749bd46 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 6 Jun 2021 20:34:55 -0400 Subject: [PATCH] Updates autotests to new RomFetcher world. --- Machines/Utility/ROMCatalogue.cpp | 10 ++++++++-- Machines/Utility/ROMCatalogue.hpp | 5 +++++ .../Mac/Clock SignalTests/Bridges/C1540Bridge.mm | 3 ++- OSBindings/Mac/Clock SignalTests/EmuTOSTests.mm | 11 +++++------ OSBindings/Mac/Clock SignalTests/QLTests.mm | 7 ++++--- .../SpectrumVideoContentionTests.mm | 12 +++++++----- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Machines/Utility/ROMCatalogue.cpp b/Machines/Utility/ROMCatalogue.cpp index 734538247..5b2d1a24a 100644 --- a/Machines/Utility/ROMCatalogue.cpp +++ b/Machines/Utility/ROMCatalogue.cpp @@ -408,8 +408,9 @@ Description::Description(Name name) { *this = Description(name, "Macintosh", "the Macintosh Plus ROM", "macplus.rom", 128*1024, crcs); } break; - case Name::AtariSTTOS100: *this = Description(name, "AtariST", "the UK TOS 1.00 ROM", "tos100.img", 192*1024, 0x1a586c64u); break; - case Name::AtariSTTOS104: *this = Description(name, "AtariST", "the UK TOS 1.04 ROM", "tos104.img", 192*1024, 0xa50d1d43u); break; + case Name::AtariSTTOS100: *this = Description(name, "AtariST", "the UK TOS 1.00 ROM", "tos100.img", 192*1024, 0x1a586c64u); break; + case Name::AtariSTTOS104: *this = Description(name, "AtariST", "the UK TOS 1.04 ROM", "tos104.img", 192*1024, 0xa50d1d43u); break; + case Name::AtariSTEmuTOS192: *this = Description(name, "AtariST", "the UK EmuTOS 1.92 ROM", "etos192uk.img", 192*1024, 0xfc3b9e61u); break; case Name::ColecoVisionBIOS: *this = Description(name, "ColecoVision", "the ColecoVision BIOS", "coleco.rom", 8*1024, 0x3aa93ef3u); @@ -469,5 +470,10 @@ Description::Description(Name name) { case Name::MSXAmericanBIOS: *this = Description(name, "MSX", "an American MSX BIOS", "msx-american.rom", 32*1024, 0u); break; case Name::MSXEuropeanBIOS: *this = Description(name, "MSX", "a European MSX BIOS", "msx-european.rom", 32*1024, 0u); break; case Name::MSXDOS: *this = Description(name, "MSX", "the MSX-DOS ROM", "disk.rom", 16*1024, 0x721f61dfu); break; + + case Name::SinclairQLJS: + *this = Description(name, "SinclairQL", "the Sinclair QL 'JS' ROM", "js.rom", 48*1024, 0x0f95aab5u); + break; + } } diff --git a/Machines/Utility/ROMCatalogue.hpp b/Machines/Utility/ROMCatalogue.hpp index 3dfb2542d..c3d541915 100644 --- a/Machines/Utility/ROMCatalogue.hpp +++ b/Machines/Utility/ROMCatalogue.hpp @@ -55,6 +55,7 @@ enum Name { // Atari ST. AtariSTTOS100, AtariSTTOS104, + AtariSTEmuTOS192, // ColecoVision. ColecoVisionBIOS, @@ -95,6 +96,9 @@ enum Name { OricMicrodisc, Oric8DOSBoot, + // Sinclair QL. + SinclairQLJS, + // Vic-20. Vic20BASIC, Vic20EnglishCharacters, @@ -116,6 +120,7 @@ enum Name { Spectrum128k, SpecrumPlus2, SpectrumPlus3, + }; using Map = std::map>; diff --git a/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm b/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm index 9932ae35f..449ea3e8e 100644 --- a/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm +++ b/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm @@ -35,7 +35,8 @@ class VanillaSerialPort: public Commodore::Serial::Port { _serialPort = std::make_shared(); auto rom_fetcher = CSROMFetcher(); - _c1540 = std::make_unique(Commodore::C1540::Personality::C1540, rom_fetcher); + auto roms = rom_fetcher(Commodore::C1540::Machine::rom_request(Commodore::C1540::Personality::C1540)); + _c1540 = std::make_unique(Commodore::C1540::Personality::C1540, roms); _c1540->set_serial_bus(_serialBus); Commodore::Serial::AttachPortAndBus(_serialPort, _serialBus); } diff --git a/OSBindings/Mac/Clock SignalTests/EmuTOSTests.mm b/OSBindings/Mac/Clock SignalTests/EmuTOSTests.mm index 9c50a04a5..978d6387e 100644 --- a/OSBindings/Mac/Clock SignalTests/EmuTOSTests.mm +++ b/OSBindings/Mac/Clock SignalTests/EmuTOSTests.mm @@ -103,21 +103,20 @@ class EmuTOS: public ComparativeBusHandler { std::unique_ptr _machine; } -- (void)testImage:(NSString *)image trace:(NSString *)trace length:(int)length { - const std::vector rom_names = {{"AtariST", "", image.UTF8String, 0, 0 }}; - const auto roms = CSROMFetcher()(rom_names); +- (void)testImage:(ROM::Name)name trace:(NSString *)trace length:(int)length { + const auto roms = CSROMFetcher()(ROM::Request(name)); NSString *const traceLocation = [[NSBundle bundleForClass:[self class]] pathForResource:trace ofType:@"trace.txt.gz"]; - _machine = std::make_unique(*roms[0], traceLocation.fileSystemRepresentation); + _machine = std::make_unique(roms.find(name)->second, traceLocation.fileSystemRepresentation); _machine->run_for(HalfCycles(length)); } - (void)testEmuTOSStartup { - [self testImage:@"etos192uk.img" trace:@"etos192uk" length:313490]; + [self testImage:ROM::Name::AtariSTEmuTOS192 trace:@"etos192uk" length:313490]; // TODO: assert that machine is now STOPped. } - (void)testTOSStartup { - [self testImage:@"tos100.img" trace:@"tos100" length:54011091]; + [self testImage:ROM::Name::AtariSTTOS100 trace:@"tos100" length:54011091]; } @end diff --git a/OSBindings/Mac/Clock SignalTests/QLTests.mm b/OSBindings/Mac/Clock SignalTests/QLTests.mm index 3df640dc2..79f32f10c 100644 --- a/OSBindings/Mac/Clock SignalTests/QLTests.mm +++ b/OSBindings/Mac/Clock SignalTests/QLTests.mm @@ -101,10 +101,11 @@ class QL: public ComparativeBusHandler { Tests the progression of Clock Signal's 68000 through the Sinclair QL's ROM against a known-good trace. */ - (void)testStartup { - const std::vector rom_names = {{"SinclairQL", "", "js.rom", 0, 0 }}; - const auto roms = CSROMFetcher()(rom_names); + constexpr ROM::Name rom_name = ROM::Name::SinclairQLJS; + ROM::Request request(rom_name); + const auto roms = CSROMFetcher()(request); NSString *const traceLocation = [[NSBundle bundleForClass:[self class]] pathForResource:@"qltrace" ofType:@".txt.gz"]; - _machine = std::make_unique(*roms[0], traceLocation.UTF8String); + _machine = std::make_unique(roms.find(rom_name)->second, traceLocation.UTF8String); // This is how many cycles it takes to exhaust the supplied trace file. _machine->run_for(HalfCycles(23923180)); diff --git a/OSBindings/Mac/Clock SignalTests/SpectrumVideoContentionTests.mm b/OSBindings/Mac/Clock SignalTests/SpectrumVideoContentionTests.mm index 79c454a6c..c3c1c4cdc 100644 --- a/OSBindings/Mac/Clock SignalTests/SpectrumVideoContentionTests.mm +++ b/OSBindings/Mac/Clock SignalTests/SpectrumVideoContentionTests.mm @@ -24,8 +24,10 @@ struct ContentionAnalysis { HalfCycles pattern[8]; }; -template ContentionAnalysis analyse() { - Sinclair::ZXSpectrum::Video video; +using Timing = Sinclair::ZXSpectrum::Video::Timing; + +template ContentionAnalysis analyse() { + Sinclair::ZXSpectrum::Video::Video video; ContentionAnalysis analysis; // Advance to the start of the first interrupt. @@ -82,7 +84,7 @@ template ContentionAnalysis ana } - (void)test48k { - const auto analysis = analyse(); + const auto analysis = analyse(); // Check time from interrupt. XCTAssertEqual(analysis.time_after_interrupt, 14335*2); @@ -105,7 +107,7 @@ template ContentionAnalysis ana } - (void)test128k { - const auto analysis = analyse(); + const auto analysis = analyse(); // Check time from interrupt. XCTAssertEqual(analysis.time_after_interrupt, 14361*2); @@ -128,7 +130,7 @@ template ContentionAnalysis ana } - (void)testPlus3 { - const auto analysis = analyse(); + const auto analysis = analyse(); // Check time from interrupt. XCTAssertEqual(analysis.time_after_interrupt, 14361*2);