1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Adds inclusive fill test; fixes inclusive fills.

This commit is contained in:
Thomas Harte 2021-11-07 14:25:09 -08:00
parent 31e22e4cfb
commit 8ef9a932aa
3 changed files with 5758 additions and 5 deletions

View File

@ -30,7 +30,7 @@ void Blitter::set_control(int index, uint16_t value) {
direction_ = one_dot_ ? uint32_t(-1) : uint32_t(1);
exclusive_fill_ = (value & 0x0010);
inclusive_fill_ = (value & 0x0008);
inclusive_fill_ = !exclusive_fill_ && (value & 0x0008); // Exclusive fill takes precedence. Probably? TODO: verify.
fill_carry_ = (value & 0x0004);
} else {
minterms_ = value & 0xff;
@ -273,10 +273,15 @@ bool Blitter::advance() {
uint16_t bit = one_dot_ ? 0x0001 : 0x8000;
uint16_t flag = fill_carry ? bit : 0x0000;
while(bit) {
if(exclusive_fill_) flag ^= (output & bit);
if(inclusive_fill_) flag ^= (output & bit & ~flag); // Accept bits that would transition to set immediately.
uint16_t pre_toggle = output & bit, post_toggle = pre_toggle;
if(inclusive_fill_) {
pre_toggle &= ~flag; // Accept bits that would transition to set immediately.
post_toggle &= flag; // Accept bits that would transition to clear after the fact.
}
flag ^= pre_toggle;
fill_output |= flag;
if(inclusive_fill_) flag ^= (output & bit & flag); // Accept bits that would transition to clear after the fact.
flag ^= post_toggle;
fill_carry = flag;
if(one_dot_) {

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,16 @@
namespace Amiga {
/// An empty stub to satisfy Amiga::Blitter's inheritance from Amiga::DMADevice;
struct Chipset {};
struct Chipset {
// Hyper ugliness: make a gross assumption about the effect of
// the only call the Blitter will make into the Chipset, i.e.
// that it will write something but do nothing more.
//
// Bonus ugliness: assume the real Chipset struct is 1kb in
// size, at most.
uint8_t _[1024];
};
};
namespace {
@ -78,6 +87,7 @@ using WriteVector = std::vector<std::pair<uint32_t, uint16_t>>;
const NSInteger param1 = [event[1] integerValue];
if([type isEqualToString:@"cread"] || [type isEqualToString:@"bread"] || [type isEqualToString:@"aread"]) {
XCTAssert(param1 < sizeof(ram) - 1);
ram[param1 >> 1] = [event[2] integerValue];
state = State::LoggingWrites;
continue;
@ -239,4 +249,8 @@ using WriteVector = std::vector<std::pair<uint32_t, uint16_t>>;
[self testCase:@"clock"];
}
- (void)testInclusiveFills {
[self testCase:@"inclusive fills"];
}
@end