mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-08 03:54:27 +00:00
Merge pull request #138 from TomHarte/ZX81Ports
Increases port decoding on the ZX81
This commit is contained in:
commit
2d02c23574
@ -35,6 +35,7 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
|||||||
if(previous_counter < vsync_start_cycle_ && horizontal_counter_ >= vsync_start_cycle_) {
|
if(previous_counter < vsync_start_cycle_ && horizontal_counter_ >= vsync_start_cycle_) {
|
||||||
video_->run_for_cycles(vsync_start_cycle_ - previous_counter);
|
video_->run_for_cycles(vsync_start_cycle_ - previous_counter);
|
||||||
set_hsync(true);
|
set_hsync(true);
|
||||||
|
line_counter_ = (line_counter_ + 1) & 7;
|
||||||
if(nmi_is_enabled_) {
|
if(nmi_is_enabled_) {
|
||||||
set_non_maskable_interrupt_line(true);
|
set_non_maskable_interrupt_line(true);
|
||||||
}
|
}
|
||||||
@ -66,17 +67,20 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
|||||||
bool is_opcode_read = false;
|
bool is_opcode_read = false;
|
||||||
switch(cycle.operation) {
|
switch(cycle.operation) {
|
||||||
case CPU::Z80::PartialMachineCycle::Output:
|
case CPU::Z80::PartialMachineCycle::Output:
|
||||||
set_vsync(false);
|
|
||||||
line_counter_ = 0;
|
|
||||||
|
|
||||||
if(!(address & 2)) nmi_is_enabled_ = false;
|
if(!(address & 2)) nmi_is_enabled_ = false;
|
||||||
if(!(address & 1)) nmi_is_enabled_ = is_zx81_;
|
if(!(address & 1)) nmi_is_enabled_ = is_zx81_;
|
||||||
|
if((address&3) == 3) {
|
||||||
|
if(!nmi_is_enabled_) {
|
||||||
|
set_vsync(false);
|
||||||
|
line_counter_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CPU::Z80::PartialMachineCycle::Input: {
|
case CPU::Z80::PartialMachineCycle::Input: {
|
||||||
uint8_t value = 0xff;
|
uint8_t value = 0xff;
|
||||||
if(!(address&1)) {
|
if(!(address&1)) {
|
||||||
set_vsync(true);
|
if(!nmi_is_enabled_) set_vsync(true);
|
||||||
|
|
||||||
uint16_t mask = 0x100;
|
uint16_t mask = 0x100;
|
||||||
for(int c = 0; c < 8; c++) {
|
for(int c = 0; c < 8; c++) {
|
||||||
@ -90,7 +94,6 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case CPU::Z80::PartialMachineCycle::Interrupt:
|
case CPU::Z80::PartialMachineCycle::Interrupt:
|
||||||
line_counter_ = (line_counter_ + 1) & 7;
|
|
||||||
*cycle.value = 0xff;
|
*cycle.value = 0xff;
|
||||||
horizontal_counter_ = 0;
|
horizontal_counter_ = 0;
|
||||||
break;
|
break;
|
||||||
@ -106,9 +109,11 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
|||||||
}
|
}
|
||||||
if(latched_video_byte_) {
|
if(latched_video_byte_) {
|
||||||
size_t char_address = (size_t)((address & 0xff00) | ((latched_video_byte_ & 0x3f) << 3) | line_counter_);
|
size_t char_address = (size_t)((address & 0xff00) | ((latched_video_byte_ & 0x3f) << 3) | line_counter_);
|
||||||
|
uint8_t mask = (latched_video_byte_ & 0x80) ? 0x00 : 0xff;
|
||||||
if(char_address < ram_base_) {
|
if(char_address < ram_base_) {
|
||||||
uint8_t mask = (latched_video_byte_ & 0x80) ? 0x00 : 0xff;
|
|
||||||
latched_video_byte_ = rom_[char_address & rom_mask_] ^ mask;
|
latched_video_byte_ = rom_[char_address & rom_mask_] ^ mask;
|
||||||
|
} else {
|
||||||
|
latched_video_byte_ = ram_[address & ram_mask_] ^ mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
video_->output_byte(latched_video_byte_);
|
video_->output_byte(latched_video_byte_);
|
||||||
|
@ -68,13 +68,14 @@
|
|||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
|
enableAddressSanitizer = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "NO">
|
allowLocationSimulation = "NO">
|
||||||
<BuildableProductRunnable
|
<BuildableProductRunnable
|
||||||
|
Loading…
Reference in New Issue
Block a user