mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 06:35:04 +00:00
Decided to turn the 6522 into a template, since it's a per-cycle thing with variable behaviour. Added appropriate memory map callouts to hit the two in the Vic. Though they don't yet do anything.
This commit is contained in:
parent
6522530e1c
commit
26ab96868a
@ -10,15 +10,3 @@
|
||||
|
||||
using namespace MOS;
|
||||
|
||||
MOS6522::MOS6522()
|
||||
{
|
||||
}
|
||||
|
||||
void MOS6522::set_register(int address, uint8_t value)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t MOS6522::get_register(int address)
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
|
@ -13,12 +13,18 @@
|
||||
|
||||
namespace MOS {
|
||||
|
||||
class MOS6522 {
|
||||
template <class T> class MOS6522 {
|
||||
public:
|
||||
MOS6522();
|
||||
MOS6522() : _data_direction{0, 0} {}
|
||||
|
||||
void set_register(int address, uint8_t value);
|
||||
uint8_t get_register(int address);
|
||||
void set_register(int address, uint8_t value) {}
|
||||
uint8_t get_register(int address) {return 0xff;}
|
||||
|
||||
private:
|
||||
uint16_t _interval_timers[2];
|
||||
uint8_t _shift_register;
|
||||
uint8_t _input_latches[2];
|
||||
uint8_t _data_direction[2];
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ using namespace MOS;
|
||||
*/
|
||||
|
||||
MOS6560::MOS6560() :
|
||||
_crt(new Outputs::CRT::CRT(65*4, 4, 261, Outputs::CRT::ColourSpace::YIQ, 65*4, 1, 1)), // TODO: turn 261 back into 263 once vertical sync exists
|
||||
_crt(new Outputs::CRT::CRT(65*4, 4, 261, Outputs::CRT::ColourSpace::YIQ, 228, 1, 1)), // TODO: turn 261 back into 263 once vertical sync exists
|
||||
_horizontal_counter(0),
|
||||
_vertical_counter(0)
|
||||
{
|
||||
|
@ -33,6 +33,14 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
*value = _mos6560->get_register(address - 0x9000);
|
||||
}
|
||||
else if((address&0xfff0) == 0x9110)
|
||||
{
|
||||
*value = _userPortVIA->get_register(address - 0x9110);
|
||||
}
|
||||
else if((address&0xfff0) == 0x9120)
|
||||
{
|
||||
*value = _keyboardVIA->get_register(address - 0x9120);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -42,6 +50,15 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
_mos6560->set_register(address - 0x9000, *value);
|
||||
}
|
||||
else if((address&0xfff0) == 0x9110)
|
||||
{
|
||||
_userPortVIA->set_register(address - 0x9110, *value);
|
||||
}
|
||||
else if((address&0xfff0) == 0x9120)
|
||||
{
|
||||
_keyboardVIA->set_register(address - 0x9120, *value);
|
||||
}
|
||||
|
||||
// TODO: the 6522
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "../../Processors/6502/CPU6502.hpp"
|
||||
#include "../../Components/6560/6560.hpp"
|
||||
#include "../../Components/6522/6522.hpp"
|
||||
#include "../CRTMachine.hpp"
|
||||
|
||||
namespace Vic20 {
|
||||
@ -21,6 +22,12 @@ enum ROMSlot {
|
||||
ROMSlotCharacters,
|
||||
};
|
||||
|
||||
class UserPortVIA: public MOS::MOS6522<UserPortVIA> {
|
||||
};
|
||||
|
||||
class KeyboardVIA: public MOS::MOS6522<KeyboardVIA> {
|
||||
};
|
||||
|
||||
class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
public:
|
||||
Machine();
|
||||
@ -65,6 +72,8 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
}
|
||||
|
||||
std::unique_ptr<MOS::MOS6560> _mos6560;
|
||||
std::unique_ptr<UserPortVIA> _userPortVIA;
|
||||
std::unique_ptr<KeyboardVIA> _keyboardVIA;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user