1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Attempts to permit Master System interrupts.

This commit is contained in:
Thomas Harte 2018-09-23 00:07:46 -04:00
parent 40c7a63fb5
commit 38a1fde3bf

View File

@ -82,13 +82,14 @@ class ConcreteMachine:
uint16_t address = cycle.address ? *cycle.address : 0x0000; uint16_t address = cycle.address ? *cycle.address : 0x0000;
switch(cycle.operation) { switch(cycle.operation) {
case CPU::Z80::PartialMachineCycle::ReadOpcode: case CPU::Z80::PartialMachineCycle::ReadOpcode:
// printf("%04x [%02x]\n", address, bios_[address]); // printf("%04x\n", address);
case CPU::Z80::PartialMachineCycle::Read: case CPU::Z80::PartialMachineCycle::Read:
if(address < 0x2000) { if(address < 0x2000) {
*cycle.value = bios_[address]; *cycle.value = bios_[address];
} else if(address >= 0xc000) { } else if(address >= 0xc000) {
*cycle.value = ram_[address & 8191]; *cycle.value = ram_[address & 8191];
} else { } else {
// printf("lr %04x\n", address);
*cycle.value = 0xff; *cycle.value = 0xff;
} }
break; break;
@ -121,6 +122,8 @@ class ConcreteMachine:
case 0x80: case 0x81: case 0x80: case 0x81:
update_video(); update_video();
vdp_->set_register(address, *cycle.value); vdp_->set_register(address, *cycle.value);
z80_.set_interrupt_line(vdp_->get_interrupt_line());
time_until_interrupt_ = vdp_->get_time_until_interrupt();
break; break;
case 0xc0: case 0xc0:
printf("TODO: I/O port A/N\n"); printf("TODO: I/O port A/N\n");
@ -129,7 +132,9 @@ class ConcreteMachine:
printf("TODO: I/O port B/misc\n"); printf("TODO: I/O port B/misc\n");
break; break;
default: break; default:
printf("Clearly some sort of typo\n");
break;
} }
break; break;
@ -144,7 +149,7 @@ class ConcreteMachine:
if(time_until_interrupt_ > 0) { if(time_until_interrupt_ > 0) {
time_until_interrupt_ -= cycle.length; time_until_interrupt_ -= cycle.length;
if(time_until_interrupt_ <= HalfCycles(0)) { if(time_until_interrupt_ <= HalfCycles(0)) {
z80_.set_non_maskable_interrupt_line(true, time_until_interrupt_); z80_.set_interrupt_line(true, time_until_interrupt_);
} }
} }