From 76d98938664063f9ae057f5dcaa0057e1a7bdd47 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Oct 2020 15:08:21 -0400 Subject: [PATCH] Declares address-bus sizes formally. This allows me to fix the final two implicit conversion warnings, albeit that it would have been nice to find a templatey way just to get the type directly from the declaration of `perform_bus_operation`. --- Processors/6502Esque/6502Esque.hpp | 6 ++++-- Processors/65816/Implementation/65816Implementation.hpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Processors/6502Esque/6502Esque.hpp b/Processors/6502Esque/6502Esque.hpp index 3ef3ba16f..953333b44 100644 --- a/Processors/6502Esque/6502Esque.hpp +++ b/Processors/6502Esque/6502Esque.hpp @@ -118,8 +118,10 @@ enum BusOperation { machines should subclass BusHandler and then declare a realisation of the 6502 template, suplying their bus handler. */ -template class BusHandler { +template class BusHandler { public: + using AddressType = addr_t; + /*! Announces that the 6502 has performed the cycle defined by operation, address and value. On the 6502, all bus cycles take one clock cycle so the amoutn of time advanced is implicit. @@ -136,7 +138,7 @@ template class BusHandler { during some periods; one way to simulate that is to have the bus handler return a number other than Cycles(1) to describe lengthened bus cycles. */ - Cycles perform_bus_operation([[maybe_unused]] BusOperation operation, [[maybe_unused]] AddressType address, [[maybe_unused]] uint8_t *value) { + Cycles perform_bus_operation([[maybe_unused]] BusOperation operation, [[maybe_unused]] addr_t address, [[maybe_unused]] uint8_t *value) { return Cycles(1); } diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 3d84bcd9e..39180736c 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -27,7 +27,7 @@ template void Processor Cycles(0)) { // Wait for ready to be inactive before proceeding. while(uses_ready_line && ready_line_ && number_of_cycles > Cycles(0)) { - number_of_cycles -= bus_handler_.perform_bus_operation(BusOperation::Ready, bus_address_, &bus_throwaway_); + number_of_cycles -= bus_handler_.perform_bus_operation(BusOperation::Ready, static_cast(bus_address_), &bus_throwaway_); } // Process for as much time is left and/or until ready is signalled. @@ -934,7 +934,7 @@ template void Processor(bus_address_), bus_value_); } }