mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-28 06:29:37 +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:
commit
6ae967de51
@ -155,14 +155,14 @@ void print_ram(FILE *file, const std::unordered_map<uint32_t, uint8_t> &data) {
|
|||||||
- (void)generate {
|
- (void)generate {
|
||||||
BusHandler handler;
|
BusHandler handler;
|
||||||
|
|
||||||
// Make tests repeatable, at least for any given instance of
|
|
||||||
// the runtime.
|
|
||||||
srand(65816);
|
|
||||||
|
|
||||||
NSString *const tempDir = NSTemporaryDirectory();
|
NSString *const tempDir = NSTemporaryDirectory();
|
||||||
NSLog(@"Outputting to %@", tempDir);
|
NSLog(@"Outputting to %@", tempDir);
|
||||||
|
|
||||||
for(int operation = 0; operation < 512; operation++) {
|
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 bool is_emulated = operation & 256;
|
||||||
const uint8_t opcode = operation & 255;
|
const uint8_t opcode = operation & 255;
|
||||||
|
|
||||||
|
@ -359,15 +359,20 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case OperationConstructDirectIndexedIndirect:
|
case OperationConstructDirectIndexedIndirect:
|
||||||
data_address_ = (
|
// Emulation mode plus DL = 0 is required for 6502-style functionality where
|
||||||
((registers_.direct + registers_.x.full + instruction_buffer_.value) & registers_.e_masks[1]) +
|
// only the low byte is the result of the indirect calculation.
|
||||||
(registers_.direct & registers_.e_masks[0])
|
|
||||||
) & 0xffff;
|
|
||||||
data_address_increment_mask_ = 0x00'ff'ff;
|
|
||||||
|
|
||||||
if(!(registers_.direct&0xff)) {
|
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_;
|
++next_op_;
|
||||||
|
} else {
|
||||||
|
data_address_ = (
|
||||||
|
registers_.direct + registers_.x.full + instruction_buffer_.value
|
||||||
|
) & 0xffff;
|
||||||
}
|
}
|
||||||
|
data_address_increment_mask_ = 0x00'ff'ff;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case OperationConstructDirectIndirectIndexedLong:
|
case OperationConstructDirectIndirectIndexedLong:
|
||||||
@ -441,7 +446,9 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
|
|||||||
if(registers_.emulation_flag) {
|
if(registers_.emulation_flag) {
|
||||||
if(exception_is_interrupt_) data_buffer_.value &= ~uint32_t(Flag::Break);
|
if(exception_is_interrupt_) data_buffer_.value &= ~uint32_t(Flag::Break);
|
||||||
data_buffer_.size = 3;
|
data_buffer_.size = 3;
|
||||||
registers_.data_bank = 0;
|
if(pending_exceptions_ & (Reset | PowerOn)) {
|
||||||
|
registers_.data_bank = 0;
|
||||||
|
}
|
||||||
++next_op_;
|
++next_op_;
|
||||||
} else {
|
} else {
|
||||||
data_buffer_.value |= registers_.program_bank << 8; // The PBR is always held such that
|
data_buffer_.value |= registers_.program_bank << 8; // The PBR is always held such that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user