1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-25 11:17:26 +00:00

Formally transferred ownership of PIO accesses to an incoming template, and decided to start being explicit about how to specify the interfaces and provide fallbacks for optional behaviour for the new, clean generation of interfaces. A full-project sweep will inevitably occur but I'll try to tie off this branch first.

This commit is contained in:
Thomas Harte
2017-08-01 16:15:19 -04:00
parent ace71280a0
commit 58b98267fc
4 changed files with 70 additions and 12 deletions
+43
View File
@@ -0,0 +1,43 @@
//
// i8255.hpp
// Clock Signal
//
// Created by Thomas Harte on 01/08/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef i8255_hpp
#define i8255_hpp
namespace Intel {
namespace i8255 {
class PortHandler {
};
template <class T> class i8255 {
public:
void set_register(int address, uint8_t value) {
switch((address >> 8) & 3) {
case 0: printf("PSG data: %d\n", value); break;
case 1: printf("Vsync, etc: %02x\n", value); break;
case 2: printf("Key row, etc: %02x\n", value); break;
case 3: printf("PIO control: %02x\n", value); break;
}
}
uint8_t get_register(int address) {
switch((address >> 8) & 3) {
case 0: printf("[In] PSG data\n"); break;
case 1: printf("[In] Vsync, etc\n"); break;
case 2: printf("[In] Key row, etc\n"); break;
case 3: printf("[In] PIO control\n"); break;
}
return 0xff;
}
};
}
}
#endif /* i8255_hpp */