mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-05 10:28:58 +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:
parent
f0398a6db8
commit
b7c978e078
@ -36,9 +36,6 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
|||||||
set_hsync(true);
|
set_hsync(true);
|
||||||
if(nmi_is_enabled_) {
|
if(nmi_is_enabled_) {
|
||||||
set_non_maskable_interrupt_line(true);
|
set_non_maskable_interrupt_line(true);
|
||||||
if(!get_halt_line()) {
|
|
||||||
set_wait_line(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
video_->run_for_cycles(horizontal_counter_ - vsync_start_cycle_);
|
video_->run_for_cycles(horizontal_counter_ - vsync_start_cycle_);
|
||||||
} else if(previous_counter < vsync_end_cycle_ && horizontal_counter_ >= vsync_end_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;
|
if(is_zx81_) horizontal_counter_ %= 207;
|
||||||
tape_player_.run_for_cycles(cycle.length);
|
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()) {
|
if(!cycle.is_terminal()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ template <class T> class Processor {
|
|||||||
};
|
};
|
||||||
uint8_t request_status_;
|
uint8_t request_status_;
|
||||||
uint8_t last_request_status_;
|
uint8_t last_request_status_;
|
||||||
bool irq_line_;
|
bool irq_line_, nmi_line_;
|
||||||
bool bus_request_line_;
|
bool bus_request_line_;
|
||||||
bool wait_line_;
|
bool wait_line_;
|
||||||
|
|
||||||
@ -771,6 +771,7 @@ template <class T> class Processor {
|
|||||||
request_status_(Interrupt::PowerOn),
|
request_status_(Interrupt::PowerOn),
|
||||||
last_request_status_(Interrupt::PowerOn),
|
last_request_status_(Interrupt::PowerOn),
|
||||||
irq_line_(false),
|
irq_line_(false),
|
||||||
|
nmi_line_(false),
|
||||||
bus_request_line_(false),
|
bus_request_line_(false),
|
||||||
pc_increment_(1),
|
pc_increment_(1),
|
||||||
scheduled_program_counter_(nullptr) {
|
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.
|
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) {
|
void set_non_maskable_interrupt_line(bool value, int offset = 0) {
|
||||||
// NMIs are edge triggered and cannot be masked.
|
// NMIs are edge triggered and cannot be masked.
|
||||||
|
nmi_line_ = value;
|
||||||
if(value) {
|
if(value) {
|
||||||
request_status_ |= Interrupt::NMI;
|
request_status_ |= Interrupt::NMI;
|
||||||
if(offset < 0) {
|
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.
|
Sets the logical value of the bus request line.
|
||||||
*/
|
*/
|
||||||
@ -1910,6 +1920,10 @@ template <class T> class Processor {
|
|||||||
bus_request_line_ = value;
|
bus_request_line_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_bus_request_line() {
|
||||||
|
return bus_request_line_;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the logical value of the reset line.
|
Sets the logical value of the reset line.
|
||||||
*/
|
*/
|
||||||
@ -1935,6 +1949,10 @@ template <class T> class Processor {
|
|||||||
wait_line_ = value;
|
wait_line_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_wait_line() {
|
||||||
|
return wait_line_;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
For receivers of perform_machine_cycle only. Temporarily rejects the current machine
|
For receivers of perform_machine_cycle only. Temporarily rejects the current machine
|
||||||
cycle, causing time to be rewinded to its beginning.
|
cycle, causing time to be rewinded to its beginning.
|
||||||
|
Loading…
Reference in New Issue
Block a user