ac6502 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -32
- package/dist/components/IO/ACIA.d.ts +76 -0
- package/dist/components/IO/ACIA.js +282 -0
- package/dist/components/IO/ACIA.js.map +1 -0
- package/dist/components/IO/Attachments/Attachment.d.ts +112 -0
- package/dist/components/IO/Attachments/Attachment.js +71 -0
- package/dist/components/IO/Attachments/Attachment.js.map +1 -0
- package/dist/components/IO/Attachments/JoystickAttachment.d.ts +53 -0
- package/dist/components/IO/Attachments/JoystickAttachment.js +90 -0
- package/dist/components/IO/Attachments/JoystickAttachment.js.map +1 -0
- package/dist/components/IO/Attachments/KeyboardEncoderAttachment.d.ts +63 -0
- package/dist/components/IO/Attachments/KeyboardEncoderAttachment.js +489 -0
- package/dist/components/IO/Attachments/KeyboardEncoderAttachment.js.map +1 -0
- package/dist/components/IO/Attachments/KeyboardMatrixAttachment.d.ts +44 -0
- package/dist/components/IO/Attachments/KeyboardMatrixAttachment.js +274 -0
- package/dist/components/IO/Attachments/KeyboardMatrixAttachment.js.map +1 -0
- package/dist/components/IO/Attachments/KeypadAttachment.d.ts +47 -0
- package/dist/components/IO/Attachments/KeypadAttachment.js +141 -0
- package/dist/components/IO/Attachments/KeypadAttachment.js.map +1 -0
- package/dist/components/IO/Attachments/LCDAttachment.d.ts +110 -0
- package/dist/components/IO/Attachments/LCDAttachment.js +716 -0
- package/dist/components/IO/Attachments/LCDAttachment.js.map +1 -0
- package/dist/components/IO/Attachments/SNESAttachment.d.ts +85 -0
- package/dist/components/IO/Attachments/SNESAttachment.js +184 -0
- package/dist/components/IO/Attachments/SNESAttachment.js.map +1 -0
- package/dist/components/IO/Empty.d.ts +9 -0
- package/dist/components/IO/Empty.js +5 -7
- package/dist/components/IO/Empty.js.map +1 -1
- package/dist/components/IO/GPIOCard.d.ts +5 -5
- package/dist/components/IO/GPIOCard.js.map +1 -1
- package/dist/components/IO/RAMBank.d.ts +37 -0
- package/dist/components/IO/RAMBank.js +63 -0
- package/dist/components/IO/RAMBank.js.map +1 -0
- package/dist/components/IO/RTC.d.ts +107 -0
- package/dist/components/IO/RTC.js +483 -0
- package/dist/components/IO/RTC.js.map +1 -0
- package/dist/components/IO/Sound.d.ts +120 -0
- package/dist/components/IO/Sound.js +622 -0
- package/dist/components/IO/Sound.js.map +1 -0
- package/dist/components/IO/Storage.d.ts +74 -0
- package/dist/components/IO/Storage.js +409 -0
- package/dist/components/IO/Storage.js.map +1 -0
- package/dist/components/IO/Terminal.d.ts +19 -0
- package/dist/components/IO/Terminal.js +33 -0
- package/dist/components/IO/Terminal.js.map +1 -0
- package/dist/components/IO/VIA.d.ts +105 -0
- package/dist/components/IO/VIA.js +597 -0
- package/dist/components/IO/VIA.js.map +1 -0
- package/dist/components/IO/Video.d.ts +141 -0
- package/dist/components/IO/Video.js +630 -0
- package/dist/components/IO/Video.js.map +1 -0
- package/dist/components/Machine.d.ts +20 -24
- package/dist/components/Machine.js +249 -166
- package/dist/components/Machine.js.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +16 -16
- package/dist/lib.js +32 -32
- package/dist/lib.js.map +1 -1
- package/dist/tests/IO/ACIA.test.d.ts +1 -0
- package/dist/tests/IO/ACIA.test.js +423 -0
- package/dist/tests/IO/ACIA.test.js.map +1 -0
- package/dist/tests/IO/Attachments/Attachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/Attachment.test.js +339 -0
- package/dist/tests/IO/Attachments/Attachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/JoystickAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/JoystickAttachment.test.js +126 -0
- package/dist/tests/IO/Attachments/JoystickAttachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.js +779 -0
- package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.js +355 -0
- package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/KeypadAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/KeypadAttachment.test.js +323 -0
- package/dist/tests/IO/Attachments/KeypadAttachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/LCDAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/LCDAttachment.test.js +627 -0
- package/dist/tests/IO/Attachments/LCDAttachment.test.js.map +1 -0
- package/dist/tests/IO/Attachments/SNESAttachment.test.d.ts +1 -0
- package/dist/tests/IO/Attachments/SNESAttachment.test.js +331 -0
- package/dist/tests/IO/Attachments/SNESAttachment.test.js.map +1 -0
- package/dist/tests/IO/Empty.test.d.ts +1 -0
- package/dist/tests/IO/Empty.test.js +121 -0
- package/dist/tests/IO/Empty.test.js.map +1 -0
- package/dist/tests/IO/GPIOCard.test.js.map +1 -1
- package/dist/tests/IO/RAMBank.test.d.ts +1 -0
- package/dist/tests/IO/RAMBank.test.js +229 -0
- package/dist/tests/IO/RAMBank.test.js.map +1 -0
- package/dist/tests/IO/RTC.test.d.ts +1 -0
- package/dist/tests/IO/RTC.test.js +177 -0
- package/dist/tests/IO/RTC.test.js.map +1 -0
- package/dist/tests/IO/Sound.test.d.ts +1 -0
- package/dist/tests/IO/Sound.test.js +528 -0
- package/dist/tests/IO/Sound.test.js.map +1 -0
- package/dist/tests/IO/Storage.test.d.ts +1 -0
- package/dist/tests/IO/Storage.test.js +656 -0
- package/dist/tests/IO/Storage.test.js.map +1 -0
- package/dist/tests/IO/VIA.test.d.ts +1 -0
- package/dist/tests/IO/VIA.test.js +503 -0
- package/dist/tests/IO/VIA.test.js.map +1 -0
- package/dist/tests/IO/Video.test.d.ts +1 -0
- package/dist/tests/IO/Video.test.js +549 -0
- package/dist/tests/IO/Video.test.js.map +1 -0
- package/dist/tests/Machine.test.js +27 -42
- package/dist/tests/Machine.test.js.map +1 -1
- package/package.json +1 -1
- package/src/components/IO/{SerialCard.ts → ACIA.ts} +2 -2
- package/src/components/IO/{GPIOAttachments/GPIOAttachment.ts → Attachments/Attachment.ts} +2 -2
- package/src/components/IO/{GPIOAttachments/GPIOJoystickAttachment.ts → Attachments/JoystickAttachment.ts} +3 -3
- package/src/components/IO/{GPIOAttachments/GPIOKeyboardEncoderAttachment.ts → Attachments/KeyboardEncoderAttachment.ts} +3 -3
- package/src/components/IO/{GPIOAttachments/GPIOKeyboardMatrixAttachment.ts → Attachments/KeyboardMatrixAttachment.ts} +5 -5
- package/src/components/IO/{GPIOAttachments/GPIOKeypadAttachment.ts → Attachments/KeypadAttachment.ts} +3 -3
- package/src/components/IO/{GPIOAttachments/GPIOLCDAttachment.ts → Attachments/LCDAttachment.ts} +7 -7
- package/src/components/IO/{EmptyCard.ts → Empty.ts} +1 -1
- package/src/components/IO/{RAMCard.ts → RAMBank.ts} +8 -8
- package/src/components/IO/{RTCCard.ts → RTC.ts} +1 -1
- package/src/components/IO/{SoundCard.ts → Sound.ts} +2 -2
- package/src/components/IO/{StorageCard.ts → Storage.ts} +70 -73
- package/src/components/IO/{DevOutputBoard.ts → Terminal.ts} +2 -2
- package/src/components/IO/{GPIOCard.ts → VIA.ts} +64 -64
- package/src/components/IO/{VideoCard.ts → Video.ts} +1 -1
- package/src/components/Machine.ts +276 -176
- package/src/index.ts +34 -21
- package/src/lib.ts +16 -16
- package/src/tests/IO/{SerialCard.test.ts → ACIA.test.ts} +5 -5
- package/src/tests/IO/{GPIOAttachments/GPIOAttachment.test.ts → Attachments/Attachment.test.ts} +12 -12
- package/src/tests/IO/{GPIOAttachments/GPIOJoystickAttachment.test.ts → Attachments/JoystickAttachment.test.ts} +23 -23
- package/src/tests/IO/{GPIOAttachments/GPIOKeyboardEncoderAttachment.test.ts → Attachments/KeyboardEncoderAttachment.test.ts} +4 -4
- package/src/tests/IO/{GPIOAttachments/GPIOKeyboardMatrixAttachment.test.ts → Attachments/KeyboardMatrixAttachment.test.ts} +5 -5
- package/src/tests/IO/{GPIOAttachments/GPIOKeypadAttachment.test.ts → Attachments/KeypadAttachment.test.ts} +38 -38
- package/src/tests/IO/{GPIOAttachments/GPIOLCDAttachment.test.ts → Attachments/LCDAttachment.test.ts} +12 -12
- package/src/tests/IO/Empty.test.ts +143 -0
- package/src/tests/IO/{RAMCard.test.ts → RAMBank.test.ts} +33 -33
- package/src/tests/IO/{RTCCard.test.ts → RTC.test.ts} +6 -6
- package/src/tests/IO/{SoundCard.test.ts → Sound.test.ts} +6 -6
- package/src/tests/IO/{StorageCard.test.ts → Storage.test.ts} +34 -25
- package/src/tests/IO/{GPIOCard.test.ts → VIA.test.ts} +7 -7
- package/src/tests/IO/{VideoCard.test.ts → Video.test.ts} +13 -13
- package/src/tests/Machine.test.ts +31 -38
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VIA = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* VIA - Emulates the 65C22 VIA (Versatile Interface Adapter)
|
|
6
|
+
*
|
|
7
|
+
* The 65C22 VIA provides:
|
|
8
|
+
* - Two 8-bit bidirectional I/O ports (Port A and Port B)
|
|
9
|
+
* - Two 16-bit timers with interrupt generation
|
|
10
|
+
* - Shift register for serial I/O
|
|
11
|
+
* - Handshaking lines for data transfer
|
|
12
|
+
*/
|
|
13
|
+
class VIA {
|
|
14
|
+
constructor() {
|
|
15
|
+
// VIA Registers
|
|
16
|
+
this.regORB = 0x00;
|
|
17
|
+
this.regORA = 0x00;
|
|
18
|
+
this.regDDRB = 0x00;
|
|
19
|
+
this.regDDRA = 0x00;
|
|
20
|
+
this.regT1C = 0xFFFF;
|
|
21
|
+
this.regT1L = 0xFFFF;
|
|
22
|
+
this.regT2C = 0xFFFF;
|
|
23
|
+
this.regT2L = 0xFF;
|
|
24
|
+
this.regSR = 0x00;
|
|
25
|
+
this.regACR = 0x00;
|
|
26
|
+
this.regPCR = 0x00;
|
|
27
|
+
this.regIFR = 0x00;
|
|
28
|
+
this.regIER = 0x00;
|
|
29
|
+
// Control lines
|
|
30
|
+
this.CA1 = false;
|
|
31
|
+
this.CA2 = false;
|
|
32
|
+
this.CB1 = false;
|
|
33
|
+
this.CB2 = false;
|
|
34
|
+
// Timer states
|
|
35
|
+
this.T1_running = false;
|
|
36
|
+
this.T2_running = false;
|
|
37
|
+
this.T1_IRQ_enabled = false;
|
|
38
|
+
this.T2_IRQ_enabled = false;
|
|
39
|
+
// Timing
|
|
40
|
+
this.tickCounter = 0;
|
|
41
|
+
this.ticksPerMicrosecond = 1;
|
|
42
|
+
// Attachments
|
|
43
|
+
this.portA_attachments = [];
|
|
44
|
+
this.portB_attachments = [];
|
|
45
|
+
this.portA_attachmentCount = 0;
|
|
46
|
+
this.portB_attachmentCount = 0;
|
|
47
|
+
this.raiseIRQ = () => { };
|
|
48
|
+
this.raiseNMI = () => { };
|
|
49
|
+
this.reset(true);
|
|
50
|
+
}
|
|
51
|
+
reset(coldStart) {
|
|
52
|
+
// Reset all VIA registers
|
|
53
|
+
this.regORB = 0x00;
|
|
54
|
+
this.regORA = 0x00;
|
|
55
|
+
this.regDDRB = 0x00;
|
|
56
|
+
this.regDDRA = 0x00;
|
|
57
|
+
this.regT1C = 0xFFFF;
|
|
58
|
+
this.regT1L = 0xFFFF;
|
|
59
|
+
this.regT2C = 0xFFFF;
|
|
60
|
+
this.regT2L = 0xFF;
|
|
61
|
+
this.regSR = 0x00;
|
|
62
|
+
this.regACR = 0x00;
|
|
63
|
+
this.regPCR = 0x00;
|
|
64
|
+
this.regIFR = 0x00;
|
|
65
|
+
this.regIER = 0x00;
|
|
66
|
+
// Reset control lines
|
|
67
|
+
this.CA1 = false;
|
|
68
|
+
this.CA2 = false;
|
|
69
|
+
this.CB1 = false;
|
|
70
|
+
this.CB2 = false;
|
|
71
|
+
// Reset timer states
|
|
72
|
+
this.T1_running = false;
|
|
73
|
+
this.T2_running = false;
|
|
74
|
+
this.T1_IRQ_enabled = false;
|
|
75
|
+
this.T2_IRQ_enabled = false;
|
|
76
|
+
// Initialize attachment arrays
|
|
77
|
+
this.portA_attachmentCount = 0;
|
|
78
|
+
this.portB_attachmentCount = 0;
|
|
79
|
+
for (let i = 0; i < VIA.MAX_ATTACHMENTS_PER_PORT; i++) {
|
|
80
|
+
this.portA_attachments[i] = null;
|
|
81
|
+
this.portB_attachments[i] = null;
|
|
82
|
+
}
|
|
83
|
+
// Reset all attachments
|
|
84
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
85
|
+
if (this.portA_attachments[i] !== null) {
|
|
86
|
+
this.portA_attachments[i].reset();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
90
|
+
if (this.portB_attachments[i] !== null) {
|
|
91
|
+
this.portB_attachments[i].reset();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Reset timing
|
|
95
|
+
this.tickCounter = 0;
|
|
96
|
+
this.ticksPerMicrosecond = 1;
|
|
97
|
+
}
|
|
98
|
+
read(address) {
|
|
99
|
+
const reg = address & 0x0F;
|
|
100
|
+
let value = 0x00;
|
|
101
|
+
switch (reg) {
|
|
102
|
+
case VIA.VIA_ORB:
|
|
103
|
+
// Reading ORB clears CB1 and CB2 interrupt flags
|
|
104
|
+
this.clearIRQFlag(VIA.IRQ_CB1 | VIA.IRQ_CB2);
|
|
105
|
+
value = this.readPortB();
|
|
106
|
+
// Notify attachments that interrupts were cleared
|
|
107
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
108
|
+
if (this.portB_attachments[i] !== null) {
|
|
109
|
+
this.portB_attachments[i].clearInterrupts(false, false, true, true);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
case VIA.VIA_ORA:
|
|
114
|
+
// Reading ORA clears CA1 and CA2 interrupt flags
|
|
115
|
+
this.clearIRQFlag(VIA.IRQ_CA1 | VIA.IRQ_CA2);
|
|
116
|
+
value = this.readPortA();
|
|
117
|
+
// Notify attachments that interrupts were cleared
|
|
118
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
119
|
+
if (this.portA_attachments[i] !== null) {
|
|
120
|
+
this.portA_attachments[i].clearInterrupts(true, true, false, false);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
case VIA.VIA_DDRB:
|
|
125
|
+
value = this.regDDRB;
|
|
126
|
+
break;
|
|
127
|
+
case VIA.VIA_DDRA:
|
|
128
|
+
value = this.regDDRA;
|
|
129
|
+
break;
|
|
130
|
+
case VIA.VIA_T1CL:
|
|
131
|
+
// Reading T1CL clears T1 interrupt flag
|
|
132
|
+
this.clearIRQFlag(VIA.IRQ_T1);
|
|
133
|
+
value = this.regT1C & 0xFF;
|
|
134
|
+
break;
|
|
135
|
+
case VIA.VIA_T1CH:
|
|
136
|
+
value = (this.regT1C >> 8) & 0xFF;
|
|
137
|
+
break;
|
|
138
|
+
case VIA.VIA_T1LL:
|
|
139
|
+
value = this.regT1L & 0xFF;
|
|
140
|
+
break;
|
|
141
|
+
case VIA.VIA_T1LH:
|
|
142
|
+
value = (this.regT1L >> 8) & 0xFF;
|
|
143
|
+
break;
|
|
144
|
+
case VIA.VIA_T2CL:
|
|
145
|
+
// Reading T2CL clears T2 interrupt flag
|
|
146
|
+
this.clearIRQFlag(VIA.IRQ_T2);
|
|
147
|
+
value = this.regT2C & 0xFF;
|
|
148
|
+
break;
|
|
149
|
+
case VIA.VIA_T2CH:
|
|
150
|
+
value = (this.regT2C >> 8) & 0xFF;
|
|
151
|
+
break;
|
|
152
|
+
case VIA.VIA_SR:
|
|
153
|
+
// Reading SR clears SR interrupt flag
|
|
154
|
+
this.clearIRQFlag(VIA.IRQ_SR);
|
|
155
|
+
value = this.regSR;
|
|
156
|
+
break;
|
|
157
|
+
case VIA.VIA_ACR:
|
|
158
|
+
value = this.regACR;
|
|
159
|
+
break;
|
|
160
|
+
case VIA.VIA_PCR:
|
|
161
|
+
value = this.regPCR;
|
|
162
|
+
break;
|
|
163
|
+
case VIA.VIA_IFR:
|
|
164
|
+
value = this.regIFR;
|
|
165
|
+
// Bit 7 is set if any enabled interrupt is active
|
|
166
|
+
if (this.regIFR & this.regIER & 0x7F) {
|
|
167
|
+
value |= VIA.IRQ_IRQ;
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
case VIA.VIA_IER:
|
|
171
|
+
value = this.regIER | 0x80; // Bit 7 always reads as 1
|
|
172
|
+
break;
|
|
173
|
+
case VIA.VIA_ORA_NH:
|
|
174
|
+
// Reading ORA without handshake (no interrupt flag clearing)
|
|
175
|
+
value = this.readPortA();
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
return value & 0xFF;
|
|
179
|
+
}
|
|
180
|
+
write(address, data) {
|
|
181
|
+
const reg = address & 0x0F;
|
|
182
|
+
const value = data & 0xFF;
|
|
183
|
+
switch (reg) {
|
|
184
|
+
case VIA.VIA_ORB:
|
|
185
|
+
// Writing ORB clears CB1 and CB2 interrupt flags
|
|
186
|
+
this.clearIRQFlag(VIA.IRQ_CB1 | VIA.IRQ_CB2);
|
|
187
|
+
this.regORB = value;
|
|
188
|
+
this.writePortB(value);
|
|
189
|
+
break;
|
|
190
|
+
case VIA.VIA_ORA:
|
|
191
|
+
// Writing ORA clears CA1 and CA2 interrupt flags
|
|
192
|
+
this.clearIRQFlag(VIA.IRQ_CA1 | VIA.IRQ_CA2);
|
|
193
|
+
this.regORA = value;
|
|
194
|
+
this.writePortA(value);
|
|
195
|
+
break;
|
|
196
|
+
case VIA.VIA_DDRB:
|
|
197
|
+
this.regDDRB = value;
|
|
198
|
+
break;
|
|
199
|
+
case VIA.VIA_DDRA:
|
|
200
|
+
this.regDDRA = value;
|
|
201
|
+
break;
|
|
202
|
+
case VIA.VIA_T1CL:
|
|
203
|
+
case VIA.VIA_T1LL:
|
|
204
|
+
// Write to T1 low latch
|
|
205
|
+
this.regT1L = (this.regT1L & 0xFF00) | value;
|
|
206
|
+
break;
|
|
207
|
+
case VIA.VIA_T1CH:
|
|
208
|
+
// Write to T1 high counter - loads latch into counter and starts timer
|
|
209
|
+
this.regT1L = (this.regT1L & 0x00FF) | (value << 8);
|
|
210
|
+
this.regT1C = this.regT1L;
|
|
211
|
+
this.clearIRQFlag(VIA.IRQ_T1);
|
|
212
|
+
this.T1_running = true;
|
|
213
|
+
break;
|
|
214
|
+
case VIA.VIA_T1LH:
|
|
215
|
+
// Write to T1 high latch
|
|
216
|
+
this.regT1L = (this.regT1L & 0x00FF) | (value << 8);
|
|
217
|
+
this.clearIRQFlag(VIA.IRQ_T1);
|
|
218
|
+
break;
|
|
219
|
+
case VIA.VIA_T2CL:
|
|
220
|
+
// Write to T2 low latch
|
|
221
|
+
this.regT2L = value;
|
|
222
|
+
break;
|
|
223
|
+
case VIA.VIA_T2CH:
|
|
224
|
+
// Write to T2 high counter - loads latch into counter and starts timer
|
|
225
|
+
this.regT2C = (value << 8) | this.regT2L;
|
|
226
|
+
this.clearIRQFlag(VIA.IRQ_T2);
|
|
227
|
+
this.T2_running = true;
|
|
228
|
+
break;
|
|
229
|
+
case VIA.VIA_SR:
|
|
230
|
+
this.regSR = value;
|
|
231
|
+
this.clearIRQFlag(VIA.IRQ_SR);
|
|
232
|
+
break;
|
|
233
|
+
case VIA.VIA_ACR:
|
|
234
|
+
this.regACR = value;
|
|
235
|
+
// ACR controls timer modes, shift register, and latching
|
|
236
|
+
break;
|
|
237
|
+
case VIA.VIA_PCR:
|
|
238
|
+
this.regPCR = value;
|
|
239
|
+
// PCR controls CA1, CA2, CB1, CB2 behavior
|
|
240
|
+
this.updateCA2();
|
|
241
|
+
this.updateCB2();
|
|
242
|
+
break;
|
|
243
|
+
case VIA.VIA_IFR:
|
|
244
|
+
// Writing to IFR clears the corresponding interrupt flags
|
|
245
|
+
this.regIFR &= ~(value & 0x7F);
|
|
246
|
+
this.updateIRQ();
|
|
247
|
+
break;
|
|
248
|
+
case VIA.VIA_IER:
|
|
249
|
+
// Bit 7 determines set (1) or clear (0)
|
|
250
|
+
if (value & 0x80) {
|
|
251
|
+
this.regIER |= (value & 0x7F);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
this.regIER &= ~(value & 0x7F);
|
|
255
|
+
}
|
|
256
|
+
this.updateIRQ();
|
|
257
|
+
break;
|
|
258
|
+
case VIA.VIA_ORA_NH:
|
|
259
|
+
// Writing ORA without handshake (no interrupt flag clearing)
|
|
260
|
+
this.regORA = value;
|
|
261
|
+
this.writePortA(value);
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
tick(frequency) {
|
|
266
|
+
this.tickCounter++;
|
|
267
|
+
// Update Timer 1
|
|
268
|
+
if (this.T1_running && this.regT1C > 0) {
|
|
269
|
+
this.regT1C--;
|
|
270
|
+
if (this.regT1C === 0) {
|
|
271
|
+
this.setIRQFlag(VIA.IRQ_T1);
|
|
272
|
+
// Check if timer is in free-run mode (ACR bit 6)
|
|
273
|
+
if (this.regACR & 0x40) {
|
|
274
|
+
this.regT1C = this.regT1L; // Reload from latch
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
this.T1_running = false;
|
|
278
|
+
}
|
|
279
|
+
// Toggle PB7 if enabled (ACR bit 7)
|
|
280
|
+
if (this.regACR & 0x80) {
|
|
281
|
+
this.regORB ^= 0x80;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Update Timer 2
|
|
286
|
+
if (this.T2_running && this.regT2C > 0) {
|
|
287
|
+
this.regT2C--;
|
|
288
|
+
if (this.regT2C === 0) {
|
|
289
|
+
this.setIRQFlag(VIA.IRQ_T2);
|
|
290
|
+
this.T2_running = false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Tick all attachments
|
|
294
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
295
|
+
if (this.portA_attachments[i] !== null) {
|
|
296
|
+
this.portA_attachments[i].tick(frequency);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
300
|
+
if (this.portB_attachments[i] !== null) {
|
|
301
|
+
this.portB_attachments[i].tick(frequency);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
// Check for attachment interrupts
|
|
305
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
306
|
+
if (this.portA_attachments[i] !== null) {
|
|
307
|
+
if (this.portA_attachments[i].hasCA1Interrupt()) {
|
|
308
|
+
this.setIRQFlag(VIA.IRQ_CA1);
|
|
309
|
+
}
|
|
310
|
+
if (this.portA_attachments[i].hasCA2Interrupt()) {
|
|
311
|
+
this.setIRQFlag(VIA.IRQ_CA2);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
316
|
+
if (this.portB_attachments[i] !== null) {
|
|
317
|
+
if (this.portB_attachments[i].hasCB1Interrupt()) {
|
|
318
|
+
this.setIRQFlag(VIA.IRQ_CB1);
|
|
319
|
+
}
|
|
320
|
+
if (this.portB_attachments[i].hasCB2Interrupt()) {
|
|
321
|
+
this.setIRQFlag(VIA.IRQ_CB2);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Raise IRQ if any enabled interrupt is active
|
|
326
|
+
if (this.regIFR & this.regIER & 0x7F) {
|
|
327
|
+
this.raiseIRQ();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
updateIRQ() {
|
|
331
|
+
// Update bit 7 of IFR based on enabled interrupts
|
|
332
|
+
if (this.regIFR & this.regIER & 0x7F) {
|
|
333
|
+
this.regIFR |= VIA.IRQ_IRQ;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
this.regIFR &= ~VIA.IRQ_IRQ;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
setIRQFlag(flag) {
|
|
340
|
+
this.regIFR |= flag;
|
|
341
|
+
this.updateIRQ();
|
|
342
|
+
}
|
|
343
|
+
clearIRQFlag(flag) {
|
|
344
|
+
this.regIFR &= ~flag;
|
|
345
|
+
this.updateIRQ();
|
|
346
|
+
}
|
|
347
|
+
readPortA() {
|
|
348
|
+
let value = 0xFF;
|
|
349
|
+
// Determine input sources from attachments (priority-based multiplexing)
|
|
350
|
+
let externalInput = 0xFF;
|
|
351
|
+
// Query all Port A attachments in priority order
|
|
352
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
353
|
+
if (this.portA_attachments[i] !== null && this.portA_attachments[i].isEnabled()) {
|
|
354
|
+
const attachmentData = this.portA_attachments[i].readPortA(this.regDDRA, this.regORA);
|
|
355
|
+
// First enabled attachment with data (not 0xFF) wins, or AND all values together
|
|
356
|
+
externalInput &= attachmentData;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// Apply DDR settings: output bits come from ORA, input bits from external
|
|
360
|
+
for (let bit = 0; bit < 8; bit++) {
|
|
361
|
+
if (this.regDDRA & (1 << bit)) {
|
|
362
|
+
// Output mode - read from register
|
|
363
|
+
if (this.regORA & (1 << bit)) {
|
|
364
|
+
value |= (1 << bit);
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
value &= ~(1 << bit);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
// Input mode - read from external source
|
|
372
|
+
if (externalInput & (1 << bit)) {
|
|
373
|
+
value |= (1 << bit);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
value &= ~(1 << bit);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return value & 0xFF;
|
|
381
|
+
}
|
|
382
|
+
readPortB() {
|
|
383
|
+
let value = 0xFF;
|
|
384
|
+
// Determine input sources from attachments (priority-based multiplexing)
|
|
385
|
+
let externalInput = 0xFF;
|
|
386
|
+
// Query all Port B attachments in priority order
|
|
387
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
388
|
+
if (this.portB_attachments[i] !== null && this.portB_attachments[i].isEnabled()) {
|
|
389
|
+
const attachmentData = this.portB_attachments[i].readPortB(this.regDDRB, this.regORB);
|
|
390
|
+
// First enabled attachment with data (not 0xFF) wins, or AND all values together
|
|
391
|
+
externalInput &= attachmentData;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// Apply DDR settings: output bits come from ORB, input bits from external
|
|
395
|
+
for (let bit = 0; bit < 8; bit++) {
|
|
396
|
+
if (this.regDDRB & (1 << bit)) {
|
|
397
|
+
// Output mode - read from register
|
|
398
|
+
if (this.regORB & (1 << bit)) {
|
|
399
|
+
value |= (1 << bit);
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
value &= ~(1 << bit);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
// Input mode - read from external source
|
|
407
|
+
if (externalInput & (1 << bit)) {
|
|
408
|
+
value |= (1 << bit);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
value &= ~(1 << bit);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return value & 0xFF;
|
|
416
|
+
}
|
|
417
|
+
writePortA(value) {
|
|
418
|
+
// Notify all Port A attachments of the write
|
|
419
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
420
|
+
if (this.portA_attachments[i] !== null) {
|
|
421
|
+
this.portA_attachments[i].writePortA(value, this.regDDRA);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
writePortB(value) {
|
|
426
|
+
// Notify all Port B attachments of the write
|
|
427
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
428
|
+
if (this.portB_attachments[i] !== null) {
|
|
429
|
+
this.portB_attachments[i].writePortB(value, this.regDDRB);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
updateCA2() {
|
|
434
|
+
// CA2 control based on PCR bits 1-3
|
|
435
|
+
const ca2_control = (this.regPCR >> 1) & 0x07;
|
|
436
|
+
switch (ca2_control) {
|
|
437
|
+
case 0x00: // Input mode - negative edge
|
|
438
|
+
case 0x01: // Independent interrupt input - negative edge
|
|
439
|
+
case 0x02: // Input mode - positive edge
|
|
440
|
+
case 0x03: // Independent interrupt input - positive edge
|
|
441
|
+
// Input modes
|
|
442
|
+
break;
|
|
443
|
+
case 0x04: // Handshake output
|
|
444
|
+
case 0x05: // Pulse output
|
|
445
|
+
// Output modes
|
|
446
|
+
break;
|
|
447
|
+
case 0x06: // Manual output LOW
|
|
448
|
+
this.CA2 = false;
|
|
449
|
+
break;
|
|
450
|
+
case 0x07: // Manual output HIGH
|
|
451
|
+
this.CA2 = true;
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
// Notify all attachments of control line changes
|
|
455
|
+
this.notifyAttachmentsControlLines();
|
|
456
|
+
}
|
|
457
|
+
updateCB2() {
|
|
458
|
+
// CB2 control based on PCR bits 5-7
|
|
459
|
+
const cb2_control = (this.regPCR >> 5) & 0x07;
|
|
460
|
+
switch (cb2_control) {
|
|
461
|
+
case 0x00: // Input mode - negative edge
|
|
462
|
+
case 0x01: // Independent interrupt input - negative edge
|
|
463
|
+
case 0x02: // Input mode - positive edge
|
|
464
|
+
case 0x03: // Independent interrupt input - positive edge
|
|
465
|
+
// Input modes
|
|
466
|
+
break;
|
|
467
|
+
case 0x04: // Handshake output
|
|
468
|
+
case 0x05: // Pulse output
|
|
469
|
+
// Output modes
|
|
470
|
+
break;
|
|
471
|
+
case 0x06: // Manual output LOW
|
|
472
|
+
this.CB2 = false;
|
|
473
|
+
break;
|
|
474
|
+
case 0x07: // Manual output HIGH
|
|
475
|
+
this.CB2 = true;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
// Notify all attachments of control line changes
|
|
479
|
+
this.notifyAttachmentsControlLines();
|
|
480
|
+
}
|
|
481
|
+
notifyAttachmentsControlLines() {
|
|
482
|
+
// Notify all attachments of control line state changes
|
|
483
|
+
for (let i = 0; i < this.portA_attachmentCount; i++) {
|
|
484
|
+
if (this.portA_attachments[i] !== null) {
|
|
485
|
+
this.portA_attachments[i].updateControlLines(this.CA1, this.CA2, this.CB1, this.CB2);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
for (let i = 0; i < this.portB_attachmentCount; i++) {
|
|
489
|
+
if (this.portB_attachments[i] !== null) {
|
|
490
|
+
this.portB_attachments[i].updateControlLines(this.CA1, this.CA2, this.CB1, this.CB2);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
sortAttachmentsByPriority() {
|
|
495
|
+
// Simple bubble sort for Port A attachments by priority (lower = higher priority)
|
|
496
|
+
for (let i = 0; i < this.portA_attachmentCount - 1; i++) {
|
|
497
|
+
for (let j = 0; j < this.portA_attachmentCount - i - 1; j++) {
|
|
498
|
+
if (this.portA_attachments[j] !== null && this.portA_attachments[j + 1] !== null) {
|
|
499
|
+
if (this.portA_attachments[j].getPriority() > this.portA_attachments[j + 1].getPriority()) {
|
|
500
|
+
// Swap
|
|
501
|
+
const temp = this.portA_attachments[j];
|
|
502
|
+
this.portA_attachments[j] = this.portA_attachments[j + 1];
|
|
503
|
+
this.portA_attachments[j + 1] = temp;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
// Simple bubble sort for Port B attachments by priority
|
|
509
|
+
for (let i = 0; i < this.portB_attachmentCount - 1; i++) {
|
|
510
|
+
for (let j = 0; j < this.portB_attachmentCount - i - 1; j++) {
|
|
511
|
+
if (this.portB_attachments[j] !== null && this.portB_attachments[j + 1] !== null) {
|
|
512
|
+
if (this.portB_attachments[j].getPriority() > this.portB_attachments[j + 1].getPriority()) {
|
|
513
|
+
// Swap
|
|
514
|
+
const temp = this.portB_attachments[j];
|
|
515
|
+
this.portB_attachments[j] = this.portB_attachments[j + 1];
|
|
516
|
+
this.portB_attachments[j + 1] = temp;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Attach a GPIO device to Port A
|
|
524
|
+
* @param attachment - The attachment to add
|
|
525
|
+
*/
|
|
526
|
+
attachToPortA(attachment) {
|
|
527
|
+
if (attachment !== null && this.portA_attachmentCount < VIA.MAX_ATTACHMENTS_PER_PORT) {
|
|
528
|
+
this.portA_attachments[this.portA_attachmentCount++] = attachment;
|
|
529
|
+
this.sortAttachmentsByPriority();
|
|
530
|
+
// Notify the attachment of current control line states
|
|
531
|
+
attachment.updateControlLines(this.CA1, this.CA2, this.CB1, this.CB2);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Attach a GPIO device to Port B
|
|
536
|
+
* @param attachment - The attachment to add
|
|
537
|
+
*/
|
|
538
|
+
attachToPortB(attachment) {
|
|
539
|
+
if (attachment !== null && this.portB_attachmentCount < VIA.MAX_ATTACHMENTS_PER_PORT) {
|
|
540
|
+
this.portB_attachments[this.portB_attachmentCount++] = attachment;
|
|
541
|
+
this.sortAttachmentsByPriority();
|
|
542
|
+
// Notify the attachment of current control line states
|
|
543
|
+
attachment.updateControlLines(this.CA1, this.CA2, this.CB1, this.CB2);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get a Port A attachment by index
|
|
548
|
+
* @param index - The attachment index
|
|
549
|
+
* @returns The attachment or null if not found
|
|
550
|
+
*/
|
|
551
|
+
getPortAAttachment(index) {
|
|
552
|
+
if (index < this.portA_attachmentCount) {
|
|
553
|
+
return this.portA_attachments[index];
|
|
554
|
+
}
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Get a Port B attachment by index
|
|
559
|
+
* @param index - The attachment index
|
|
560
|
+
* @returns The attachment or null if not found
|
|
561
|
+
*/
|
|
562
|
+
getPortBAttachment(index) {
|
|
563
|
+
if (index < this.portB_attachmentCount) {
|
|
564
|
+
return this.portB_attachments[index];
|
|
565
|
+
}
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
exports.VIA = VIA;
|
|
570
|
+
// VIA Register addresses (offset from base address)
|
|
571
|
+
VIA.VIA_ORB = 0x00; // Output Register B
|
|
572
|
+
VIA.VIA_ORA = 0x01; // Output Register A
|
|
573
|
+
VIA.VIA_DDRB = 0x02; // Data Direction Register B
|
|
574
|
+
VIA.VIA_DDRA = 0x03; // Data Direction Register A
|
|
575
|
+
VIA.VIA_T1CL = 0x04; // Timer 1 Counter Low
|
|
576
|
+
VIA.VIA_T1CH = 0x05; // Timer 1 Counter High
|
|
577
|
+
VIA.VIA_T1LL = 0x06; // Timer 1 Latch Low
|
|
578
|
+
VIA.VIA_T1LH = 0x07; // Timer 1 Latch High
|
|
579
|
+
VIA.VIA_T2CL = 0x08; // Timer 2 Counter Low
|
|
580
|
+
VIA.VIA_T2CH = 0x09; // Timer 2 Counter High
|
|
581
|
+
VIA.VIA_SR = 0x0A; // Shift Register
|
|
582
|
+
VIA.VIA_ACR = 0x0B; // Auxiliary Control Register
|
|
583
|
+
VIA.VIA_PCR = 0x0C; // Peripheral Control Register
|
|
584
|
+
VIA.VIA_IFR = 0x0D; // Interrupt Flag Register
|
|
585
|
+
VIA.VIA_IER = 0x0E; // Interrupt Enable Register
|
|
586
|
+
VIA.VIA_ORA_NH = 0x0F; // Output Register A (No Handshake)
|
|
587
|
+
// Interrupt flags
|
|
588
|
+
VIA.IRQ_CA2 = 0x01;
|
|
589
|
+
VIA.IRQ_CA1 = 0x02;
|
|
590
|
+
VIA.IRQ_SR = 0x04;
|
|
591
|
+
VIA.IRQ_CB2 = 0x08;
|
|
592
|
+
VIA.IRQ_CB1 = 0x10;
|
|
593
|
+
VIA.IRQ_T2 = 0x20;
|
|
594
|
+
VIA.IRQ_T1 = 0x40;
|
|
595
|
+
VIA.IRQ_IRQ = 0x80; // Master IRQ flag
|
|
596
|
+
VIA.MAX_ATTACHMENTS_PER_PORT = 8;
|
|
597
|
+
//# sourceMappingURL=VIA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VIA.js","sourceRoot":"","sources":["../../../src/components/IO/VIA.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AACH,MAAa,GAAG;IAuEd;QAxCA,gBAAgB;QACR,WAAM,GAAW,IAAI,CAAA;QACrB,WAAM,GAAW,IAAI,CAAA;QACrB,YAAO,GAAW,IAAI,CAAA;QACtB,YAAO,GAAW,IAAI,CAAA;QACtB,WAAM,GAAW,MAAM,CAAA;QACvB,WAAM,GAAW,MAAM,CAAA;QACvB,WAAM,GAAW,MAAM,CAAA;QACvB,WAAM,GAAW,IAAI,CAAA;QACrB,UAAK,GAAW,IAAI,CAAA;QACpB,WAAM,GAAW,IAAI,CAAA;QACrB,WAAM,GAAW,IAAI,CAAA;QACrB,WAAM,GAAW,IAAI,CAAA;QACrB,WAAM,GAAW,IAAI,CAAA;QAE7B,gBAAgB;QACR,QAAG,GAAY,KAAK,CAAA;QACpB,QAAG,GAAY,KAAK,CAAA;QACpB,QAAG,GAAY,KAAK,CAAA;QACpB,QAAG,GAAY,KAAK,CAAA;QAE5B,eAAe;QACP,eAAU,GAAY,KAAK,CAAA;QAC3B,eAAU,GAAY,KAAK,CAAA;QAC3B,mBAAc,GAAY,KAAK,CAAA;QAC/B,mBAAc,GAAY,KAAK,CAAA;QAEvC,SAAS;QACD,gBAAW,GAAW,CAAC,CAAA;QACvB,wBAAmB,GAAW,CAAC,CAAA;QAEvC,cAAc;QACN,sBAAiB,GAA0B,EAAE,C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