mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 15:31:09 +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_) {
|
||||
video_->run_for_cycles(vsync_start_cycle_ - previous_counter);
|
||||
set_hsync(true);
|
||||
line_counter_ = (line_counter_ + 1) & 7;
|
||||
if(nmi_is_enabled_) {
|
||||
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;
|
||||
switch(cycle.operation) {
|
||||
case CPU::Z80::PartialMachineCycle::Output:
|
||||
set_vsync(false);
|
||||
line_counter_ = 0;
|
||||
|
||||
if(!(address & 2)) nmi_is_enabled_ = false;
|
||||
if(!(address & 1)) nmi_is_enabled_ = is_zx81_;
|
||||
if((address&3) == 3) {
|
||||
if(!nmi_is_enabled_) {
|
||||
set_vsync(false);
|
||||
line_counter_ = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CPU::Z80::PartialMachineCycle::Input: {
|
||||
uint8_t value = 0xff;
|
||||
if(!(address&1)) {
|
||||
set_vsync(true);
|
||||
if(!nmi_is_enabled_) set_vsync(true);
|
||||
|
||||
uint16_t mask = 0x100;
|
||||
for(int c = 0; c < 8; c++) {
|
||||
@ -90,7 +94,6 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||
} break;
|
||||
|
||||
case CPU::Z80::PartialMachineCycle::Interrupt:
|
||||
line_counter_ = (line_counter_ + 1) & 7;
|
||||
*cycle.value = 0xff;
|
||||
horizontal_counter_ = 0;
|
||||
break;
|
||||
@ -106,9 +109,11 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||
}
|
||||
if(latched_video_byte_) {
|
||||
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_) {
|
||||
uint8_t mask = (latched_video_byte_ & 0x80) ? 0x00 : 0xff;
|
||||
latched_video_byte_ = rom_[char_address & rom_mask_] ^ mask;
|
||||
} else {
|
||||
latched_video_byte_ = ram_[address & ram_mask_] ^ mask;
|
||||
}
|
||||
|
||||
video_->output_byte(latched_video_byte_);
|
||||
|
@ -68,13 +68,14 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
enableAddressSanitizer = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "NO">
|
||||
<BuildableProductRunnable
|
||||
|
Loading…
x
Reference in New Issue
Block a user