mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
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`.
This commit is contained in:
parent
c3f8982c62
commit
76d9893866
@ -118,8 +118,10 @@ enum BusOperation {
|
|||||||
machines should subclass BusHandler and then declare a realisation of the 6502 template, suplying their bus
|
machines should subclass BusHandler and then declare a realisation of the 6502 template, suplying their bus
|
||||||
handler.
|
handler.
|
||||||
*/
|
*/
|
||||||
template <typename AddressType> class BusHandler {
|
template <typename addr_t> class BusHandler {
|
||||||
public:
|
public:
|
||||||
|
using AddressType = addr_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Announces that the 6502 has performed the cycle defined by operation, address and value. On the 6502,
|
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.
|
all bus cycles take one clock cycle so the amoutn of time advanced is implicit.
|
||||||
@ -136,7 +138,7 @@ template <typename AddressType> class BusHandler {
|
|||||||
during some periods; one way to simulate that is to have the bus handler return a number other than
|
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(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);
|
return Cycles(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
|
|||||||
while(number_of_cycles > Cycles(0)) {
|
while(number_of_cycles > Cycles(0)) {
|
||||||
// Wait for ready to be inactive before proceeding.
|
// Wait for ready to be inactive before proceeding.
|
||||||
while(uses_ready_line && ready_line_ && number_of_cycles > Cycles(0)) {
|
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<typename BusHandler::AddressType>(bus_address_), &bus_throwaway_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process for as much time is left and/or until ready is signalled.
|
// Process for as much time is left and/or until ready is signalled.
|
||||||
@ -934,7 +934,7 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
|
|||||||
// Store a selection as to the exceptions, if any, that would be honoured after this cycle if the
|
// Store a selection as to the exceptions, if any, that would be honoured after this cycle if the
|
||||||
// next thing is a MoveToNextProgram.
|
// next thing is a MoveToNextProgram.
|
||||||
selected_exceptions_ = pending_exceptions_ & (registers_.flags.inverse_interrupt | PowerOn | Reset | NMI);
|
selected_exceptions_ = pending_exceptions_ & (registers_.flags.inverse_interrupt | PowerOn | Reset | NMI);
|
||||||
number_of_cycles -= bus_handler_.perform_bus_operation(bus_operation_, bus_address_, bus_value_);
|
number_of_cycles -= bus_handler_.perform_bus_operation(bus_operation_, static_cast<typename BusHandler::AddressType>(bus_address_), bus_value_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user