1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 20:30:00 +00:00

Added getters for most of the input lines, and attempted to round out the ZX81's wait logic.

This commit is contained in:
Thomas Harte 2017-06-22 20:11:19 -04:00
parent f0398a6db8
commit b7c978e078
2 changed files with 23 additions and 4 deletions

View File

@ -36,9 +36,6 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
set_hsync(true);
if(nmi_is_enabled_) {
set_non_maskable_interrupt_line(true);
if(!get_halt_line()) {
set_wait_line(true);
}
}
video_->run_for_cycles(horizontal_counter_ - vsync_start_cycle_);
} else if(previous_counter < vsync_end_cycle_ && horizontal_counter_ >= vsync_end_cycle_) {
@ -56,6 +53,10 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
if(is_zx81_) horizontal_counter_ %= 207;
tape_player_.run_for_cycles(cycle.length);
if(nmi_is_enabled_ && !get_halt_line() && get_non_maskable_interrupt_line()) {
set_wait_line(true);
}
if(!cycle.is_terminal()) {
return 0;
}

View File

@ -192,7 +192,7 @@ template <class T> class Processor {
};
uint8_t request_status_;
uint8_t last_request_status_;
bool irq_line_;
bool irq_line_, nmi_line_;
bool bus_request_line_;
bool wait_line_;
@ -771,6 +771,7 @@ template <class T> class Processor {
request_status_(Interrupt::PowerOn),
last_request_status_(Interrupt::PowerOn),
irq_line_(false),
nmi_line_(false),
bus_request_line_(false),
pc_increment_(1),
scheduled_program_counter_(nullptr) {
@ -1888,6 +1889,10 @@ template <class T> class Processor {
}
}
bool get_interrupt_line() {
return irq_line_;
}
/*!
Sets the logical value of the non-maskable interrupt line.
@ -1895,6 +1900,7 @@ template <class T> class Processor {
*/
void set_non_maskable_interrupt_line(bool value, int offset = 0) {
// NMIs are edge triggered and cannot be masked.
nmi_line_ = value;
if(value) {
request_status_ |= Interrupt::NMI;
if(offset < 0) {
@ -1903,6 +1909,10 @@ template <class T> class Processor {
}
}
bool get_non_maskable_interrupt_line() {
return nmi_line_;
}
/*!
Sets the logical value of the bus request line.
*/
@ -1910,6 +1920,10 @@ template <class T> class Processor {
bus_request_line_ = value;
}
bool get_bus_request_line() {
return bus_request_line_;
}
/*!
Sets the logical value of the reset line.
*/
@ -1935,6 +1949,10 @@ template <class T> class Processor {
wait_line_ = value;
}
bool get_wait_line() {
return wait_line_;
}
/*!
For receivers of perform_machine_cycle only. Temporarily rejects the current machine
cycle, causing time to be rewinded to its beginning.