1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-29 15:29:36 +00:00

Corrects TRAP, TRAPV and CHK timing.

This commit is contained in:
Thomas Harte 2019-06-29 21:25:22 -04:00
parent aff40bf00a
commit 8d0cd356fd
3 changed files with 7 additions and 8 deletions

View File

@ -489,12 +489,11 @@
XCTAssertEqual(state.stack_pointer(), 0x2004);
XCTAssertEqual(state.program_counter, 0x000c + 4);
XCTAssertEqual(16, _machine->get_cycle_count());
}
// MARK: TRAP
- (void)testTrap {
- (void)testTRAP {
_machine->set_program({
0x4e41 // TRAP #1
});
@ -514,6 +513,7 @@
XCTAssertEqual(*_machine->ram_at(0x202), 0x0000);
XCTAssertEqual(*_machine->ram_at(0x204), 0x1002);
XCTAssertEqual(state.supervisor_stack_pointer, 0x200);
XCTAssertEqual(34, _machine->get_cycle_count());
}
// MARK: TRAPV

View File

@ -11,7 +11,6 @@
#include <array>
#define LOG_TRACE
#include "../../../Processors/68000/68000.hpp"
using Flag = CPU::MC68000::Flag;

View File

@ -1281,7 +1281,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
// Select the trap steps as next; the initial microcycle should be 4 cycles long.
bus_program = trap_steps_;
populate_trap_steps((decoded_instruction_.full & 15) + 32, get_status());
set_next_microcycle_length(HalfCycles(8));
set_next_microcycle_length(HalfCycles(12));
// The program counter to push is actually one slot ago.
program_counter_.full -= 2;
@ -1292,7 +1292,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
// Select the trap steps as next; the initial microcycle should be skipped.
bus_program = trap_steps_;
populate_trap_steps(7, get_status());
set_next_microcycle_length(HalfCycles(0));
set_next_microcycle_length(HalfCycles(4));
// Push the address after the TRAPV.
program_counter_.full -= 4;
@ -1312,10 +1312,10 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
if(is_under || is_over) {
bus_program = trap_steps_;
populate_trap_steps(6, get_status());
if(is_under) {
set_next_microcycle_length(HalfCycles(16));
if(is_over) {
set_next_microcycle_length(HalfCycles(20));
} else {
set_next_microcycle_length(HalfCycles(8));
set_next_microcycle_length(HalfCycles(24));
}
// The program counter to push is two slots ago as whatever was the correct prefetch