1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Updates autotests to new RomFetcher world.

This commit is contained in:
Thomas Harte 2021-06-06 20:34:55 -04:00
parent dd64aef910
commit f27e331462
6 changed files with 31 additions and 17 deletions

View File

@ -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;
}
}

View File

@ -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<ROM::Name, std::vector<uint8_t>>;

View File

@ -35,7 +35,8 @@ class VanillaSerialPort: public Commodore::Serial::Port {
_serialPort = std::make_shared<VanillaSerialPort>();
auto rom_fetcher = CSROMFetcher();
_c1540 = std::make_unique<Commodore::C1540::Machine>(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::Machine>(Commodore::C1540::Personality::C1540, roms);
_c1540->set_serial_bus(_serialBus);
Commodore::Serial::AttachPortAndBus(_serialPort, _serialBus);
}

View File

@ -103,21 +103,20 @@ class EmuTOS: public ComparativeBusHandler {
std::unique_ptr<EmuTOS> _machine;
}
- (void)testImage:(NSString *)image trace:(NSString *)trace length:(int)length {
const std::vector<ROMMachine::ROM> 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<EmuTOS>(*roms[0], traceLocation.fileSystemRepresentation);
_machine = std::make_unique<EmuTOS>(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

View File

@ -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<ROMMachine::ROM> 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<QL>(*roms[0], traceLocation.UTF8String);
_machine = std::make_unique<QL>(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));

View File

@ -24,8 +24,10 @@ struct ContentionAnalysis {
HalfCycles pattern[8];
};
template <Sinclair::ZXSpectrum::VideoTiming video_timing> ContentionAnalysis analyse() {
Sinclair::ZXSpectrum::Video<video_timing> video;
using Timing = Sinclair::ZXSpectrum::Video::Timing;
template <Timing video_timing> ContentionAnalysis analyse() {
Sinclair::ZXSpectrum::Video::Video<video_timing> video;
ContentionAnalysis analysis;
// Advance to the start of the first interrupt.
@ -82,7 +84,7 @@ template <Sinclair::ZXSpectrum::VideoTiming video_timing> ContentionAnalysis ana
}
- (void)test48k {
const auto analysis = analyse<Sinclair::ZXSpectrum::VideoTiming::FortyEightK>();
const auto analysis = analyse<Timing::FortyEightK>();
// Check time from interrupt.
XCTAssertEqual(analysis.time_after_interrupt, 14335*2);
@ -105,7 +107,7 @@ template <Sinclair::ZXSpectrum::VideoTiming video_timing> ContentionAnalysis ana
}
- (void)test128k {
const auto analysis = analyse<Sinclair::ZXSpectrum::VideoTiming::OneTwoEightK>();
const auto analysis = analyse<Timing::OneTwoEightK>();
// Check time from interrupt.
XCTAssertEqual(analysis.time_after_interrupt, 14361*2);
@ -128,7 +130,7 @@ template <Sinclair::ZXSpectrum::VideoTiming video_timing> ContentionAnalysis ana
}
- (void)testPlus3 {
const auto analysis = analyse<Sinclair::ZXSpectrum::VideoTiming::Plus3>();
const auto analysis = analyse<Timing::Plus3>();
// Check time from interrupt.
XCTAssertEqual(analysis.time_after_interrupt, 14361*2);