From 473799cb62241b474f64548480406458e3f703c6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 26 Sep 2020 20:18:30 -0400 Subject: [PATCH] There's not a lot to STP and WAI from a bus program point of view. --- Processors/65816/Implementation/65816Storage.cpp | 16 ++++++++++++++-- Processors/65816/Implementation/65816Storage.hpp | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Processors/65816/Implementation/65816Storage.cpp b/Processors/65816/Implementation/65816Storage.cpp index c19a5f829..00af1b764 100644 --- a/Processors/65816/Implementation/65816Storage.cpp +++ b/Processors/65816/Implementation/65816Storage.cpp @@ -518,7 +518,19 @@ struct CPU::WDC65816::ProcessorStorageConstructor { } // 19c. Stop the Clock. + static void stp(AccessType, bool, const std::function &target) { + target(CycleFetchPC); // IO + target(CycleFetchPC); // IO + target(OperationPerform); + } + // 19d. Wait for interrupt. + static void wai(AccessType, bool, const std::function &target) { + target(CycleFetchPC); // IO + target(CycleFetchPC); // IO + target(OperationPerform); + } + // 20. Relative; r. // 21. Relative long; rl. // 22a. Stack; s, abort/irq/nmi/res. @@ -759,7 +771,7 @@ ProcessorStorage::ProcessorStorage() { /* 0xc8 INY i */ op(implied, INY); /* 0xc9 CMP # */ op(immediate, CMP); /* 0xca DEX i */ op(implied, DEC); - /* 0xcb WAI i */ + /* 0xcb WAI i */ op(wai, WAI); /* 0xcc CPY a */ op(absolute, CPY); /* 0xcd CMP a */ op(absolute, CMP); /* 0xce DEC a */ op(absolute_rmw, DEC); @@ -776,7 +788,7 @@ ProcessorStorage::ProcessorStorage() { /* 0xd8 CLD i */ op(implied, CLD); /* 0xd9 CMP a, y */ op(absolute_y, CMP); /* 0xda PHX s */ - /* 0xdb STP i */ + /* 0xdb STP i */ op(stp, STP); /* 0xdc JML (a) */ op(absolute_indirect_jml, JML); /* 0xdd CMP a, x */ op(absolute_x, CMP); /* 0xde DEC a, x */ op(absolute_x_rmw, DEC); diff --git a/Processors/65816/Implementation/65816Storage.hpp b/Processors/65816/Implementation/65816Storage.hpp index 641c517ed..03042c79e 100644 --- a/Processors/65816/Implementation/65816Storage.hpp +++ b/Processors/65816/Implementation/65816Storage.hpp @@ -118,6 +118,8 @@ enum Operation: uint8_t { TAX, TAY, TCD, TCS, TDC, TSC, TSX, TXA, TXS, TXY, TYA, TYX, XCE, XBA, + STP, WAI, + /// Loads the PC with the operand from the data buffer. JMP,