From 4190b42bbb9b517932258dc423b7281789a4aa0c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 13 Jun 2016 18:27:18 -0400 Subject: [PATCH] No need for these to live separately, I think. --- Machines/Vic-20/Vic20.cpp | 20 +++++++++----------- Machines/Vic-20/Vic20.hpp | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp index a9088de17..1212c589f 100644 --- a/Machines/Vic-20/Vic20.cpp +++ b/Machines/Vic-20/Vic20.cpp @@ -13,12 +13,10 @@ using namespace Vic20; Machine::Machine() : - _userPortVIA(new UserPortVIA()), - _keyboardVIA(new KeyboardVIA()), _rom(nullptr) { - _userPortVIA->set_delegate(this); - _keyboardVIA->set_delegate(this); + _userPortVIA.set_delegate(this); + _keyboardVIA.set_delegate(this); set_reset_line(true); } @@ -56,11 +54,11 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin } else if((address&0xfff0) == 0x9110) { - *value = _userPortVIA->get_register(address - 0x9110); + *value = _userPortVIA.get_register(address - 0x9110); } else if((address&0xfff0) == 0x9120) { - *value = _keyboardVIA->get_register(address - 0x9120); + *value = _keyboardVIA.get_register(address - 0x9120); } } else @@ -73,16 +71,16 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin } else if((address&0xfff0) == 0x9110) { - _userPortVIA->set_register(address - 0x9110, *value); + _userPortVIA.set_register(address - 0x9110, *value); } else if((address&0xfff0) == 0x9120) { - _keyboardVIA->set_register(address - 0x9120, *value); + _keyboardVIA.set_register(address - 0x9120, *value); } } - _userPortVIA->run_for_cycles(1); - _keyboardVIA->run_for_cycles(1); + _userPortVIA.run_for_cycles(1); + _keyboardVIA.run_for_cycles(1); return 1; } @@ -90,7 +88,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin void Machine::mos6522_did_change_interrupt_status(void *mos6522) { - bool irq = _userPortVIA->get_interrupt_line() || _keyboardVIA->get_interrupt_line(); + bool irq = _userPortVIA.get_interrupt_line() || _keyboardVIA.get_interrupt_line(); set_irq_line(irq); } diff --git a/Machines/Vic-20/Vic20.hpp b/Machines/Vic-20/Vic20.hpp index 865229b38..06f46f0be 100644 --- a/Machines/Vic-20/Vic20.hpp +++ b/Machines/Vic-20/Vic20.hpp @@ -95,8 +95,8 @@ class Machine: public CPU6502::Processor, public CRTMachine::Machine, p void set_rom(ROMSlot slot, size_t length, const uint8_t *data); void add_prg(size_t length, const uint8_t *data); - void set_key_state(Key key, bool isPressed) { _keyboardVIA->set_key_state(key, isPressed); } - void clear_all_keys() { _keyboardVIA->clear_all_keys(); } + void set_key_state(Key key, bool isPressed) { _keyboardVIA.set_key_state(key, isPressed); } + void clear_all_keys() { _keyboardVIA.clear_all_keys(); } // to satisfy CPU6502::Processor unsigned int perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value); @@ -142,8 +142,8 @@ class Machine: public CPU6502::Processor, public CRTMachine::Machine, p } std::unique_ptr _mos6560; - std::unique_ptr _userPortVIA; - std::unique_ptr _keyboardVIA; + UserPortVIA _userPortVIA; + KeyboardVIA _keyboardVIA; }; }