2021-07-18 15:36:13 +00:00
|
|
|
//
|
|
|
|
// 6526Implementation.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/07/2021.
|
|
|
|
// Copyright © 2021 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _526Implementation_h
|
|
|
|
#define _526Implementation_h
|
|
|
|
|
2021-07-18 16:13:56 +00:00
|
|
|
#include <cassert>
|
|
|
|
#include <cstdio>
|
|
|
|
|
2021-07-18 15:36:13 +00:00
|
|
|
namespace MOS {
|
|
|
|
namespace MOS6526 {
|
|
|
|
|
|
|
|
template <typename BusHandlerT, Personality personality>
|
|
|
|
void MOS6526<BusHandlerT, personality>::write(int address, uint8_t value) {
|
2021-07-18 16:13:56 +00:00
|
|
|
address &= 0xf;
|
2021-07-18 16:23:47 +00:00
|
|
|
switch(address) {
|
|
|
|
case 2: case 3:
|
|
|
|
registers_.data_direction[address - 2] = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unhandled 6526 write: %02x to %d\n", value, address);
|
|
|
|
assert(false);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-18 15:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename BusHandlerT, Personality personality>
|
|
|
|
uint8_t MOS6526<BusHandlerT, personality>::read(int address) {
|
2021-07-18 16:13:56 +00:00
|
|
|
address &= 0xf;
|
2021-07-18 16:23:47 +00:00
|
|
|
switch(address) {
|
|
|
|
case 2: case 3:
|
|
|
|
return registers_.data_direction[address - 2];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("Unhandled 6526 read from %d\n", address);
|
|
|
|
assert(false);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-18 15:36:13 +00:00
|
|
|
return 0xff;
|
|
|
|
}
|
|
|
|
|
2021-07-18 15:49:10 +00:00
|
|
|
template <typename BusHandlerT, Personality personality>
|
|
|
|
void MOS6526<BusHandlerT, personality>::run_for(const HalfCycles half_cycles) {
|
|
|
|
(void)half_cycles;
|
|
|
|
}
|
|
|
|
|
2021-07-18 15:36:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _526Implementation_h */
|