web-a2e 1.0.0

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 (295) hide show
  1. package/.clangd +5 -0
  2. package/.mcp.json +12 -0
  3. package/CLAUDE.md +362 -0
  4. package/CMakeLists.txt +774 -0
  5. package/LICENSE +21 -0
  6. package/README.md +392 -0
  7. package/build-wasm/generated/roms.cpp +2447 -0
  8. package/docker-compose.staging.yml +9 -0
  9. package/docs/basic-rom-disassembly.md +6663 -0
  10. package/docs/softswitch-comparison.md +273 -0
  11. package/docs/thunderclock-debug.md +89 -0
  12. package/examples/cube.bas +72 -0
  13. package/examples/hello.s +55 -0
  14. package/examples/scroll.s +140 -0
  15. package/package.json +18 -0
  16. package/public/assets/apple-logo-old.png +0 -0
  17. package/public/assets/apple-logo.png +0 -0
  18. package/public/assets/drive-closed-light-on.png +0 -0
  19. package/public/assets/drive-closed.png +0 -0
  20. package/public/assets/drive-open-light-on.png +0 -0
  21. package/public/assets/drive-open.png +0 -0
  22. package/public/audio-worklet.js +82 -0
  23. package/public/disks/Apple DOS 3.3 January 1983.dsk +0 -0
  24. package/public/disks/ProDOS 2.4.3.po +0 -0
  25. package/public/disks/h32mb.2mg +0 -0
  26. package/public/disks/library.json +26 -0
  27. package/public/docs/llms/llm-assembler.txt +90 -0
  28. package/public/docs/llms/llm-basic-program.txt +256 -0
  29. package/public/docs/llms/llm-disk-drives.txt +72 -0
  30. package/public/docs/llms/llm-file-explorer.txt +50 -0
  31. package/public/docs/llms/llm-hard-drives.txt +80 -0
  32. package/public/docs/llms/llm-main.txt +51 -0
  33. package/public/docs/llms/llm-slot-configuration.txt +66 -0
  34. package/public/icons/icon-192.svg +4 -0
  35. package/public/icons/icon-512.svg +4 -0
  36. package/public/index.html +661 -0
  37. package/public/llms.txt +49 -0
  38. package/public/manifest.json +29 -0
  39. package/public/shaders/burnin.glsl +22 -0
  40. package/public/shaders/crt.glsl +706 -0
  41. package/public/shaders/edge.glsl +109 -0
  42. package/public/shaders/vertex.glsl +8 -0
  43. package/public/sw.js +186 -0
  44. package/roms/341-0027.bin +0 -0
  45. package/roms/341-0160-A-US-UK.bin +0 -0
  46. package/roms/341-0160-A.bin +0 -0
  47. package/roms/342-0273-A-US-UK.bin +0 -0
  48. package/roms/342-0349-B-C0-FF.bin +0 -0
  49. package/roms/Apple Mouse Interface Card ROM - 342-0270-C.bin +0 -0
  50. package/roms/Thunderclock Plus ROM.bin +0 -0
  51. package/scripts/generate_roms.sh +69 -0
  52. package/src/bindings/wasm_interface.cpp +1940 -0
  53. package/src/core/assembler/assembler.cpp +1239 -0
  54. package/src/core/assembler/assembler.hpp +115 -0
  55. package/src/core/audio/audio.cpp +160 -0
  56. package/src/core/audio/audio.hpp +81 -0
  57. package/src/core/basic/basic_detokenizer.cpp +436 -0
  58. package/src/core/basic/basic_detokenizer.hpp +41 -0
  59. package/src/core/basic/basic_tokenizer.cpp +286 -0
  60. package/src/core/basic/basic_tokenizer.hpp +26 -0
  61. package/src/core/basic/basic_tokens.hpp +295 -0
  62. package/src/core/cards/disk2_card.cpp +568 -0
  63. package/src/core/cards/disk2_card.hpp +316 -0
  64. package/src/core/cards/expansion_card.hpp +185 -0
  65. package/src/core/cards/mockingboard/ay8910.cpp +616 -0
  66. package/src/core/cards/mockingboard/ay8910.hpp +159 -0
  67. package/src/core/cards/mockingboard/via6522.cpp +530 -0
  68. package/src/core/cards/mockingboard/via6522.hpp +163 -0
  69. package/src/core/cards/mockingboard_card.cpp +312 -0
  70. package/src/core/cards/mockingboard_card.hpp +159 -0
  71. package/src/core/cards/mouse_card.cpp +654 -0
  72. package/src/core/cards/mouse_card.hpp +190 -0
  73. package/src/core/cards/smartport/block_device.cpp +202 -0
  74. package/src/core/cards/smartport/block_device.hpp +60 -0
  75. package/src/core/cards/smartport/smartport_card.cpp +603 -0
  76. package/src/core/cards/smartport/smartport_card.hpp +120 -0
  77. package/src/core/cards/thunderclock_card.cpp +237 -0
  78. package/src/core/cards/thunderclock_card.hpp +122 -0
  79. package/src/core/cpu/cpu6502.cpp +1609 -0
  80. package/src/core/cpu/cpu6502.hpp +203 -0
  81. package/src/core/debug/condition_evaluator.cpp +470 -0
  82. package/src/core/debug/condition_evaluator.hpp +87 -0
  83. package/src/core/disassembler/disassembler.cpp +552 -0
  84. package/src/core/disassembler/disassembler.hpp +171 -0
  85. package/src/core/disk-image/disk_image.hpp +267 -0
  86. package/src/core/disk-image/dsk_disk_image.cpp +827 -0
  87. package/src/core/disk-image/dsk_disk_image.hpp +204 -0
  88. package/src/core/disk-image/gcr_encoding.cpp +147 -0
  89. package/src/core/disk-image/gcr_encoding.hpp +78 -0
  90. package/src/core/disk-image/woz_disk_image.cpp +1049 -0
  91. package/src/core/disk-image/woz_disk_image.hpp +343 -0
  92. package/src/core/emulator.cpp +2126 -0
  93. package/src/core/emulator.hpp +434 -0
  94. package/src/core/filesystem/dos33.cpp +178 -0
  95. package/src/core/filesystem/dos33.hpp +66 -0
  96. package/src/core/filesystem/pascal.cpp +262 -0
  97. package/src/core/filesystem/pascal.hpp +87 -0
  98. package/src/core/filesystem/prodos.cpp +369 -0
  99. package/src/core/filesystem/prodos.hpp +119 -0
  100. package/src/core/input/keyboard.cpp +227 -0
  101. package/src/core/input/keyboard.hpp +111 -0
  102. package/src/core/mmu/mmu.cpp +1387 -0
  103. package/src/core/mmu/mmu.hpp +236 -0
  104. package/src/core/types.hpp +196 -0
  105. package/src/core/video/video.cpp +680 -0
  106. package/src/core/video/video.hpp +156 -0
  107. package/src/css/assembler-editor.css +1617 -0
  108. package/src/css/base.css +470 -0
  109. package/src/css/basic-debugger.css +791 -0
  110. package/src/css/basic-editor.css +792 -0
  111. package/src/css/controls.css +783 -0
  112. package/src/css/cpu-debugger.css +1413 -0
  113. package/src/css/debug-base.css +160 -0
  114. package/src/css/debug-windows.css +6455 -0
  115. package/src/css/disk-drives.css +406 -0
  116. package/src/css/documentation.css +392 -0
  117. package/src/css/file-explorer.css +867 -0
  118. package/src/css/hard-drive.css +180 -0
  119. package/src/css/layout.css +217 -0
  120. package/src/css/memory-windows.css +798 -0
  121. package/src/css/modals.css +510 -0
  122. package/src/css/monitor.css +425 -0
  123. package/src/css/release-notes.css +101 -0
  124. package/src/css/responsive.css +400 -0
  125. package/src/css/rule-builder.css +340 -0
  126. package/src/css/save-states.css +201 -0
  127. package/src/css/settings-windows.css +1231 -0
  128. package/src/css/window-switcher.css +150 -0
  129. package/src/js/agent/agent-manager.js +643 -0
  130. package/src/js/agent/agent-tools.js +293 -0
  131. package/src/js/agent/agent-version-tools.js +131 -0
  132. package/src/js/agent/assembler-tools.js +357 -0
  133. package/src/js/agent/basic-program-tools.js +894 -0
  134. package/src/js/agent/disk-tools.js +417 -0
  135. package/src/js/agent/file-explorer-tools.js +269 -0
  136. package/src/js/agent/index.js +13 -0
  137. package/src/js/agent/main-tools.js +222 -0
  138. package/src/js/agent/slot-tools.js +303 -0
  139. package/src/js/agent/smartport-tools.js +257 -0
  140. package/src/js/agent/window-tools.js +80 -0
  141. package/src/js/audio/audio-driver.js +417 -0
  142. package/src/js/audio/audio-worklet.js +85 -0
  143. package/src/js/audio/index.js +8 -0
  144. package/src/js/config/default-layout.js +34 -0
  145. package/src/js/config/version.js +8 -0
  146. package/src/js/data/apple2-rom-routines.js +577 -0
  147. package/src/js/debug/assembler-editor-window.js +2993 -0
  148. package/src/js/debug/basic-breakpoint-manager.js +529 -0
  149. package/src/js/debug/basic-program-parser.js +436 -0
  150. package/src/js/debug/basic-program-window.js +2594 -0
  151. package/src/js/debug/basic-variable-inspector.js +447 -0
  152. package/src/js/debug/breakpoint-manager.js +472 -0
  153. package/src/js/debug/cpu-debugger-window.js +2396 -0
  154. package/src/js/debug/index.js +22 -0
  155. package/src/js/debug/label-manager.js +238 -0
  156. package/src/js/debug/memory-browser-window.js +416 -0
  157. package/src/js/debug/memory-heat-map-window.js +481 -0
  158. package/src/js/debug/memory-map-window.js +206 -0
  159. package/src/js/debug/mockingboard-window.js +882 -0
  160. package/src/js/debug/mouse-card-window.js +355 -0
  161. package/src/js/debug/rule-builder-window.js +648 -0
  162. package/src/js/debug/soft-switch-window.js +458 -0
  163. package/src/js/debug/stack-viewer-window.js +221 -0
  164. package/src/js/debug/symbols.js +416 -0
  165. package/src/js/debug/trace-panel.js +291 -0
  166. package/src/js/debug/zero-page-watch-window.js +297 -0
  167. package/src/js/disk-manager/disk-drives-window.js +212 -0
  168. package/src/js/disk-manager/disk-operations.js +284 -0
  169. package/src/js/disk-manager/disk-persistence.js +301 -0
  170. package/src/js/disk-manager/disk-surface-renderer.js +388 -0
  171. package/src/js/disk-manager/drive-sounds.js +139 -0
  172. package/src/js/disk-manager/hard-drive-manager.js +481 -0
  173. package/src/js/disk-manager/hard-drive-persistence.js +187 -0
  174. package/src/js/disk-manager/hard-drive-window.js +57 -0
  175. package/src/js/disk-manager/index.js +890 -0
  176. package/src/js/display/display-settings-window.js +383 -0
  177. package/src/js/display/index.js +10 -0
  178. package/src/js/display/screen-window.js +342 -0
  179. package/src/js/display/webgl-renderer.js +705 -0
  180. package/src/js/file-explorer/disassembler.js +574 -0
  181. package/src/js/file-explorer/dos33.js +266 -0
  182. package/src/js/file-explorer/file-viewer.js +359 -0
  183. package/src/js/file-explorer/index.js +1261 -0
  184. package/src/js/file-explorer/prodos.js +549 -0
  185. package/src/js/file-explorer/utils.js +67 -0
  186. package/src/js/help/documentation-window.js +1096 -0
  187. package/src/js/help/index.js +10 -0
  188. package/src/js/help/release-notes-window.js +85 -0
  189. package/src/js/help/release-notes.js +612 -0
  190. package/src/js/input/gamepad-handler.js +176 -0
  191. package/src/js/input/index.js +12 -0
  192. package/src/js/input/input-handler.js +396 -0
  193. package/src/js/input/joystick-window.js +404 -0
  194. package/src/js/input/mouse-handler.js +99 -0
  195. package/src/js/input/text-selection.js +462 -0
  196. package/src/js/main.js +653 -0
  197. package/src/js/state/index.js +15 -0
  198. package/src/js/state/save-states-window.js +393 -0
  199. package/src/js/state/state-manager.js +409 -0
  200. package/src/js/state/state-persistence.js +218 -0
  201. package/src/js/ui/confirm.js +43 -0
  202. package/src/js/ui/disk-drive-positioner.js +347 -0
  203. package/src/js/ui/reminder-controller.js +129 -0
  204. package/src/js/ui/slot-configuration-window.js +560 -0
  205. package/src/js/ui/theme-manager.js +61 -0
  206. package/src/js/ui/toast.js +44 -0
  207. package/src/js/ui/ui-controller.js +897 -0
  208. package/src/js/ui/window-switcher.js +275 -0
  209. package/src/js/utils/basic-autocomplete.js +832 -0
  210. package/src/js/utils/basic-highlighting.js +473 -0
  211. package/src/js/utils/basic-tokenizer.js +153 -0
  212. package/src/js/utils/basic-tokens.js +117 -0
  213. package/src/js/utils/constants.js +28 -0
  214. package/src/js/utils/indexeddb-helper.js +225 -0
  215. package/src/js/utils/merlin-editor-support.js +905 -0
  216. package/src/js/utils/merlin-highlighting.js +551 -0
  217. package/src/js/utils/storage.js +125 -0
  218. package/src/js/utils/string-utils.js +19 -0
  219. package/src/js/utils/wasm-memory.js +54 -0
  220. package/src/js/windows/base-window.js +690 -0
  221. package/src/js/windows/index.js +9 -0
  222. package/src/js/windows/window-manager.js +375 -0
  223. package/tests/catch2/catch.hpp +17976 -0
  224. package/tests/common/basic_program_builder.cpp +119 -0
  225. package/tests/common/basic_program_builder.hpp +209 -0
  226. package/tests/common/disk_image_builder.cpp +444 -0
  227. package/tests/common/disk_image_builder.hpp +141 -0
  228. package/tests/common/test_helpers.hpp +118 -0
  229. package/tests/gcr/gcr-test.cpp +142 -0
  230. package/tests/integration/check-rom.js +70 -0
  231. package/tests/integration/compare-boot.js +239 -0
  232. package/tests/integration/crash-trace.js +102 -0
  233. package/tests/integration/disk-boot-test.js +264 -0
  234. package/tests/integration/memory-crash.js +108 -0
  235. package/tests/integration/nibble-read-test.js +249 -0
  236. package/tests/integration/phase-test.js +159 -0
  237. package/tests/integration/test_emulator.cpp +291 -0
  238. package/tests/integration/test_emulator_basic.cpp +91 -0
  239. package/tests/integration/test_emulator_debug.cpp +344 -0
  240. package/tests/integration/test_emulator_disk.cpp +153 -0
  241. package/tests/integration/test_emulator_state.cpp +163 -0
  242. package/tests/klaus/6502_functional_test.bin +0 -0
  243. package/tests/klaus/65C02_extended_opcodes_test.bin +0 -0
  244. package/tests/klaus/klaus_6502_test.cpp +184 -0
  245. package/tests/klaus/klaus_65c02_test.cpp +197 -0
  246. package/tests/thunderclock/thunderclock_mmu_test.cpp +304 -0
  247. package/tests/thunderclock/thunderclock_test.cpp +550 -0
  248. package/tests/unit/test_assembler.cpp +521 -0
  249. package/tests/unit/test_audio.cpp +196 -0
  250. package/tests/unit/test_ay8910.cpp +311 -0
  251. package/tests/unit/test_basic_detokenizer.cpp +265 -0
  252. package/tests/unit/test_basic_tokenizer.cpp +382 -0
  253. package/tests/unit/test_block_device.cpp +259 -0
  254. package/tests/unit/test_condition_evaluator.cpp +219 -0
  255. package/tests/unit/test_cpu6502.cpp +1301 -0
  256. package/tests/unit/test_cpu_addressing.cpp +361 -0
  257. package/tests/unit/test_cpu_cycle_counts.cpp +409 -0
  258. package/tests/unit/test_cpu_decimal.cpp +166 -0
  259. package/tests/unit/test_cpu_interrupts.cpp +285 -0
  260. package/tests/unit/test_disassembler.cpp +323 -0
  261. package/tests/unit/test_disk2_card.cpp +330 -0
  262. package/tests/unit/test_dos33.cpp +273 -0
  263. package/tests/unit/test_dsk_disk_image.cpp +315 -0
  264. package/tests/unit/test_expansion_card.cpp +178 -0
  265. package/tests/unit/test_gcr_encoding.cpp +232 -0
  266. package/tests/unit/test_keyboard.cpp +262 -0
  267. package/tests/unit/test_mmu.cpp +555 -0
  268. package/tests/unit/test_mmu_slots.cpp +323 -0
  269. package/tests/unit/test_mockingboard.cpp +352 -0
  270. package/tests/unit/test_mouse_card.cpp +386 -0
  271. package/tests/unit/test_pascal.cpp +248 -0
  272. package/tests/unit/test_prodos.cpp +259 -0
  273. package/tests/unit/test_smartport_card.cpp +321 -0
  274. package/tests/unit/test_thunderclock.cpp +354 -0
  275. package/tests/unit/test_via6522.cpp +323 -0
  276. package/tests/unit/test_video.cpp +319 -0
  277. package/tests/unit/test_woz_disk_image.cpp +257 -0
  278. package/vite.config.js +96 -0
  279. package/wiki/AI-Agent.md +372 -0
  280. package/wiki/Architecture-Overview.md +303 -0
  281. package/wiki/Audio-System.md +449 -0
  282. package/wiki/CPU-Emulation.md +477 -0
  283. package/wiki/Debugger.md +516 -0
  284. package/wiki/Disk-Drives.md +161 -0
  285. package/wiki/Disk-System-Internals.md +547 -0
  286. package/wiki/Display-Settings.md +88 -0
  287. package/wiki/Expansion-Slots.md +187 -0
  288. package/wiki/File-Explorer.md +259 -0
  289. package/wiki/Getting-Started.md +156 -0
  290. package/wiki/Home.md +69 -0
  291. package/wiki/Input-Devices.md +183 -0
  292. package/wiki/Keyboard-Shortcuts.md +158 -0
  293. package/wiki/Memory-System.md +364 -0
  294. package/wiki/Save-States.md +172 -0
  295. package/wiki/Video-Rendering.md +658 -0
@@ -0,0 +1,183 @@
1
+ # Input Devices
2
+
3
+ The emulator supports keyboard, joystick/paddle, and mouse input, matching the input capabilities of a real Apple IIe. It also provides text selection and clipboard paste features that bridge the gap between the host system and the emulated machine.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Keyboard](#keyboard)
8
+ - [Text Paste](#text-paste)
9
+ - [Text Selection and Copy](#text-selection-and-copy)
10
+ - [Joystick and Paddles](#joystick-and-paddles)
11
+ - [Mouse](#mouse)
12
+ - [Mobile Input](#mobile-input)
13
+
14
+ ## Keyboard
15
+
16
+ ### Key Mapping
17
+
18
+ The emulator translates browser keycodes to Apple II ASCII codes in real time. All key translation is handled by the C++ core, supporting the full US keyboard layout.
19
+
20
+ **Modifier keys:**
21
+
22
+ | Host Key | Apple II Function |
23
+ |----------|-------------------|
24
+ | Alt (Option) | Open Apple button |
25
+ | Meta (Cmd/Win) | Closed Apple button |
26
+ | Shift | Shift (uppercase, shifted symbols) |
27
+ | Ctrl | Control (generates control characters Ctrl+A through Ctrl+Z) |
28
+ | Caps Lock | Uppercase letters (matches Apple II behavior) |
29
+
30
+ **Special keys:**
31
+
32
+ | Host Key | Apple II Key |
33
+ |----------|-------------|
34
+ | Enter | Return ($0D) |
35
+ | Backspace | Delete / Left arrow ($08) |
36
+ | Escape | Escape ($1B) |
37
+ | Tab | Tab ($09) |
38
+ | Space | Space ($20) |
39
+ | Left Arrow | Left arrow ($08) |
40
+ | Right Arrow | Right arrow ($15) |
41
+ | Up Arrow | Up arrow ($0B) |
42
+ | Down Arrow | Down arrow ($0A) |
43
+
44
+ **Letters and numbers:**
45
+
46
+ - Letters A-Z are translated to lowercase by default and converted to uppercase when Shift or Caps Lock is active
47
+ - Number keys 0-9 map directly to their ASCII equivalents
48
+ - All standard US punctuation keys are supported, including their shifted variants
49
+
50
+ ### Focus
51
+
52
+ The emulator captures keyboard input when the screen canvas has focus. Click on the emulator screen to give it focus. When focus is on other UI elements (debug windows, menus, etc.), keyboard input goes to those elements instead of the emulator.
53
+
54
+ ### Browser Shortcut Passthrough
55
+
56
+ The emulator prevents default browser behavior for keys that would interfere with the emulation (Backspace, Tab, Space, arrow keys) when the canvas has focus. Standard browser shortcuts like Ctrl+R (refresh) are allowed through.
57
+
58
+ ## Text Paste
59
+
60
+ You can paste text from the clipboard into the emulator using **Ctrl+V** (or **Cmd+V** on macOS). The pasted text is converted character by character to Apple II key codes and fed into the emulator at an accelerated rate.
61
+
62
+ ### How Paste Works
63
+
64
+ 1. The clipboard text is read and each character is converted to an Apple II key code
65
+ 2. The emulation speed is temporarily increased to 8x normal to process the paste quickly
66
+ 3. Characters are fed to the emulator one at a time, waiting for the keyboard ready flag between each keypress
67
+ 4. When the paste completes, the emulation speed returns to normal
68
+
69
+ ### Programmatic Text Input
70
+
71
+ The paste system is also used internally by features like the BASIC Program Viewer to load programs. The `queueTextInput()` API accepts text with configurable speed multiplier and completion callbacks.
72
+
73
+ ### Canceling a Paste
74
+
75
+ If a paste operation is in progress, it can be cancelled programmatically. The paste queue is cleared and the emulation speed is restored immediately.
76
+
77
+ ## Text Selection and Copy
78
+
79
+ The emulator supports selecting and copying text directly from the Apple II screen when it is in text mode (40-column or 80-column).
80
+
81
+ ### Selecting Text
82
+
83
+ 1. Click and drag on the emulator screen to select a range of characters
84
+ 2. The selection is highlighted with a semi-transparent overlay
85
+ 3. Selection works correctly with CRT shader effects (curvature, overscan, margins) -- the mouse position is mapped through the same transforms as the display
86
+
87
+ ### Copying Text
88
+
89
+ - Press **Ctrl+C** (or **Cmd+C** on macOS) to copy the selected text to the clipboard
90
+ - A brief green flash confirms the copy
91
+ - Right-click on a selection to open a context menu with **Copy** and **Select All** options
92
+
93
+ ### Select All
94
+
95
+ Use the right-click context menu's **Select All** option to select the entire 24-line screen. This works in both 40-column and 80-column modes.
96
+
97
+ ### Clearing a Selection
98
+
99
+ - Press **Escape** to clear the current selection
100
+ - Click without dragging to clear the selection
101
+ - Selections are only available in text mode -- switching to a graphics mode clears any active selection
102
+
103
+ ### How Text is Read
104
+
105
+ The C++ core handles reading screen memory and converting Apple II character codes to Unicode text. The selection coordinates (row/column) are passed to the WASM function `_readScreenText()`, which reads the appropriate page of screen memory (main or aux for 80-column mode) and decodes the characters.
106
+
107
+ ## Joystick and Paddles
108
+
109
+ The Apple IIe supports two analog paddles (or one joystick with two axes) and up to three buttons. The emulator provides a virtual joystick window for mouse-based control.
110
+
111
+ ### Virtual Joystick Window
112
+
113
+ Open the **Joystick** window from the **Input** menu. The window contains:
114
+
115
+ - **Joystick area** -- A square pad with a draggable knob. Drag the knob to set the X and Y axis values (0-255 range, with 128 at center).
116
+ - **X/Y values** -- Numeric readout of the current paddle values
117
+ - **Button 0 and Button 1** -- Click and hold to press the corresponding Apple II button
118
+ - **Center button** -- Resets the knob to the center position (128, 128)
119
+
120
+ ### Knob Behavior
121
+
122
+ - Click and drag the knob to move it
123
+ - Click anywhere in the joystick area to jump the knob to that position
124
+ - When you release the mouse button, the knob snaps back to center
125
+ - Paddle values update in real time as you drag
126
+
127
+ ### Paddle Values
128
+
129
+ The joystick knob position maps to Apple II paddle values:
130
+
131
+ | Position | Paddle Value |
132
+ |----------|-------------|
133
+ | Top-left | X=0, Y=0 |
134
+ | Center | X=128, Y=128 |
135
+ | Bottom-right | X=255, Y=255 |
136
+
137
+ The paddle values are sent to the emulator via the `_setPaddleValue()` WASM function and are read by Apple II software through the standard paddle I/O addresses (`$C064`-`$C067`).
138
+
139
+ ## Mouse
140
+
141
+ The emulator supports the Apple Mouse Interface Card, providing mouse input to compatible software. The mouse uses the browser's Pointer Lock API for relative movement tracking.
142
+
143
+ ### Enabling the Mouse
144
+
145
+ The Apple Mouse Card must be installed in an expansion slot (typically slot 4). See [[Expansion-Slots]] for configuration.
146
+
147
+ ### Engaging Mouse Capture
148
+
149
+ To start using the mouse with the emulator:
150
+
151
+ 1. Hold **Alt** (Option) and **click** on the emulator screen
152
+ 2. The browser enters pointer lock mode and mouse movement is captured
153
+ 3. Mouse movement deltas are sent to the emulated mouse card
154
+ 4. Left mouse button clicks are forwarded as Apple mouse button presses
155
+
156
+ ### Releasing Mouse Capture
157
+
158
+ Press **Escape** to exit pointer lock mode. This is standard browser behavior for the Pointer Lock API.
159
+
160
+ ### Mouse Movement
161
+
162
+ While pointer lock is active, the browser sends relative movement deltas (not absolute positions). These deltas are forwarded to the WASM emulator via `_mouseMove(dx, dy)`, and the mouse card firmware translates them into Apple II mouse coordinates through the standard screen-hole protocol.
163
+
164
+ ## Mobile Input
165
+
166
+ On mobile and touch devices, the emulator provides a modified input experience:
167
+
168
+ ### Mobile Keyboard
169
+
170
+ When a mobile device is detected (touch capability + mobile user agent or small screen), the emulator creates a hidden text input field. Tapping the emulator screen focuses this hidden input, which triggers the on-screen keyboard.
171
+
172
+ - Regular character input is captured from the hidden input field and forwarded to the emulator
173
+ - Special keys (Backspace, Enter, Escape, Tab) are handled through keydown events
174
+ - Autocomplete, autocapitalize, autocorrect, and spellcheck are all disabled to prevent interference
175
+
176
+ ### Mobile Detection
177
+
178
+ The emulator detects mobile devices using a combination of:
179
+ - Touch capability (`ontouchstart` or `maxTouchPoints`)
180
+ - Mobile user agent string matching
181
+ - Small screen width (800px or less)
182
+
183
+ See also: [[Keyboard-Shortcuts]], [[Expansion-Slots]]
@@ -0,0 +1,158 @@
1
+ # Keyboard Shortcuts
2
+
3
+ Complete keyboard shortcut reference for the Apple //e Emulator.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [Apple IIe Key Mapping](#apple-iie-key-mapping)
10
+ - [Special Keys](#special-keys)
11
+ - [Apple II Control Key Combinations](#apple-ii-control-key-combinations)
12
+ - [Emulator Shortcuts](#emulator-shortcuts)
13
+ - [Debugger Shortcuts](#debugger-shortcuts)
14
+ - [Window Management](#window-management)
15
+ - [Assembler Editor](#assembler-editor)
16
+ - [Mouse Capture](#mouse-capture)
17
+ - [Text Selection and Copy](#text-selection-and-copy)
18
+ - [Notes](#notes)
19
+
20
+ ---
21
+
22
+ ## Apple IIe Key Mapping
23
+
24
+ The emulator translates modern keyboard input to Apple IIe key codes. Standard alphanumeric keys and symbols map directly.
25
+
26
+ | Your Keyboard | Apple //e Key | Notes |
27
+ |---------------|---------------|-------|
28
+ | Enter | Return | Confirm input, run commands |
29
+ | Backspace | Delete (left arrow) | Delete character to the left |
30
+ | Escape | ESC | Cancel, exit menus |
31
+ | Tab | Tab | Tab character |
32
+ | Arrow keys | Arrow keys | Cursor movement, game controls |
33
+ | Space | Space | Space character |
34
+
35
+ ## Special Keys
36
+
37
+ | Your Keyboard | Apple //e Key | Notes |
38
+ |---------------|---------------|-------|
39
+ | Left Alt | Open Apple | Modifier key, joystick button 0 |
40
+ | Right Alt / Windows key | Closed Apple (Solid Apple) | Modifier key, joystick button 1 |
41
+ | Ctrl | Control | Control key modifier |
42
+ | Shift | Shift | Shift modifier |
43
+ | Caps Lock | Caps Lock | Tracked and sent to the emulator core |
44
+
45
+ ## Apple II Control Key Combinations
46
+
47
+ These are Apple IIe keyboard combinations, processed by the emulated machine, not the browser:
48
+
49
+ | Combination | Function |
50
+ |-------------|----------|
51
+ | Ctrl+C | Break -- stop a running BASIC program |
52
+ | Ctrl+S | Pause screen output (Ctrl+Q to resume) |
53
+ | Ctrl+Q | Resume output after Ctrl+S pause |
54
+ | Ctrl+G | Bell (beep sound) |
55
+ | Ctrl+Reset | Warm reset -- preserves memory, returns to BASIC or monitor |
56
+ | Ctrl+Open Apple+Reset | Cold reset on real hardware (use the **Reboot** button instead) |
57
+
58
+ ## Emulator Shortcuts
59
+
60
+ These shortcuts are handled by the emulator's JavaScript layer, not the Apple IIe:
61
+
62
+ | Shortcut | Action |
63
+ |----------|--------|
64
+ | F1 | Open / close the Help & Documentation window |
65
+ | Ctrl+Escape | Exit full-page mode and return to the normal view |
66
+ | Ctrl+V | Paste clipboard text into the emulator at accelerated speed |
67
+ | Ctrl+\` | Open the Window Switcher overlay |
68
+ | Option+Tab | Cycle focus to the next open window |
69
+ | Option+Shift+Tab | Cycle focus to the previous open window |
70
+
71
+ ## Debugger Shortcuts
72
+
73
+ These shortcuts control the CPU Debugger when the emulator is paused at a breakpoint or in single-step mode:
74
+
75
+ | Shortcut | Action | Description |
76
+ |----------|--------|-------------|
77
+ | F5 | Run / Continue | Resume execution until the next breakpoint |
78
+ | F10 | Step Over | Execute one instruction, stepping over JSR subroutine calls |
79
+ | F11 | Step Into | Execute a single instruction, following into subroutines |
80
+ | Shift+F11 | Step Out | Continue execution until the current subroutine returns (RTS/RTI) |
81
+
82
+ These shortcuts work globally -- you do not need to have the CPU Debugger window focused.
83
+
84
+ ## Window Management
85
+
86
+ | Shortcut | Action |
87
+ |----------|--------|
88
+ | Ctrl+\` | Open the Window Switcher (shows all available windows organised by category) |
89
+ | Option+Tab | Cycle to the next visible window and bring it to focus |
90
+ | Option+Shift+Tab | Cycle to the previous visible window |
91
+
92
+ The Window Switcher displays windows in five categories:
93
+
94
+ - **System** -- Screen, Disk Drives, Save States
95
+ - **Hardware** -- Display Settings, Joystick, Expansion Slots, Mockingboard, Mouse Card
96
+ - **Debug** -- CPU Debugger, Rule Builder, Soft Switches, Memory Browser, Memory Heat Map, Memory Map, Stack Viewer, Zero Page Watch
97
+ - **Dev** -- Applesoft BASIC, Assembler
98
+ - **Help** -- Documentation, Release Notes
99
+
100
+ Click a window name in the switcher or use Tab cycling to navigate between open windows.
101
+
102
+ ## Assembler Editor
103
+
104
+ These shortcuts are active when editing assembly source in the Assembler Editor window.
105
+
106
+ ### File Operations
107
+
108
+ | Shortcut | Action |
109
+ |----------|--------|
110
+ | Ctrl+N (Cmd+N) | New file |
111
+ | Ctrl+O (Cmd+O) | Open file |
112
+ | Ctrl+S (Cmd+S) | Save file |
113
+
114
+ ### Editing
115
+
116
+ | Shortcut | Action |
117
+ |----------|--------|
118
+ | Ctrl+Enter (Cmd+Enter) | Assemble the current source |
119
+ | Ctrl+/ (Cmd+/) | Toggle comment on the current line |
120
+ | Ctrl+D (Cmd+D) | Duplicate the current line |
121
+ | Tab | Move cursor to the next column (label / opcode / operand / comment) |
122
+ | Shift+Tab | Move cursor to the previous column |
123
+ | Enter | Smart indent (auto-aligns to the appropriate column on new line) |
124
+
125
+ ### Breakpoints and Panels
126
+
127
+ | Shortcut | Action |
128
+ |----------|--------|
129
+ | F9 | Toggle breakpoint on the current line |
130
+ | F2 | Toggle the ROM reference panel |
131
+
132
+ ## Mouse Capture
133
+
134
+ | Shortcut | Action |
135
+ |----------|--------|
136
+ | Alt+Click on screen | Engage pointer lock for Apple Mouse Card input |
137
+ | Escape | Release pointer lock (standard browser behavior) |
138
+
139
+ Mouse capture requires the Apple Mouse Card to be installed in an expansion slot. See [[Expansion-Slots]] for card configuration.
140
+
141
+ ## Text Selection and Copy
142
+
143
+ | Action | How |
144
+ |--------|-----|
145
+ | Select text | Click and drag on the emulator screen |
146
+ | Copy selected text | Ctrl+C (Cmd+C on Mac) while text is selected |
147
+ | Paste text | Ctrl+V (Cmd+V on Mac) when the screen has focus |
148
+
149
+ Text selection works in both 40-column and 80-column text modes. The selection overlay appears directly on the canvas.
150
+
151
+ ## Notes
152
+
153
+ - **Browser shortcuts are preserved** -- Ctrl+R (reload), Ctrl+T (new tab), and other standard browser shortcuts are not intercepted by the emulator and work normally.
154
+ - **Focus matters** -- Keyboard input is only sent to the Apple IIe when the emulator screen canvas has focus. Click the screen to focus it. If a debug window or text input field is focused, keys go to that element instead.
155
+ - **Mobile devices** -- On touch devices, tapping the screen opens the on-screen keyboard via a hidden input element.
156
+ - **Key codes are sent raw** -- The JavaScript layer sends raw key codes to the C++ core, which handles the full Apple IIe keyboard translation including modifier state.
157
+
158
+ For general usage see [[Getting-Started]]. For debugger details see [[Debugger]].