1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-11 08:23:43 +00:00

Merge pull request #1147 from TomHarte/ErrantDBR

Remove DBR reset upon COP/BRK/IRQ/NMI; fix (d, x) addressing.
This commit is contained in:
Thomas Harte 2023-07-30 16:20:34 -04:00 committed by GitHub
commit 6ae967de51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View File

@ -155,14 +155,14 @@ void print_ram(FILE *file, const std::unordered_map<uint32_t, uint8_t> &data) {
- (void)generate {
BusHandler handler;
// Make tests repeatable, at least for any given instance of
// the runtime.
srand(65816);
NSString *const tempDir = NSTemporaryDirectory();
NSLog(@"Outputting to %@", tempDir);
for(int operation = 0; operation < 512; operation++) {
// Make tests repeatable, at least for any given instance of
// the runtime.
srand(65816 + operation);
const bool is_emulated = operation & 256;
const uint8_t opcode = operation & 255;

View File

@ -359,15 +359,20 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
continue;
case OperationConstructDirectIndexedIndirect:
data_address_ = (
((registers_.direct + registers_.x.full + instruction_buffer_.value) & registers_.e_masks[1]) +
(registers_.direct & registers_.e_masks[0])
) & 0xffff;
data_address_increment_mask_ = 0x00'ff'ff;
// Emulation mode plus DL = 0 is required for 6502-style functionality where
// only the low byte is the result of the indirect calculation.
if(!(registers_.direct&0xff)) {
data_address_ = (
((registers_.direct + registers_.x.full + instruction_buffer_.value) & registers_.e_masks[1]) +
(registers_.direct & registers_.e_masks[0])
) & 0xffff;
++next_op_;
} else {
data_address_ = (
registers_.direct + registers_.x.full + instruction_buffer_.value
) & 0xffff;
}
data_address_increment_mask_ = 0x00'ff'ff;
continue;
case OperationConstructDirectIndirectIndexedLong:
@ -441,7 +446,9 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
if(registers_.emulation_flag) {
if(exception_is_interrupt_) data_buffer_.value &= ~uint32_t(Flag::Break);
data_buffer_.size = 3;
registers_.data_bank = 0;
if(pending_exceptions_ & (Reset | PowerOn)) {
registers_.data_bank = 0;
}
++next_op_;
} else {
data_buffer_.value |= registers_.program_bank << 8; // The PBR is always held such that