-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCIAGate.cpp
More file actions
54 lines (43 loc) · 1.06 KB
/
Copy pathCIAGate.cpp
File metadata and controls
54 lines (43 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// CIAGate.cpp
// SDL3Test
//
// Created by Matt Parsons on 13/03/2026.
//
#include "CIAGate.hpp"
void CIAGate::Init(Chipset* c){
chipset = c;
}
uint32_t CIAGate::Read8(uint32_t address){
int reg = (address >> 8) & 0xF;
if(address & 0x2000){
return chipset->CIAA.Read(reg);
}else if(address & 0x1000){
return chipset->CIAB.Read(reg);
}
return 0xFFFFFFFF;
}
uint32_t CIAGate::Read16(uint32_t address){
return Read8(address); //probably wrong
}
uint32_t CIAGate::Read32(uint32_t address){
return Read8(address); //probably wrong
}
void CIAGate::Write8(uint32_t address, uint32_t value){
int reg = (address >> 8) & 0xF;
if(address & 0x2000){
chipset->CIAA.Write(reg, value);
return;
}else if(address & 0x1000){
chipset->CIAB.Write(reg, value);
return;
}
}
void CIAGate::Write16(uint32_t address, uint32_t value){
Write8(address, value);
return;
}
void CIAGate::Write32(uint32_t address, uint32_t value){
Write8(address, value);
return;
}