mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-15 14:27:29 +00:00
Sneaks towards testing EXT.
This commit is contained in:
@@ -63,7 +63,9 @@ template<Model model> uint32_t Sequence<model>::steps_for(Operation operation) {
|
|||||||
//
|
//
|
||||||
// Single operand, read-modify-write.
|
// Single operand, read-modify-write.
|
||||||
//
|
//
|
||||||
case Operation::NBCD: return Steps<
|
case Operation::NBCD:
|
||||||
|
case Operation::EXTbtow: case Operation::EXTwtol:
|
||||||
|
return Steps<
|
||||||
Step::FetchOp1,
|
Step::FetchOp1,
|
||||||
Step::Perform,
|
Step::Perform,
|
||||||
Step::StoreOp1
|
Step::StoreOp1
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
- (void)setUp {
|
- (void)setUp {
|
||||||
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
|
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
|
||||||
|
_fileSet = [NSSet setWithArray:@[@"ext.json"]];
|
||||||
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
|
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
|
||||||
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
|
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
|
||||||
}
|
}
|
||||||
@@ -216,11 +217,48 @@
|
|||||||
processor.run_for_instructions(instructions);
|
processor.run_for_instructions(instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initial test-case implementation:
|
||||||
|
// do a very sedate read and write.
|
||||||
|
|
||||||
template <typename IntT> IntT read(uint32_t address) {
|
template <typename IntT> IntT read(uint32_t address) {
|
||||||
|
if constexpr (sizeof(IntT) == 1) {
|
||||||
|
return IntT(ram[address & 0xffffff]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (sizeof(IntT) == 2) {
|
||||||
|
return IntT(
|
||||||
|
(ram[address & 0xffffff] << 8) |
|
||||||
|
ram[(address+1) & 0xffffff]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (sizeof(IntT) == 4) {
|
||||||
|
return IntT(
|
||||||
|
(ram[address & 0xffffff] << 24) |
|
||||||
|
(ram[(address+1) & 0xffffff] << 16) |
|
||||||
|
(ram[(address+2) & 0xffffff] << 8) |
|
||||||
|
ram[(address+3) & 0xffffff]
|
||||||
|
);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename IntT> void write(uint32_t address, IntT value) {
|
template <typename IntT> void write(uint32_t address, IntT value) {
|
||||||
|
if constexpr (sizeof(IntT) == 1) {
|
||||||
|
ram[address & 0xffffff] = uint8_t(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (sizeof(IntT) == 2) {
|
||||||
|
ram[address & 0xffffff] = uint8_t(value >> 8);
|
||||||
|
ram[(address+1) & 0xffffff] = uint8_t(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (sizeof(IntT) == 4) {
|
||||||
|
ram[address & 0xffffff] = uint8_t(value >> 24);
|
||||||
|
ram[(address+1) & 0xffffff] = uint8_t(value >> 16);
|
||||||
|
ram[(address+2) & 0xffffff] = uint8_t(value >> 8);
|
||||||
|
ram[(address+3) & 0xffffff] = uint8_t(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto uniqueTest68000 = std::make_unique<Test68000>();
|
auto uniqueTest68000 = std::make_unique<Test68000>();
|
||||||
|
Reference in New Issue
Block a user