1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 23:32:28 +00:00

No need for these to live separately, I think.

This commit is contained in:
Thomas Harte 2016-06-13 18:27:18 -04:00
parent 91c406e065
commit 4190b42bbb
2 changed files with 13 additions and 15 deletions

View File

@ -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);
}

View File

@ -95,8 +95,8 @@ class Machine: public CPU6502::Processor<Machine>, 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<Machine>, public CRTMachine::Machine, p
}
std::unique_ptr<MOS::MOS6560> _mos6560;
std::unique_ptr<UserPortVIA> _userPortVIA;
std::unique_ptr<KeyboardVIA> _keyboardVIA;
UserPortVIA _userPortVIA;
KeyboardVIA _keyboardVIA;
};
}