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,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Attachment_1 = require("../../../components/IO/Attachments/Attachment");
|
|
4
|
+
/**
|
|
5
|
+
* Concrete implementation of AttachmentBase for testing
|
|
6
|
+
*/
|
|
7
|
+
class TestAttachment extends Attachment_1.AttachmentBase {
|
|
8
|
+
constructor(priority = 0, ca1Interrupt = false, ca2Interrupt = false, cb1Interrupt = false, cb2Interrupt = false) {
|
|
9
|
+
super(priority, ca1Interrupt, ca2Interrupt, cb1Interrupt, cb2Interrupt);
|
|
10
|
+
this.portAValue = 0xFF;
|
|
11
|
+
this.portBValue = 0xFF;
|
|
12
|
+
this.tickCount = 0;
|
|
13
|
+
this.writeAValue = 0;
|
|
14
|
+
this.writeBValue = 0;
|
|
15
|
+
}
|
|
16
|
+
readPortA(ddr, or) {
|
|
17
|
+
return this.portAValue;
|
|
18
|
+
}
|
|
19
|
+
readPortB(ddr, or) {
|
|
20
|
+
return this.portBValue;
|
|
21
|
+
}
|
|
22
|
+
writePortA(value, ddr) {
|
|
23
|
+
this.writeAValue = value;
|
|
24
|
+
}
|
|
25
|
+
writePortB(value, ddr) {
|
|
26
|
+
this.writeBValue = value;
|
|
27
|
+
}
|
|
28
|
+
tick(cpuFrequency) {
|
|
29
|
+
this.tickCount++;
|
|
30
|
+
}
|
|
31
|
+
// Expose protected members for testing
|
|
32
|
+
setCA1Interrupt(value) {
|
|
33
|
+
this.ca1Interrupt = value;
|
|
34
|
+
}
|
|
35
|
+
setCA2Interrupt(value) {
|
|
36
|
+
this.ca2Interrupt = value;
|
|
37
|
+
}
|
|
38
|
+
setCB1Interrupt(value) {
|
|
39
|
+
this.cb1Interrupt = value;
|
|
40
|
+
}
|
|
41
|
+
setCB2Interrupt(value) {
|
|
42
|
+
this.cb2Interrupt = value;
|
|
43
|
+
}
|
|
44
|
+
setEnabled(value) {
|
|
45
|
+
this.enabled = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
describe('AttachmentBase', () => {
|
|
49
|
+
let attachment;
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
attachment = new TestAttachment();
|
|
52
|
+
});
|
|
53
|
+
describe('Initialization', () => {
|
|
54
|
+
it('should initialize with default priority 0', () => {
|
|
55
|
+
expect(attachment.getPriority()).toBe(0);
|
|
56
|
+
});
|
|
57
|
+
it('should initialize with custom priority', () => {
|
|
58
|
+
const customAttachment = new TestAttachment(5);
|
|
59
|
+
expect(customAttachment.getPriority()).toBe(5);
|
|
60
|
+
});
|
|
61
|
+
it('should initialize as enabled', () => {
|
|
62
|
+
expect(attachment.isEnabled()).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
it('should initialize with no interrupts pending', () => {
|
|
65
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
66
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
67
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
68
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
it('should initialize with specified interrupt states', () => {
|
|
71
|
+
const interruptAttachment = new TestAttachment(0, true, true, true, true);
|
|
72
|
+
expect(interruptAttachment.hasCA1Interrupt()).toBe(true);
|
|
73
|
+
expect(interruptAttachment.hasCA2Interrupt()).toBe(true);
|
|
74
|
+
expect(interruptAttachment.hasCB1Interrupt()).toBe(true);
|
|
75
|
+
expect(interruptAttachment.hasCB2Interrupt()).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('Reset', () => {
|
|
79
|
+
it('should reset to enabled state', () => {
|
|
80
|
+
attachment.setEnabled(false);
|
|
81
|
+
attachment.reset();
|
|
82
|
+
expect(attachment.isEnabled()).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
it('should clear all interrupt flags', () => {
|
|
85
|
+
attachment.setCA1Interrupt(true);
|
|
86
|
+
attachment.setCA2Interrupt(true);
|
|
87
|
+
attachment.setCB1Interrupt(true);
|
|
88
|
+
attachment.setCB2Interrupt(true);
|
|
89
|
+
attachment.reset();
|
|
90
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
91
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
92
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
93
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
it('should maintain priority after reset', () => {
|
|
96
|
+
const priorityAttachment = new TestAttachment(10);
|
|
97
|
+
priorityAttachment.reset();
|
|
98
|
+
expect(priorityAttachment.getPriority()).toBe(10);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe('Priority', () => {
|
|
102
|
+
it('should return correct priority value', () => {
|
|
103
|
+
const lowPriority = new TestAttachment(0);
|
|
104
|
+
const highPriority = new TestAttachment(10);
|
|
105
|
+
expect(lowPriority.getPriority()).toBe(0);
|
|
106
|
+
expect(highPriority.getPriority()).toBe(10);
|
|
107
|
+
});
|
|
108
|
+
it('should support negative priority values', () => {
|
|
109
|
+
const negativePriority = new TestAttachment(-5);
|
|
110
|
+
expect(negativePriority.getPriority()).toBe(-5);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
describe('Enable/Disable', () => {
|
|
114
|
+
it('should start enabled', () => {
|
|
115
|
+
expect(attachment.isEnabled()).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
it('should be disableable', () => {
|
|
118
|
+
attachment.setEnabled(false);
|
|
119
|
+
expect(attachment.isEnabled()).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
it('should be re-enableable', () => {
|
|
122
|
+
attachment.setEnabled(false);
|
|
123
|
+
attachment.setEnabled(true);
|
|
124
|
+
expect(attachment.isEnabled()).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe('Tick', () => {
|
|
128
|
+
it('should call tick method', () => {
|
|
129
|
+
attachment.tick(1000000);
|
|
130
|
+
expect(attachment.tickCount).toBe(1);
|
|
131
|
+
});
|
|
132
|
+
it('should call tick multiple times', () => {
|
|
133
|
+
attachment.tick(1000000);
|
|
134
|
+
attachment.tick(1000000);
|
|
135
|
+
attachment.tick(1000000);
|
|
136
|
+
expect(attachment.tickCount).toBe(3);
|
|
137
|
+
});
|
|
138
|
+
it('should accept different CPU frequencies', () => {
|
|
139
|
+
attachment.tick(1000000);
|
|
140
|
+
attachment.tick(2000000);
|
|
141
|
+
attachment.tick(4000000);
|
|
142
|
+
expect(attachment.tickCount).toBe(3);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe('Port Reading', () => {
|
|
146
|
+
it('should read from Port A', () => {
|
|
147
|
+
attachment.portAValue = 0xAA;
|
|
148
|
+
expect(attachment.readPortA(0xFF, 0x00)).toBe(0xAA);
|
|
149
|
+
});
|
|
150
|
+
it('should read from Port B', () => {
|
|
151
|
+
attachment.portBValue = 0x55;
|
|
152
|
+
expect(attachment.readPortB(0xFF, 0x00)).toBe(0x55);
|
|
153
|
+
});
|
|
154
|
+
it('should handle DDR parameter in Port A read', () => {
|
|
155
|
+
attachment.portAValue = 0xFF;
|
|
156
|
+
expect(attachment.readPortA(0x00, 0x00)).toBe(0xFF);
|
|
157
|
+
expect(attachment.readPortA(0xFF, 0x00)).toBe(0xFF);
|
|
158
|
+
});
|
|
159
|
+
it('should handle OR parameter in Port A read', () => {
|
|
160
|
+
attachment.portAValue = 0xFF;
|
|
161
|
+
expect(attachment.readPortA(0xFF, 0x00)).toBe(0xFF);
|
|
162
|
+
expect(attachment.readPortA(0xFF, 0xFF)).toBe(0xFF);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('Port Writing', () => {
|
|
166
|
+
it('should write to Port A', () => {
|
|
167
|
+
attachment.writePortA(0xAA, 0xFF);
|
|
168
|
+
expect(attachment.writeAValue).toBe(0xAA);
|
|
169
|
+
});
|
|
170
|
+
it('should write to Port B', () => {
|
|
171
|
+
attachment.writePortB(0x55, 0xFF);
|
|
172
|
+
expect(attachment.writeBValue).toBe(0x55);
|
|
173
|
+
});
|
|
174
|
+
it('should handle DDR parameter in Port A write', () => {
|
|
175
|
+
attachment.writePortA(0xAA, 0x0F);
|
|
176
|
+
expect(attachment.writeAValue).toBe(0xAA);
|
|
177
|
+
});
|
|
178
|
+
it('should handle DDR parameter in Port B write', () => {
|
|
179
|
+
attachment.writePortB(0x55, 0xF0);
|
|
180
|
+
expect(attachment.writeBValue).toBe(0x55);
|
|
181
|
+
});
|
|
182
|
+
it('should handle multiple writes to same port', () => {
|
|
183
|
+
attachment.writePortA(0xAA, 0xFF);
|
|
184
|
+
attachment.writePortA(0x55, 0xFF);
|
|
185
|
+
expect(attachment.writeAValue).toBe(0x55);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe('Interrupt Management - CA1', () => {
|
|
189
|
+
it('should check CA1 interrupt flag', () => {
|
|
190
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
191
|
+
attachment.setCA1Interrupt(true);
|
|
192
|
+
expect(attachment.hasCA1Interrupt()).toBe(true);
|
|
193
|
+
});
|
|
194
|
+
it('should clear CA1 interrupt', () => {
|
|
195
|
+
attachment.setCA1Interrupt(true);
|
|
196
|
+
attachment.clearInterrupts(true, false, false, false);
|
|
197
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
198
|
+
});
|
|
199
|
+
it('should not clear CA1 when clearing other interrupts', () => {
|
|
200
|
+
attachment.setCA1Interrupt(true);
|
|
201
|
+
attachment.clearInterrupts(false, true, true, true);
|
|
202
|
+
expect(attachment.hasCA1Interrupt()).toBe(true);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
describe('Interrupt Management - CA2', () => {
|
|
206
|
+
it('should check CA2 interrupt flag', () => {
|
|
207
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
208
|
+
attachment.setCA2Interrupt(true);
|
|
209
|
+
expect(attachment.hasCA2Interrupt()).toBe(true);
|
|
210
|
+
});
|
|
211
|
+
it('should clear CA2 interrupt', () => {
|
|
212
|
+
attachment.setCA2Interrupt(true);
|
|
213
|
+
attachment.clearInterrupts(false, true, false, false);
|
|
214
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
215
|
+
});
|
|
216
|
+
it('should not clear CA2 when clearing other interrupts', () => {
|
|
217
|
+
attachment.setCA2Interrupt(true);
|
|
218
|
+
attachment.clearInterrupts(true, false, true, true);
|
|
219
|
+
expect(attachment.hasCA2Interrupt()).toBe(true);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
describe('Interrupt Management - CB1', () => {
|
|
223
|
+
it('should check CB1 interrupt flag', () => {
|
|
224
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
225
|
+
attachment.setCB1Interrupt(true);
|
|
226
|
+
expect(attachment.hasCB1Interrupt()).toBe(true);
|
|
227
|
+
});
|
|
228
|
+
it('should clear CB1 interrupt', () => {
|
|
229
|
+
attachment.setCB1Interrupt(true);
|
|
230
|
+
attachment.clearInterrupts(false, false, true, false);
|
|
231
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
232
|
+
});
|
|
233
|
+
it('should not clear CB1 when clearing other interrupts', () => {
|
|
234
|
+
attachment.setCB1Interrupt(true);
|
|
235
|
+
attachment.clearInterrupts(true, true, false, true);
|
|
236
|
+
expect(attachment.hasCB1Interrupt()).toBe(true);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
describe('Interrupt Management - CB2', () => {
|
|
240
|
+
it('should check CB2 interrupt flag', () => {
|
|
241
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
242
|
+
attachment.setCB2Interrupt(true);
|
|
243
|
+
expect(attachment.hasCB2Interrupt()).toBe(true);
|
|
244
|
+
});
|
|
245
|
+
it('should clear CB2 interrupt', () => {
|
|
246
|
+
attachment.setCB2Interrupt(true);
|
|
247
|
+
attachment.clearInterrupts(false, false, false, true);
|
|
248
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
249
|
+
});
|
|
250
|
+
it('should not clear CB2 when clearing other interrupts', () => {
|
|
251
|
+
attachment.setCB2Interrupt(true);
|
|
252
|
+
attachment.clearInterrupts(true, true, true, false);
|
|
253
|
+
expect(attachment.hasCB2Interrupt()).toBe(true);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
describe('Interrupt Management - Multiple', () => {
|
|
257
|
+
it('should clear multiple interrupts at once', () => {
|
|
258
|
+
attachment.setCA1Interrupt(true);
|
|
259
|
+
attachment.setCA2Interrupt(true);
|
|
260
|
+
attachment.setCB1Interrupt(true);
|
|
261
|
+
attachment.setCB2Interrupt(true);
|
|
262
|
+
attachment.clearInterrupts(true, true, false, false);
|
|
263
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
264
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
265
|
+
expect(attachment.hasCB1Interrupt()).toBe(true);
|
|
266
|
+
expect(attachment.hasCB2Interrupt()).toBe(true);
|
|
267
|
+
});
|
|
268
|
+
it('should clear all interrupts', () => {
|
|
269
|
+
attachment.setCA1Interrupt(true);
|
|
270
|
+
attachment.setCA2Interrupt(true);
|
|
271
|
+
attachment.setCB1Interrupt(true);
|
|
272
|
+
attachment.setCB2Interrupt(true);
|
|
273
|
+
attachment.clearInterrupts(true, true, true, true);
|
|
274
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
275
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
276
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
277
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
278
|
+
});
|
|
279
|
+
it('should handle clearing when no interrupts are set', () => {
|
|
280
|
+
attachment.clearInterrupts(true, true, true, true);
|
|
281
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
282
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
283
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
284
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
describe('Control Lines', () => {
|
|
288
|
+
it('should call updateControlLines', () => {
|
|
289
|
+
// Default implementation does nothing, just verify it doesn't crash
|
|
290
|
+
expect(() => {
|
|
291
|
+
attachment.updateControlLines(true, false, true, false);
|
|
292
|
+
}).not.toThrow();
|
|
293
|
+
});
|
|
294
|
+
it('should accept all control line combinations', () => {
|
|
295
|
+
expect(() => {
|
|
296
|
+
attachment.updateControlLines(false, false, false, false);
|
|
297
|
+
attachment.updateControlLines(true, true, true, true);
|
|
298
|
+
attachment.updateControlLines(true, false, true, false);
|
|
299
|
+
attachment.updateControlLines(false, true, false, true);
|
|
300
|
+
}).not.toThrow();
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe('Edge Cases', () => {
|
|
304
|
+
it('should handle rapid enable/disable cycles', () => {
|
|
305
|
+
for (let i = 0; i < 100; i++) {
|
|
306
|
+
attachment.setEnabled(i % 2 === 0);
|
|
307
|
+
}
|
|
308
|
+
// Last iteration (i=99) sets enabled to false (99 % 2 !== 0)
|
|
309
|
+
expect(attachment.isEnabled()).toBe(false);
|
|
310
|
+
});
|
|
311
|
+
it('should handle rapid interrupt set/clear cycles', () => {
|
|
312
|
+
for (let i = 0; i < 100; i++) {
|
|
313
|
+
attachment.setCA1Interrupt(true);
|
|
314
|
+
attachment.clearInterrupts(true, false, false, false);
|
|
315
|
+
}
|
|
316
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
317
|
+
});
|
|
318
|
+
it('should handle reset during active interrupts', () => {
|
|
319
|
+
attachment.setCA1Interrupt(true);
|
|
320
|
+
attachment.setCA2Interrupt(true);
|
|
321
|
+
attachment.setCB1Interrupt(true);
|
|
322
|
+
attachment.setCB2Interrupt(true);
|
|
323
|
+
attachment.reset();
|
|
324
|
+
expect(attachment.hasCA1Interrupt()).toBe(false);
|
|
325
|
+
expect(attachment.hasCA2Interrupt()).toBe(false);
|
|
326
|
+
expect(attachment.hasCB1Interrupt()).toBe(false);
|
|
327
|
+
expect(attachment.hasCB2Interrupt()).toBe(false);
|
|
328
|
+
});
|
|
329
|
+
it('should maintain state across multiple operations', () => {
|
|
330
|
+
attachment.setCA1Interrupt(true);
|
|
331
|
+
attachment.tick(1000000);
|
|
332
|
+
attachment.writePortA(0xAA, 0xFF);
|
|
333
|
+
expect(attachment.hasCA1Interrupt()).toBe(true);
|
|
334
|
+
expect(attachment.tickCount).toBe(1);
|
|
335
|
+
expect(attachment.writeAValue).toBe(0xAA);
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
//# sourceMappingURL=Attachment.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.test.js","sourceRoot":"","sources":["../../../../src/tests/IO/Attachments/Attachment.test.ts"],"names":[],"mappings":";;AAAA,8EAA0F;AAE1F;;GAEG;AACH,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AI,CAAC,CAAA;YAChC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAChC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAEhC,UAAU,CAAC,KAAK,EAAE,CAAA;YAElB,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAChD,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAChD,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAChD,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAChC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACxB,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YAEjC,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/C,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACpC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const JoystickAttachment_1 = require("../../../components/IO/Attachments/JoystickAttachment");
|
|
4
|
+
describe('JoystickAttachment', () => {
|
|
5
|
+
let joystick;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
joystick = new JoystickAttachment_1.JoystickAttachment(true, 0);
|
|
8
|
+
});
|
|
9
|
+
describe('constructor and reset', () => {
|
|
10
|
+
it('should initialize with no buttons pressed', () => {
|
|
11
|
+
expect(joystick.getButtonState()).toBe(0x00);
|
|
12
|
+
});
|
|
13
|
+
it('should reset button state', () => {
|
|
14
|
+
joystick.updateJoystick(0xFF);
|
|
15
|
+
joystick.reset();
|
|
16
|
+
expect(joystick.getButtonState()).toBe(0x00);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('button state management', () => {
|
|
20
|
+
it('should update joystick state', () => {
|
|
21
|
+
joystick.updateJoystick(0x55);
|
|
22
|
+
expect(joystick.getButtonState()).toBe(0x55);
|
|
23
|
+
});
|
|
24
|
+
it('should check if button is pressed', () => {
|
|
25
|
+
joystick.pressButton(JoystickAttachment_1.JoystickAttachment.BUTTON_A);
|
|
26
|
+
expect(joystick.isButtonPressed(JoystickAttachment_1.JoystickAttachment.BUTTON_A)).toBe(true);
|
|
27
|
+
expect(joystick.isButtonPressed(JoystickAttachment_1.JoystickAttachment.BUTTON_B)).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
it('should press a button', () => {
|
|
30
|
+
joystick.pressButton(JoystickAttachment_1.JoystickAttachment.BUTTON_START);
|
|
31
|
+
expect(joystick.getButtonState()).toBe(JoystickAttachment_1.JoystickAttachment.BUTTON_START);
|
|
32
|
+
});
|
|
33
|
+
it('should release a button', () => {
|
|
34
|
+
joystick.updateJoystick(0xFF);
|
|
35
|
+
joystick.releaseButton(JoystickAttachment_1.JoystickAttachment.BUTTON_A);
|
|
36
|
+
expect(joystick.getButtonState()).toBe(0xFF & ~JoystickAttachment_1.JoystickAttachment.BUTTON_A);
|
|
37
|
+
});
|
|
38
|
+
it('should release all buttons', () => {
|
|
39
|
+
joystick.updateJoystick(0xFF);
|
|
40
|
+
joystick.releaseAllButtons();
|
|
41
|
+
expect(joystick.getButtonState()).toBe(0x00);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('port reading - Port A', () => {
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
joystick = new JoystickAttachment_1.JoystickAttachment(true, 0); // Attach to Port A
|
|
47
|
+
});
|
|
48
|
+
it('should return inverted button state on Port A when attached', () => {
|
|
49
|
+
joystick.updateJoystick(0x00); // No buttons pressed
|
|
50
|
+
expect(joystick.readPortA(0x00, 0x00)).toBe(0xFF); // All bits high (active-low)
|
|
51
|
+
});
|
|
52
|
+
it('should return active-low values when buttons pressed', () => {
|
|
53
|
+
joystick.updateJoystick(0xFF); // All buttons pressed
|
|
54
|
+
expect(joystick.readPortA(0x00, 0x00)).toBe(0x00); // All bits low
|
|
55
|
+
});
|
|
56
|
+
it('should return FF on Port B when attached to Port A', () => {
|
|
57
|
+
joystick.updateJoystick(0xFF);
|
|
58
|
+
expect(joystick.readPortB(0x00, 0x00)).toBe(0xFF);
|
|
59
|
+
});
|
|
60
|
+
it('should handle individual button presses correctly', () => {
|
|
61
|
+
joystick.updateJoystick(JoystickAttachment_1.JoystickAttachment.BUTTON_UP);
|
|
62
|
+
const result = joystick.readPortA(0x00, 0x00);
|
|
63
|
+
expect(result & 0x01).toBe(0x00); // UP button bit should be low (pressed)
|
|
64
|
+
expect(result & 0xFE).toBe(0xFE); // Other bits should be high (not pressed)
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe('port reading - Port B', () => {
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
joystick = new JoystickAttachment_1.JoystickAttachment(false, 0); // Attach to Port B
|
|
70
|
+
});
|
|
71
|
+
it('should return inverted button state on Port B when attached', () => {
|
|
72
|
+
joystick.updateJoystick(0x00);
|
|
73
|
+
expect(joystick.readPortB(0x00, 0x00)).toBe(0xFF);
|
|
74
|
+
});
|
|
75
|
+
it('should return active-low values when buttons pressed on Port B', () => {
|
|
76
|
+
joystick.updateJoystick(0xFF);
|
|
77
|
+
expect(joystick.readPortB(0x00, 0x00)).toBe(0x00);
|
|
78
|
+
});
|
|
79
|
+
it('should return FF on Port A when attached to Port B', () => {
|
|
80
|
+
joystick.updateJoystick(0xFF);
|
|
81
|
+
expect(joystick.readPortA(0x00, 0x00)).toBe(0xFF);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
describe('button constants', () => {
|
|
85
|
+
it('should have correct button bit values', () => {
|
|
86
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_UP).toBe(0x01);
|
|
87
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_DOWN).toBe(0x02);
|
|
88
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_LEFT).toBe(0x04);
|
|
89
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_RIGHT).toBe(0x08);
|
|
90
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_A).toBe(0x10);
|
|
91
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_B).toBe(0x20);
|
|
92
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_SELECT).toBe(0x40);
|
|
93
|
+
expect(JoystickAttachment_1.JoystickAttachment.BUTTON_START).toBe(0x80);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
describe('priority and enabled', () => {
|
|
97
|
+
it('should return correct priority', () => {
|
|
98
|
+
const j = new JoystickAttachment_1.JoystickAttachment(true, 5);
|
|
99
|
+
expect(j.getPriority()).toBe(5);
|
|
100
|
+
});
|
|
101
|
+
it('should be enabled by default', () => {
|
|
102
|
+
expect(joystick.isEnabled()).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('interrupts', () => {
|
|
106
|
+
it('should not have any interrupts by default', () => {
|
|
107
|
+
expect(joystick.hasCA1Interrupt()).toBe(false);
|
|
108
|
+
expect(joystick.hasCA2Interrupt()).toBe(false);
|
|
109
|
+
expect(joystick.hasCB1Interrupt()).toBe(false);
|
|
110
|
+
expect(joystick.hasCB2Interrupt()).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
it('should clear interrupts (no-op for joystick)', () => {
|
|
113
|
+
expect(() => {
|
|
114
|
+
joystick.clearInterrupts(true, true, true, true);
|
|
115
|
+
}).not.toThrow();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe('tick', () => {
|
|
119
|
+
it('should not throw on tick', () => {
|
|
120
|
+
expect(() => {
|
|
121
|
+
joystick.tick(1000000);
|
|
122
|
+
}).not.toThrow();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=JoystickAttachment.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoystickAttachment.test.js","sourceRoot":"","sources":["../../../../src/tests/IO/Attachments/JoystickAttachment.test.ts"],"names":[],"mappings":";;AAAA,8FAA0F;AAE1F,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAI,QAA4B,CAAA;IAEhC,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,uCAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;YAC7B,QAAQ,CAAC,KAAK,EAAE,CAAA;YAChB,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAA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