From 9ce9167e3c46a54d3e68b7ca7f10dc36e9f98295 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Oct 2020 19:12:19 -0400 Subject: [PATCH] Formalises work left to do. --- .../Implementation/65816Implementation.hpp | 45 ++++++++++++++++++- .../65816/Implementation/65816Storage.hpp | 4 +- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 268d02574..24a7ed01e 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -297,11 +297,13 @@ template void Processor::run_for(const Cycles case OperationPerform: switch(active_instruction_->operation) { + case NOP: + break; + // // Loads, stores and transfers // - case LDA: LD(a_, data_buffer_.value, m_masks_); break; @@ -314,6 +316,14 @@ template void Processor::run_for(const Cycles LD(y_, data_buffer_.value, x_masks_); break; + case PLB: + a_.halves.high = instruction_buffer_.value; + break; + + case PLD: + direct_ = ((instruction_buffer_.value) & 0xff) << 16; + break; + case TXS: // TODO: does this transfer in full when in 8-bit index mode? LD(s_, x_.full, x_masks_); @@ -324,12 +334,30 @@ template void Processor::run_for(const Cycles data_buffer_.size = 2 - m_flag(); break; + case STZ: + data_buffer_.value = 0; + data_buffer_.size = 2 - m_flag(); + break; + + case STX: + data_buffer_.value = x_.full & x_masks_[1]; + data_buffer_.size = 2 - x_flag(); + break; + + case STY: + data_buffer_.value = y_.full & x_masks_[1]; + data_buffer_.size = 2 - m_flag(); + break; + // // Jumps. // case JML: program_bank_ = instruction_buffer_.value & 0xff0000; + [[fallthrough]]; + + case JMP: pc_ = instruction_buffer_.value & 0xffff; break; @@ -415,6 +443,21 @@ template void Processor::run_for(const Cycles flags_.set_nz(y_top()); } break; + + + // TODO: + // ADC, AND, BIT, CMP, CPX, CPY, EOR, ORA, SBC, + // PLP, + // PHB, PHP, PHD, PHK, + // ASL, LSR, ROL, ROR, TRB, TSB, + // REP, SEP, + // BCC, BCS, BEQ, BMI, BNE, BPL, BRA, BVC, BVS, BRL, + // TAX, TAY, TCD, TCS, TDC, TSC, TSX, TXA, TXS, TXY, TYA, TYX, + // XCE, XBA, + // STP, WAI, + // RTI, RTL, + // BRK, + default: assert(false); } diff --git a/Processors/65816/Implementation/65816Storage.hpp b/Processors/65816/Implementation/65816Storage.hpp index 5408e3ee9..63344665c 100644 --- a/Processors/65816/Implementation/65816Storage.hpp +++ b/Processors/65816/Implementation/65816Storage.hpp @@ -149,7 +149,7 @@ enum Operation: uint8_t { PHB, PHP, PHD, PHK, // These modify the value in the data buffer as part of a read-modify-write. - ASL, DEC, INC, LSR, ROL, ROR, TRB, TSB, + INC, DEC, ASL, LSR, ROL, ROR, TRB, TSB, // These merely decrement A, increment or decrement X and Y, and regress // the program counter only if appropriate. @@ -186,7 +186,7 @@ enum Operation: uint8_t { JSL, /// i.e. jump to vector. TODO: is this really distinct from JMP? I'm assuming so for now, - /// as I assume the PBR is implicitly modified. We'll see. + /// as I assume the PBR is implicitly modified. But then is it just JML? We'll see. BRK, };