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.
Files changed (141) hide show
  1. package/README.md +139 -32
  2. package/dist/components/IO/ACIA.d.ts +76 -0
  3. package/dist/components/IO/ACIA.js +282 -0
  4. package/dist/components/IO/ACIA.js.map +1 -0
  5. package/dist/components/IO/Attachments/Attachment.d.ts +112 -0
  6. package/dist/components/IO/Attachments/Attachment.js +71 -0
  7. package/dist/components/IO/Attachments/Attachment.js.map +1 -0
  8. package/dist/components/IO/Attachments/JoystickAttachment.d.ts +53 -0
  9. package/dist/components/IO/Attachments/JoystickAttachment.js +90 -0
  10. package/dist/components/IO/Attachments/JoystickAttachment.js.map +1 -0
  11. package/dist/components/IO/Attachments/KeyboardEncoderAttachment.d.ts +63 -0
  12. package/dist/components/IO/Attachments/KeyboardEncoderAttachment.js +489 -0
  13. package/dist/components/IO/Attachments/KeyboardEncoderAttachment.js.map +1 -0
  14. package/dist/components/IO/Attachments/KeyboardMatrixAttachment.d.ts +44 -0
  15. package/dist/components/IO/Attachments/KeyboardMatrixAttachment.js +274 -0
  16. package/dist/components/IO/Attachments/KeyboardMatrixAttachment.js.map +1 -0
  17. package/dist/components/IO/Attachments/KeypadAttachment.d.ts +47 -0
  18. package/dist/components/IO/Attachments/KeypadAttachment.js +141 -0
  19. package/dist/components/IO/Attachments/KeypadAttachment.js.map +1 -0
  20. package/dist/components/IO/Attachments/LCDAttachment.d.ts +110 -0
  21. package/dist/components/IO/Attachments/LCDAttachment.js +716 -0
  22. package/dist/components/IO/Attachments/LCDAttachment.js.map +1 -0
  23. package/dist/components/IO/Attachments/SNESAttachment.d.ts +85 -0
  24. package/dist/components/IO/Attachments/SNESAttachment.js +184 -0
  25. package/dist/components/IO/Attachments/SNESAttachment.js.map +1 -0
  26. package/dist/components/IO/Empty.d.ts +9 -0
  27. package/dist/components/IO/Empty.js +5 -7
  28. package/dist/components/IO/Empty.js.map +1 -1
  29. package/dist/components/IO/GPIOCard.d.ts +5 -5
  30. package/dist/components/IO/GPIOCard.js.map +1 -1
  31. package/dist/components/IO/RAMBank.d.ts +37 -0
  32. package/dist/components/IO/RAMBank.js +63 -0
  33. package/dist/components/IO/RAMBank.js.map +1 -0
  34. package/dist/components/IO/RTC.d.ts +107 -0
  35. package/dist/components/IO/RTC.js +483 -0
  36. package/dist/components/IO/RTC.js.map +1 -0
  37. package/dist/components/IO/Sound.d.ts +120 -0
  38. package/dist/components/IO/Sound.js +622 -0
  39. package/dist/components/IO/Sound.js.map +1 -0
  40. package/dist/components/IO/Storage.d.ts +74 -0
  41. package/dist/components/IO/Storage.js +409 -0
  42. package/dist/components/IO/Storage.js.map +1 -0
  43. package/dist/components/IO/Terminal.d.ts +19 -0
  44. package/dist/components/IO/Terminal.js +33 -0
  45. package/dist/components/IO/Terminal.js.map +1 -0
  46. package/dist/components/IO/VIA.d.ts +105 -0
  47. package/dist/components/IO/VIA.js +597 -0
  48. package/dist/components/IO/VIA.js.map +1 -0
  49. package/dist/components/IO/Video.d.ts +141 -0
  50. package/dist/components/IO/Video.js +630 -0
  51. package/dist/components/IO/Video.js.map +1 -0
  52. package/dist/components/Machine.d.ts +20 -24
  53. package/dist/components/Machine.js +249 -166
  54. package/dist/components/Machine.js.map +1 -1
  55. package/dist/index.js +28 -14
  56. package/dist/index.js.map +1 -1
  57. package/dist/lib.d.ts +16 -16
  58. package/dist/lib.js +32 -32
  59. package/dist/lib.js.map +1 -1
  60. package/dist/tests/IO/ACIA.test.d.ts +1 -0
  61. package/dist/tests/IO/ACIA.test.js +423 -0
  62. package/dist/tests/IO/ACIA.test.js.map +1 -0
  63. package/dist/tests/IO/Attachments/Attachment.test.d.ts +1 -0
  64. package/dist/tests/IO/Attachments/Attachment.test.js +339 -0
  65. package/dist/tests/IO/Attachments/Attachment.test.js.map +1 -0
  66. package/dist/tests/IO/Attachments/JoystickAttachment.test.d.ts +1 -0
  67. package/dist/tests/IO/Attachments/JoystickAttachment.test.js +126 -0
  68. package/dist/tests/IO/Attachments/JoystickAttachment.test.js.map +1 -0
  69. package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.d.ts +1 -0
  70. package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.js +779 -0
  71. package/dist/tests/IO/Attachments/KeyboardEncoderAttachment.test.js.map +1 -0
  72. package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.d.ts +1 -0
  73. package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.js +355 -0
  74. package/dist/tests/IO/Attachments/KeyboardMatrixAttachment.test.js.map +1 -0
  75. package/dist/tests/IO/Attachments/KeypadAttachment.test.d.ts +1 -0
  76. package/dist/tests/IO/Attachments/KeypadAttachment.test.js +323 -0
  77. package/dist/tests/IO/Attachments/KeypadAttachment.test.js.map +1 -0
  78. package/dist/tests/IO/Attachments/LCDAttachment.test.d.ts +1 -0
  79. package/dist/tests/IO/Attachments/LCDAttachment.test.js +627 -0
  80. package/dist/tests/IO/Attachments/LCDAttachment.test.js.map +1 -0
  81. package/dist/tests/IO/Attachments/SNESAttachment.test.d.ts +1 -0
  82. package/dist/tests/IO/Attachments/SNESAttachment.test.js +331 -0
  83. package/dist/tests/IO/Attachments/SNESAttachment.test.js.map +1 -0
  84. package/dist/tests/IO/Empty.test.d.ts +1 -0
  85. package/dist/tests/IO/Empty.test.js +121 -0
  86. package/dist/tests/IO/Empty.test.js.map +1 -0
  87. package/dist/tests/IO/GPIOCard.test.js.map +1 -1
  88. package/dist/tests/IO/RAMBank.test.d.ts +1 -0
  89. package/dist/tests/IO/RAMBank.test.js +229 -0
  90. package/dist/tests/IO/RAMBank.test.js.map +1 -0
  91. package/dist/tests/IO/RTC.test.d.ts +1 -0
  92. package/dist/tests/IO/RTC.test.js +177 -0
  93. package/dist/tests/IO/RTC.test.js.map +1 -0
  94. package/dist/tests/IO/Sound.test.d.ts +1 -0
  95. package/dist/tests/IO/Sound.test.js +528 -0
  96. package/dist/tests/IO/Sound.test.js.map +1 -0
  97. package/dist/tests/IO/Storage.test.d.ts +1 -0
  98. package/dist/tests/IO/Storage.test.js +656 -0
  99. package/dist/tests/IO/Storage.test.js.map +1 -0
  100. package/dist/tests/IO/VIA.test.d.ts +1 -0
  101. package/dist/tests/IO/VIA.test.js +503 -0
  102. package/dist/tests/IO/VIA.test.js.map +1 -0
  103. package/dist/tests/IO/Video.test.d.ts +1 -0
  104. package/dist/tests/IO/Video.test.js +549 -0
  105. package/dist/tests/IO/Video.test.js.map +1 -0
  106. package/dist/tests/Machine.test.js +27 -42
  107. package/dist/tests/Machine.test.js.map +1 -1
  108. package/package.json +1 -1
  109. package/src/components/IO/{SerialCard.ts → ACIA.ts} +2 -2
  110. package/src/components/IO/{GPIOAttachments/GPIOAttachment.ts → Attachments/Attachment.ts} +2 -2
  111. package/src/components/IO/{GPIOAttachments/GPIOJoystickAttachment.ts → Attachments/JoystickAttachment.ts} +3 -3
  112. package/src/components/IO/{GPIOAttachments/GPIOKeyboardEncoderAttachment.ts → Attachments/KeyboardEncoderAttachment.ts} +3 -3
  113. package/src/components/IO/{GPIOAttachments/GPIOKeyboardMatrixAttachment.ts → Attachments/KeyboardMatrixAttachment.ts} +5 -5
  114. package/src/components/IO/{GPIOAttachments/GPIOKeypadAttachment.ts → Attachments/KeypadAttachment.ts} +3 -3
  115. package/src/components/IO/{GPIOAttachments/GPIOLCDAttachment.ts → Attachments/LCDAttachment.ts} +7 -7
  116. package/src/components/IO/{EmptyCard.ts → Empty.ts} +1 -1
  117. package/src/components/IO/{RAMCard.ts → RAMBank.ts} +8 -8
  118. package/src/components/IO/{RTCCard.ts → RTC.ts} +1 -1
  119. package/src/components/IO/{SoundCard.ts → Sound.ts} +2 -2
  120. package/src/components/IO/{StorageCard.ts → Storage.ts} +70 -73
  121. package/src/components/IO/{DevOutputBoard.ts → Terminal.ts} +2 -2
  122. package/src/components/IO/{GPIOCard.ts → VIA.ts} +64 -64
  123. package/src/components/IO/{VideoCard.ts → Video.ts} +1 -1
  124. package/src/components/Machine.ts +276 -176
  125. package/src/index.ts +34 -21
  126. package/src/lib.ts +16 -16
  127. package/src/tests/IO/{SerialCard.test.ts → ACIA.test.ts} +5 -5
  128. package/src/tests/IO/{GPIOAttachments/GPIOAttachment.test.ts → Attachments/Attachment.test.ts} +12 -12
  129. package/src/tests/IO/{GPIOAttachments/GPIOJoystickAttachment.test.ts → Attachments/JoystickAttachment.test.ts} +23 -23
  130. package/src/tests/IO/{GPIOAttachments/GPIOKeyboardEncoderAttachment.test.ts → Attachments/KeyboardEncoderAttachment.test.ts} +4 -4
  131. package/src/tests/IO/{GPIOAttachments/GPIOKeyboardMatrixAttachment.test.ts → Attachments/KeyboardMatrixAttachment.test.ts} +5 -5
  132. package/src/tests/IO/{GPIOAttachments/GPIOKeypadAttachment.test.ts → Attachments/KeypadAttachment.test.ts} +38 -38
  133. package/src/tests/IO/{GPIOAttachments/GPIOLCDAttachment.test.ts → Attachments/LCDAttachment.test.ts} +12 -12
  134. package/src/tests/IO/Empty.test.ts +143 -0
  135. package/src/tests/IO/{RAMCard.test.ts → RAMBank.test.ts} +33 -33
  136. package/src/tests/IO/{RTCCard.test.ts → RTC.test.ts} +6 -6
  137. package/src/tests/IO/{SoundCard.test.ts → Sound.test.ts} +6 -6
  138. package/src/tests/IO/{StorageCard.test.ts → Storage.test.ts} +34 -25
  139. package/src/tests/IO/{GPIOCard.test.ts → VIA.test.ts} +7 -7
  140. package/src/tests/IO/{VideoCard.test.ts → Video.test.ts} +13 -13
  141. package/src/tests/Machine.test.ts +31 -38
package/README.md CHANGED
@@ -4,7 +4,7 @@ A comprehensive, cycle-accurate emulator for the [A.C. Wright 6502](https://gith
4
4
 
5
5
  ## Overview
6
6
 
7
- This emulator provides a complete software implementation of a 65C02-based computer system, designed to run the same code as the hardware implementation. It features full I/O peripheral support, including video, sound, serial communication, storage, and GPIO interfaces.
7
+ This emulator provides a complete software implementation of a 65C02-based computer system, designed to run the same code as the hardware implementation. It features full I/O peripheral support, including video, sound, serial communication, storage, and GPIO interfaces. The emulator supports four different system configurations (targets) to accommodate various use cases from full-featured systems to minimal development boards.
8
8
 
9
9
  ## Features
10
10
 
@@ -26,22 +26,24 @@ This emulator provides a complete software implementation of a 65C02-based compu
26
26
  - Real-time rendering via SDL
27
27
 
28
28
  - **Audio Output**
29
- - MOS 6518 SID Sound card emulation with sample generation
29
+ - MOS 6581 SID Sound card emulation with sample generation
30
30
  - 44.1 kHz audio output
31
31
  - SDL audio integration
32
32
 
33
33
  - **I/O Peripherals**
34
- - **Serial Card**: 6551 UART communication with configurable baud rate, parity, data/stop bits
34
+ - **Serial Card (ACIA)**: 6551 UART communication with configurable baud rate, parity, data/stop bits
35
35
  - **Storage Card**: Compact Flash 8-bit IDE mode persistent storage emulation
36
36
  - **RTC Card**: DS1511Y real-time clock emulation with IRQ/NMI support
37
- - **GPIO Card**: 65C22 VIA (Versatile Interface Adapter) emulation
37
+ - **GPIO Card (VIA)**: 65C22 VIA (Versatile Interface Adapter) emulation
38
38
  - Two 8-bit bidirectional I/O ports
39
39
  - Two 16-bit timers with interrupts
40
40
  - Shift register for serial I/O
41
+ - **Terminal Card**: VTAC fantasy terminal emulation for text-based development
41
42
 
42
43
  - **Input Devices**
43
44
  - Keyboard support (matrix and encoder modes)
44
- - Joystick/gamepad support with button mapping
45
+ - Joystick/gamepad support with button mapping (dual controller support)
46
+ - Keypad support (KIM mode)
45
47
  - SDL input handling
46
48
 
47
49
  - **Development Features**
@@ -58,11 +60,16 @@ Get up and running in seconds:
58
60
  # Install globally
59
61
  npm install -g ac6502
60
62
 
61
- # Run the emulator
63
+ # Run the emulator (default COB target)
62
64
  ac6502
63
65
 
64
66
  # Load a ROM
65
67
  ac6502 --rom /path/to/rom.bin
68
+
69
+ # Run in different system configurations
70
+ ac6502 --target kim --rom /path/to/kim.bin
71
+ ac6502 --target dev --cart /path/to/program.bin
72
+ ac6502 --target vcs --cart /path/to/game.bin
66
73
  ```
67
74
 
68
75
  ## Installation
@@ -88,7 +95,7 @@ npm install -g ac6502
88
95
  npm install
89
96
  ```
90
97
 
91
- ### Build
98
+ #### Build
92
99
 
93
100
  ```bash
94
101
  npm run build
@@ -112,14 +119,17 @@ ac6502 [options]
112
119
 
113
120
  - `-c, --cart <path>` - Load a cartridge ROM file
114
121
  - `-r, --rom <path>` - Load a system ROM file
115
- - `-f, --freq <frequency>` - Set CPU frequency in Hz (default: 2000000)
116
- - `-s, --scale <factor>` - Set display scale factor (default: 2)
122
+ - `-f, --freq <frequency>` - Set CPU frequency in Hz (default: 1000000)
123
+ - `-s, --scale <factor>` - Set display scale factor (default: 1)
124
+ - `-T, --target <target>` - System target: cob, vcs, kim, dev (default: cob)
117
125
  - `-p, --port <device>` - Serial port device path
118
126
  - `-b, --baudrate <rate>` - Serial baud rate (default: 9600)
119
127
  - `-a, --parity <type>` - Serial parity: none, even, odd (default: none)
120
128
  - `-d, --databits <bits>` - Serial data bits: 5, 6, 7, 8 (default: 8)
121
129
  - `-t, --stopbits <bits>` - Serial stop bits: 1, 1.5, 2 (default: 1)
122
130
  - `-S, --storage <path>` - Set storage file path for Compact Flash card persistence
131
+ - `-v, --version` - Output the current emulator version
132
+ - `-h, --help` - Output help / options
123
133
 
124
134
  ### Examples
125
135
 
@@ -135,12 +145,36 @@ Connect to serial hardware:
135
145
  ac6502 --port /dev/ttyUSB0 --baudrate 9600 --rom /path/to/monitor.bin
136
146
  ```
137
147
 
148
+ Run in KIM mode with LCD and keypad:
149
+
150
+ ```bash
151
+ ac6502 --target kim --rom /path/to/kim.bin --scale 2
152
+ ```
153
+
154
+ Run in development mode with terminal:
155
+
156
+ ```bash
157
+ ac6502 --target dev --cart /path/to/program.bin
158
+ ```
159
+
160
+ Set custom CPU frequency and storage:
161
+
162
+ ```bash
163
+ ac6502 --freq 2000000 --storage ./disk.img --cart /path/to/program.bin
164
+ ```
165
+
138
166
  ## Architecture
139
167
 
140
- ### Component Structure
168
+ ### System Targets
169
+
170
+ The emulator supports four different system configurations via the `--target` option:
171
+
172
+ #### COB (Complete On-Board) - Default
173
+
174
+ Full-featured system with all peripherals:
141
175
 
142
176
  ```
143
- Machine
177
+ Machine (COB)
144
178
  ├── CPU (65C02)
145
179
  ├── RAM (System Memory)
146
180
  ├── ROM (System BIOS/Monitor)
@@ -148,21 +182,79 @@ Machine
148
182
  └── I/O Cards (8 slots)
149
183
  ├── IO1: RAM Card (Expansion)
150
184
  ├── IO2: RAM Card (Expansion)
151
- ├── IO3: RTC Card (Real-Time Clock)
185
+ ├── IO3: RTC Card (DS1511Y Real-Time Clock)
152
186
  ├── IO4: Storage Card (Compact Flash 8-bit IDE Mode)
153
- ├── IO5: Serial Card (6551 UART)
154
- ├── IO6: GPIO Card (65C22 VIA)
187
+ ├── IO5: Serial Card (6551 ACIA)
188
+ ├── IO6: VIA Card (65C22 GPIO)
189
+ ├── IO7: Sound Card (6581 SID)
190
+ └── IO8: Video Card (TMS9918)
191
+ ```
192
+
193
+ #### VCS (Video Computer System)
194
+
195
+ Minimal system focused on video and sound:
196
+
197
+ ```
198
+ Machine (VCS)
199
+ ├── CPU (65C02)
200
+ ├── RAM (System Memory)
201
+ ├── ROM (System BIOS/Monitor)
202
+ ├── Cart (Optional Cartridge)
203
+ └── I/O Cards (8 slots)
204
+ ├── IO6: VIA Card (65C22 GPIO)
155
205
  ├── IO7: Sound Card (6581 SID)
156
206
  └── IO8: Video Card (TMS9918)
157
207
  ```
158
208
 
159
- ### GPIO Attachments
209
+ #### KIM (Keyboard Input Monitor)
160
210
 
161
- The GPIO card supports multiple attachment types:
211
+ Single-board computer with LCD and keypad:
162
212
 
213
+ ```
214
+ Machine (KIM)
215
+ ├── CPU (65C02)
216
+ ├── RAM (System Memory)
217
+ ├── ROM (System BIOS/Monitor)
218
+ ├── Cart (Optional Cartridge)
219
+ └── I/O Cards (8 slots)
220
+ ├── IO5: Serial Card (6551 ACIA)
221
+ └── IO8: VIA Card (65C22 GPIO)
222
+ ├── LCD Attachment (HD44780 16×2 character display)
223
+ └── Keypad Attachment (4×6 matrix keypad)
224
+ ```
225
+
226
+ #### DEV (Development)
227
+
228
+ System for software development with terminal interface:
229
+
230
+ ```
231
+ Machine (DEV)
232
+ ├── CPU (65C02)
233
+ ├── RAM (System Memory)
234
+ ├── ROM (System BIOS/Monitor)
235
+ ├── Cart (Optional Cartridge)
236
+ └── I/O Cards (8 slots)
237
+ ├── IO1: RAM Card (Expansion)
238
+ ├── IO2: RAM Card (Expansion)
239
+ ├── IO3: RTC Card (DS1511Y Real-Time Clock)
240
+ ├── IO4: Storage Card (Compact Flash 8-bit IDE Mode)
241
+ ├── IO5: Serial Card (6551 ACIA)
242
+ ├── IO6: VIA Card (65C22 GPIO)
243
+ └── IO8: Terminal Card (VTAC)
244
+ ```
245
+
246
+ ### VIA (GPIO) Attachments
247
+
248
+ The VIA card supports multiple attachment types depending on the target:
249
+
250
+ #### Standard Attachments (COB/DEV/VCS)
163
251
  - **Keyboard Matrix**: PS/2-style keyboard matrix scanning
164
252
  - **Keyboard Encoder**: Parallel keyboard encoder
165
- - **Joystick**: Game controller with 8 buttons and directional input
253
+ - **Joystick A/B**: Game controllers with 8 buttons and directional input
254
+
255
+ #### KIM Attachments
256
+ - **LCD Display**: HD44780-compatible 16×2 character LCD with 5×8 pixel characters
257
+ - **Keypad**: 4×6 matrix keypad with 24-key layout
166
258
 
167
259
  ### Memory Map
168
260
 
@@ -175,26 +267,31 @@ The system uses a standard 6502 memory layout with I/O cards mapped into the add
175
267
  ```
176
268
  src/
177
269
  ├── index.ts # Main entry point and emulator loop
270
+ ├── lib.ts # Library exports
178
271
  ├── components/
179
272
  │ ├── CPU.ts # 65C02 CPU implementation
180
- │ ├── Machine.ts # System integration
273
+ │ ├── Machine.ts # System integration and target configuration
181
274
  │ ├── RAM.ts # RAM module
182
275
  │ ├── ROM.ts # ROM module
183
276
  │ ├── Cart.ts # Cartridge support
184
277
  │ ├── IO.ts # I/O interface
185
278
  │ └── IO/ # I/O peripheral implementations
186
- │ ├── GPIOCard.ts
187
- │ ├── RAMCard.ts
188
- │ ├── RTCCard.ts
189
- │ ├── SerialCard.ts
190
- │ ├── SoundCard.ts
191
- │ ├── StorageCard.ts
192
- │ ├── VideoCard.ts
193
- └── GPIOAttachments/
194
- ├── GPIOAttachment.ts
195
- ├── GPIOJoystickAttachment.ts
196
- │ ├── GPIOKeyboardEncoderAttachment.ts
197
- └── GPIOKeyboardMatrixAttachment.ts
279
+ │ ├── ACIA.ts # 6551 Serial card
280
+ │ ├── VIA.ts # 65C22 GPIO card
281
+ │ ├── RAMBank.ts # RAM expansion card
282
+ │ ├── RTC.ts # Real-time clock card
283
+ │ ├── Sound.ts # 6581 SID sound card
284
+ │ ├── Storage.ts # Compact Flash storage card
285
+ │ ├── Video.ts # TMS9918 video card
286
+ ├── Terminal.ts # VTAC terminal card
287
+ ├── Empty.ts # Empty slot placeholder
288
+ └── Attachments/
289
+ │ ├── Attachment.ts
290
+ ├── JoystickAttachment.ts
291
+ │ ├── KeyboardEncoderAttachment.ts
292
+ │ ├── KeyboardMatrixAttachment.ts
293
+ │ ├── KeypadAttachment.ts
294
+ │ └── LCDAttachment.ts
198
295
  └── tests/ # Comprehensive test suite
199
296
  ```
200
297
 
@@ -220,7 +317,7 @@ npm run test:coverage
220
317
 
221
318
  ### Release Build
222
319
 
223
- ```
320
+ ```bash
224
321
  git tag vX.Y.Z
225
322
  git push origin main --tags
226
323
  npm publish
@@ -234,15 +331,25 @@ npm publish
234
331
  - **Graphics**: SDL via @kmamal/sdl
235
332
  - **Serial**: SerialPort library
236
333
  - **CLI**: Commander.js
334
+ - **Terminal**: VTAC Terminal library
237
335
 
238
336
  ## Performance
239
337
 
240
- The emulator targets 2 MHz operation by default (configurable) and attempts to maintain accurate timing by synchronizing with real-time clock cycles. The frame rate is capped at 60 FPS for video output.
338
+ The emulator targets 1 MHz operation by default (configurable) and attempts to maintain accurate timing by synchronizing with real-time clock cycles. The frame rate is capped at 60 FPS for video output.
339
+
340
+ ## Supported Input Devices
341
+
342
+ - **Keyboard**: Full keyboard support via SDL for all targets
343
+ - **Game Controllers**: Dual controller support (Player A and Player B) for VCS and COB targets
344
+ - D-pad and analog stick support
345
+ - 8 buttons: Up, Down, Left, Right, A, B, Select, Start
346
+ - **Keypad**: 4×6 matrix keypad for KIM target (24 keys including arrows, numbers, and function keys)
241
347
 
242
348
  ## Credits
243
349
 
244
350
  - CPU implementation adapted from [OneLoneCoder's olcNES](https://github.com/OneLoneCoder/olcNES)
245
351
  - TMS9918 implementation based on [vrEmuTms9918](https://github.com/visrealm/vrEmuTms9918) by Troy Schrapel
352
+ - LCD implementation based on [vrEmuLcd](https://github.com/visrealm/vrEmuLcd) by Troy Schrapel
246
353
 
247
354
  ## License
248
355
 
@@ -0,0 +1,76 @@
1
+ import { IO } from '../IO';
2
+ /**
3
+ * ACIA - Emulates a 6551 ACIA (Asynchronous Communications Interface Adapter)
4
+ *
5
+ * Register Map:
6
+ * $00: Data Register (read/write)
7
+ * $01: Status Register (read) / Programmed Reset (write)
8
+ * $02: Command Register (write)
9
+ * $03: Control Register (write)
10
+ */
11
+ export declare class ACIA implements IO {
12
+ raiseIRQ: () => void;
13
+ raiseNMI: () => void;
14
+ transmit?: (data: number) => void;
15
+ private dataRegister;
16
+ private statusRegister;
17
+ private commandRegister;
18
+ private controlRegister;
19
+ private transmitBuffer;
20
+ private receiveBuffer;
21
+ private parityError;
22
+ private framingError;
23
+ private overrun;
24
+ private irqFlag;
25
+ private echoMode;
26
+ private cycleCounter;
27
+ private baudRate;
28
+ /**
29
+ * Read from ACIA register
30
+ */
31
+ read(address: number): number;
32
+ /**
33
+ * Write to ACIA register
34
+ */
35
+ write(address: number, data: number): void;
36
+ /**
37
+ * Read data from receive buffer
38
+ */
39
+ private readData;
40
+ /**
41
+ * Write data to transmit buffer
42
+ */
43
+ private writeData;
44
+ /**
45
+ * Read status register
46
+ */
47
+ private readStatus;
48
+ /**
49
+ * Write to command register
50
+ */
51
+ private writeCommand;
52
+ /**
53
+ * Write to control register
54
+ */
55
+ private writeControl;
56
+ /**
57
+ * Get baud rate from control register code
58
+ */
59
+ private getBaudRate;
60
+ /**
61
+ * Programmed reset
62
+ */
63
+ private programmedReset;
64
+ /**
65
+ * Tick - emulate ACIA timing
66
+ */
67
+ tick(frequency: number): void;
68
+ /**
69
+ * Reset the ACIA
70
+ */
71
+ reset(coldStart: boolean): void;
72
+ /**
73
+ * Receive data from external source
74
+ */
75
+ onData(data: number): void;
76
+ }
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACIA = void 0;
4
+ /**
5
+ * ACIA - Emulates a 6551 ACIA (Asynchronous Communications Interface Adapter)
6
+ *
7
+ * Register Map:
8
+ * $00: Data Register (read/write)
9
+ * $01: Status Register (read) / Programmed Reset (write)
10
+ * $02: Command Register (write)
11
+ * $03: Control Register (write)
12
+ */
13
+ class ACIA {
14
+ constructor() {
15
+ this.raiseIRQ = () => { };
16
+ this.raiseNMI = () => { };
17
+ // Registers
18
+ this.dataRegister = 0;
19
+ this.statusRegister = 0x10; // Transmit Data Register Empty
20
+ this.commandRegister = 0;
21
+ this.controlRegister = 0;
22
+ // Buffers
23
+ this.transmitBuffer = [];
24
+ this.receiveBuffer = [];
25
+ // Status flags
26
+ this.parityError = false;
27
+ this.framingError = false;
28
+ this.overrun = false;
29
+ this.irqFlag = false;
30
+ this.echoMode = false;
31
+ // Timing
32
+ this.cycleCounter = 0;
33
+ this.baudRate = 115200;
34
+ }
35
+ /**
36
+ * Read from ACIA register
37
+ */
38
+ read(address) {
39
+ const register = address & 0x03;
40
+ switch (register) {
41
+ case 0x00: // Data Register
42
+ return this.readData();
43
+ case 0x01: // Status Register
44
+ return this.readStatus();
45
+ case 0x02: // Command Register
46
+ return this.commandRegister;
47
+ case 0x03: // Control Register
48
+ return this.controlRegister;
49
+ default:
50
+ return 0;
51
+ }
52
+ }
53
+ /**
54
+ * Write to ACIA register
55
+ */
56
+ write(address, data) {
57
+ const register = address & 0x03;
58
+ switch (register) {
59
+ case 0x00: // Data Register
60
+ this.writeData(data);
61
+ break;
62
+ case 0x01: // Programmed Reset
63
+ this.programmedReset();
64
+ break;
65
+ case 0x02: // Command Register
66
+ this.writeCommand(data);
67
+ break;
68
+ case 0x03: // Control Register
69
+ this.writeControl(data);
70
+ break;
71
+ }
72
+ }
73
+ /**
74
+ * Read data from receive buffer
75
+ */
76
+ readData() {
77
+ if (this.receiveBuffer.length > 0) {
78
+ const data = this.receiveBuffer.shift();
79
+ this.dataRegister = data;
80
+ // Update status: clear Receive Data Register Full
81
+ this.statusRegister &= ~0x08;
82
+ // Check for overrun if more data arrives
83
+ if (this.receiveBuffer.length === 0) {
84
+ this.overrun = false;
85
+ this.statusRegister &= ~0x04;
86
+ }
87
+ // Clear IRQ if receive IRQ was enabled
88
+ if ((this.commandRegister & 0x04) && this.receiveBuffer.length === 0) {
89
+ this.irqFlag = false;
90
+ this.statusRegister &= ~0x80;
91
+ }
92
+ return data;
93
+ }
94
+ return this.dataRegister;
95
+ }
96
+ /**
97
+ * Write data to transmit buffer
98
+ */
99
+ writeData(data) {
100
+ this.transmitBuffer.push(data & 0xFF);
101
+ // Clear Transmit Data Register Empty flag
102
+ this.statusRegister &= ~0x10;
103
+ }
104
+ /**
105
+ * Read status register
106
+ */
107
+ readStatus() {
108
+ let status = 0;
109
+ // Bit 0: Parity Error
110
+ if (this.parityError)
111
+ status |= 0x01;
112
+ // Bit 1: Framing Error
113
+ if (this.framingError)
114
+ status |= 0x02;
115
+ // Bit 2: Overrun
116
+ if (this.overrun)
117
+ status |= 0x04;
118
+ // Bit 3: Receive Data Register Full
119
+ if (this.receiveBuffer.length > 0)
120
+ status |= 0x08;
121
+ // Bit 4: Transmit Data Register Empty
122
+ if (this.transmitBuffer.length === 0)
123
+ status |= 0x10;
124
+ // Bit 5: Data Carrier Detect (DCD) - always clear (connected)
125
+ status &= ~0x20;
126
+ // Bit 6: Data Set Ready (DSR) - always set (ready)
127
+ status |= 0x40;
128
+ // Bit 7: Interrupt (IRQ)
129
+ if (this.irqFlag)
130
+ status |= 0x80;
131
+ this.statusRegister = status;
132
+ return status;
133
+ }
134
+ /**
135
+ * Write to command register
136
+ */
137
+ writeCommand(data) {
138
+ this.commandRegister = data & 0xFF;
139
+ // Bits 0-1: DTR control
140
+ // const dtrControl = data & 0x03
141
+ // Bit 2: Receive IRQ Enable
142
+ const receiveIRQEnabled = (data & 0x04) !== 0;
143
+ // Bits 3-4: Transmit control and IRQ enable
144
+ // const transmitControl = (data >> 3) & 0x03
145
+ // Bit 5: Echo mode
146
+ this.echoMode = (data & 0x20) !== 0;
147
+ // Bits 6-7: Parity control
148
+ // const parityControl = (data >> 6) & 0x03
149
+ // Handle receive IRQ
150
+ if (receiveIRQEnabled && this.receiveBuffer.length > 0) {
151
+ this.irqFlag = true;
152
+ this.statusRegister |= 0x80;
153
+ this.raiseIRQ();
154
+ }
155
+ else if (!receiveIRQEnabled) {
156
+ this.irqFlag = false;
157
+ this.statusRegister &= ~0x80;
158
+ }
159
+ }
160
+ /**
161
+ * Write to control register
162
+ */
163
+ writeControl(data) {
164
+ this.controlRegister = data & 0xFF;
165
+ // Bits 0-3: Baud rate
166
+ const baudRateCode = data & 0x0F;
167
+ this.baudRate = this.getBaudRate(baudRateCode);
168
+ // Bit 4: Receiver clock source (internal/external)
169
+ const receiverClockSource = (data & 0x10) !== 0;
170
+ // Bits 5-6: Word length (5, 6, 7, or 8 bits)
171
+ const wordLength = ((data >> 5) & 0x03) + 5;
172
+ // Bit 7: Stop bits (1 or 2)
173
+ const stopBits = (data & 0x80) ? 2 : 1;
174
+ }
175
+ /**
176
+ * Get baud rate from control register code
177
+ */
178
+ getBaudRate(code) {
179
+ const baudRates = [
180
+ 115200, // 0000 (actually 16x external clock, using 115200 as default)
181
+ 50, // 0001
182
+ 75, // 0010
183
+ 110, // 0011
184
+ 135, // 0100
185
+ 150, // 0101
186
+ 300, // 0110
187
+ 600, // 0111
188
+ 1200, // 1000
189
+ 1800, // 1001
190
+ 2400, // 1010
191
+ 3600, // 1011
192
+ 4800, // 1100
193
+ 7200, // 1101
194
+ 9600, // 1110
195
+ 19200 // 1111
196
+ ];
197
+ return baudRates[code] || 115200;
198
+ }
199
+ /**
200
+ * Programmed reset
201
+ */
202
+ programmedReset() {
203
+ this.statusRegister = 0x10; // Transmit Data Register Empty
204
+ this.parityError = false;
205
+ this.framingError = false;
206
+ this.overrun = false;
207
+ this.irqFlag = false;
208
+ }
209
+ /**
210
+ * Tick - emulate ACIA timing
211
+ */
212
+ tick(frequency) {
213
+ this.cycleCounter++;
214
+ // Calculate cycles per byte: (CPU_CLOCK / baud_rate) * bits_per_frame
215
+ // Assuming 10 bits per frame (1 start + 8 data + 1 stop)
216
+ const cyclesPerByte = Math.floor((frequency / this.baudRate) * 10);
217
+ // Simulate transmission based on actual baud rate
218
+ if (this.cycleCounter >= cyclesPerByte && this.transmitBuffer.length > 0) {
219
+ this.cycleCounter = 0;
220
+ // Transmit one byte
221
+ const byte = this.transmitBuffer.shift();
222
+ if (byte !== undefined && this.transmit) {
223
+ this.transmit(byte);
224
+ }
225
+ // Set Transmit Data Register Empty if buffer is empty
226
+ if (this.transmitBuffer.length === 0) {
227
+ this.statusRegister |= 0x10;
228
+ // Trigger transmit complete IRQ if enabled
229
+ if ((this.commandRegister & 0x18) === 0x08) {
230
+ this.irqFlag = true;
231
+ this.statusRegister |= 0x80;
232
+ this.raiseIRQ();
233
+ }
234
+ }
235
+ }
236
+ }
237
+ /**
238
+ * Reset the ACIA
239
+ */
240
+ reset(coldStart) {
241
+ this.dataRegister = 0;
242
+ this.statusRegister = 0x10; // Transmit Data Register Empty
243
+ this.commandRegister = 0;
244
+ this.controlRegister = 0;
245
+ this.transmitBuffer = [];
246
+ this.receiveBuffer = [];
247
+ this.parityError = false;
248
+ this.framingError = false;
249
+ this.overrun = false;
250
+ this.irqFlag = false;
251
+ this.echoMode = false;
252
+ this.cycleCounter = 0;
253
+ this.baudRate = 115200;
254
+ }
255
+ /**
256
+ * Receive data from external source
257
+ */
258
+ onData(data) {
259
+ if (this.receiveBuffer.length > 0 && (this.statusRegister & 0x08)) {
260
+ // Overrun condition: data arrives before previous data was read
261
+ this.overrun = true;
262
+ this.statusRegister |= 0x04;
263
+ }
264
+ this.receiveBuffer.push(data & 0xFF);
265
+ // Set Receive Data Register Full flag
266
+ this.statusRegister |= 0x08;
267
+ // Trigger receive IRQ if enabled
268
+ if (this.commandRegister & 0x04) {
269
+ this.irqFlag = true;
270
+ this.statusRegister |= 0x80;
271
+ this.raiseIRQ();
272
+ }
273
+ // Echo mode: automatically transmit received data
274
+ if (this.echoMode) {
275
+ this.transmitBuffer.push(data & 0xFF);
276
+ // Clear Transmit Data Register Empty flag
277
+ this.statusRegister &= ~0x10;
278
+ }
279
+ }
280
+ }
281
+ exports.ACIA = ACIA;
282
+ //# sourceMappingURL=ACIA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ACIA.js","sourceRoot":"","sources":["../../../src/components/IO/ACIA.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,MAAa,IAAI;IAAjB;QAEE,aAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QACnB,aAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QAGnB,YAAY;QACJ,iBAAY,GAAW,CAAC,CAAA;QACxB,mBAAc,GAAW,IAAI,CAAA,CAAE,+BAA+B;QAC9D,oBAAe,GAAW,CAAC,CAAA;QAC3B,oBAAe,GAAW,CAAC,CAAA;QAEnC,UAAU;QACF,mBAAc,GAAa,EAAE,CAAA;QAC7B,kBAAa,GAAa,EAAE,CAAA;QAEpC,eAAe;QACP,gBAAW,GAAY,KAAK,CAAA;QAC5B,iBAAY,GAAY,KAAK,CAAA;QAC7B,YAAO,GAAY,KAAK,CAAA;QACxB,YAAO,GAAY,KAAK,CAAA;QACxB,aAAQ,GAAY,KAAK,CAAA;QAEjC,SAAS;QACD,iBA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