From 72d7901c88682829c6a2b0115466f3a2333a3df3 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 19 Feb 2021 20:06:12 -0500 Subject: [PATCH] Takes a shot at the keyboard data full flag. Just a guess. But likely? --- Machines/Apple/AppleIIgs/ADB.cpp | 5 +++-- .../xcshareddata/xcschemes/Clock Signal.xcscheme | 4 +--- Processors/65816/65816.hpp | 1 + Processors/65816/Implementation/65816Implementation.hpp | 7 ++++++- Processors/65816/Implementation/65816Storage.hpp | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Machines/Apple/AppleIIgs/ADB.cpp b/Machines/Apple/AppleIIgs/ADB.cpp index 9a2fc2644..c1fa0d050 100644 --- a/Machines/Apple/AppleIIgs/ADB.cpp +++ b/Machines/Apple/AppleIIgs/ADB.cpp @@ -55,12 +55,12 @@ uint8_t GLU::get_keyboard_data() { // The classic Apple II serial keyboard register: // b7: key strobe. // b6–b0: ASCII code. - return registers_[0]; + return registers_[0] | (status_ & uint8_t(CPUFlags::KeyboardDataFull)) ? 0x80 : 0x00; } void GLU::clear_key_strobe() { // Clears the key strobe of the classic Apple II serial keyboard register. - registers_[0] &= 0x7f; // ??? + status_ &= ~uint8_t(CPUFlags::KeyboardDataFull); } uint8_t GLU::get_any_key_down() { @@ -187,6 +187,7 @@ void GLU::set_port_output(int port, uint8_t value) { registers_[register_address_] = register_latch_; switch(register_address_) { default: break; + case 0: status_ |= uint8_t(CPUFlags::KeyboardDataFull); break; case 7: status_ |= uint8_t(CPUFlags::CommandDataIsValid); break; } } else { diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme index aa72d51d7..01069c685 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme @@ -62,12 +62,10 @@ class Processor: public Pro private: BusHandler &bus_handler_; + int count_ = 0; }; #include "Implementation/65816Implementation.hpp" diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 8fe40ee92..73e9b2305 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -30,6 +30,11 @@ template void Processor Cycles(0)) { + ++count_; + if(count_ == 148933250) { + printf(""); + } + const MicroOp operation = *next_op_; ++next_op_; @@ -39,7 +44,6 @@ template void Processor void Processor> 16); memory_lock_ = false; } continue; diff --git a/Processors/65816/Implementation/65816Storage.hpp b/Processors/65816/Implementation/65816Storage.hpp index 7ea71ffac..cba475fb9 100644 --- a/Processors/65816/Implementation/65816Storage.hpp +++ b/Processors/65816/Implementation/65816Storage.hpp @@ -262,6 +262,7 @@ struct ProcessorStorage { // A helper for testing. uint16_t last_operation_pc_; + uint8_t last_operation_program_bank_; Instruction *active_instruction_; Cycles cycles_left_to_run_;