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.
- package/.clangd +5 -0
- package/.mcp.json +12 -0
- package/CLAUDE.md +362 -0
- package/CMakeLists.txt +774 -0
- package/LICENSE +21 -0
- package/README.md +392 -0
- package/build-wasm/generated/roms.cpp +2447 -0
- package/docker-compose.staging.yml +9 -0
- package/docs/basic-rom-disassembly.md +6663 -0
- package/docs/softswitch-comparison.md +273 -0
- package/docs/thunderclock-debug.md +89 -0
- package/examples/cube.bas +72 -0
- package/examples/hello.s +55 -0
- package/examples/scroll.s +140 -0
- package/package.json +18 -0
- package/public/assets/apple-logo-old.png +0 -0
- package/public/assets/apple-logo.png +0 -0
- package/public/assets/drive-closed-light-on.png +0 -0
- package/public/assets/drive-closed.png +0 -0
- package/public/assets/drive-open-light-on.png +0 -0
- package/public/assets/drive-open.png +0 -0
- package/public/audio-worklet.js +82 -0
- package/public/disks/Apple DOS 3.3 January 1983.dsk +0 -0
- package/public/disks/ProDOS 2.4.3.po +0 -0
- package/public/disks/h32mb.2mg +0 -0
- package/public/disks/library.json +26 -0
- package/public/docs/llms/llm-assembler.txt +90 -0
- package/public/docs/llms/llm-basic-program.txt +256 -0
- package/public/docs/llms/llm-disk-drives.txt +72 -0
- package/public/docs/llms/llm-file-explorer.txt +50 -0
- package/public/docs/llms/llm-hard-drives.txt +80 -0
- package/public/docs/llms/llm-main.txt +51 -0
- package/public/docs/llms/llm-slot-configuration.txt +66 -0
- package/public/icons/icon-192.svg +4 -0
- package/public/icons/icon-512.svg +4 -0
- package/public/index.html +661 -0
- package/public/llms.txt +49 -0
- package/public/manifest.json +29 -0
- package/public/shaders/burnin.glsl +22 -0
- package/public/shaders/crt.glsl +706 -0
- package/public/shaders/edge.glsl +109 -0
- package/public/shaders/vertex.glsl +8 -0
- package/public/sw.js +186 -0
- package/roms/341-0027.bin +0 -0
- package/roms/341-0160-A-US-UK.bin +0 -0
- package/roms/341-0160-A.bin +0 -0
- package/roms/342-0273-A-US-UK.bin +0 -0
- package/roms/342-0349-B-C0-FF.bin +0 -0
- package/roms/Apple Mouse Interface Card ROM - 342-0270-C.bin +0 -0
- package/roms/Thunderclock Plus ROM.bin +0 -0
- package/scripts/generate_roms.sh +69 -0
- package/src/bindings/wasm_interface.cpp +1940 -0
- package/src/core/assembler/assembler.cpp +1239 -0
- package/src/core/assembler/assembler.hpp +115 -0
- package/src/core/audio/audio.cpp +160 -0
- package/src/core/audio/audio.hpp +81 -0
- package/src/core/basic/basic_detokenizer.cpp +436 -0
- package/src/core/basic/basic_detokenizer.hpp +41 -0
- package/src/core/basic/basic_tokenizer.cpp +286 -0
- package/src/core/basic/basic_tokenizer.hpp +26 -0
- package/src/core/basic/basic_tokens.hpp +295 -0
- package/src/core/cards/disk2_card.cpp +568 -0
- package/src/core/cards/disk2_card.hpp +316 -0
- package/src/core/cards/expansion_card.hpp +185 -0
- package/src/core/cards/mockingboard/ay8910.cpp +616 -0
- package/src/core/cards/mockingboard/ay8910.hpp +159 -0
- package/src/core/cards/mockingboard/via6522.cpp +530 -0
- package/src/core/cards/mockingboard/via6522.hpp +163 -0
- package/src/core/cards/mockingboard_card.cpp +312 -0
- package/src/core/cards/mockingboard_card.hpp +159 -0
- package/src/core/cards/mouse_card.cpp +654 -0
- package/src/core/cards/mouse_card.hpp +190 -0
- package/src/core/cards/smartport/block_device.cpp +202 -0
- package/src/core/cards/smartport/block_device.hpp +60 -0
- package/src/core/cards/smartport/smartport_card.cpp +603 -0
- package/src/core/cards/smartport/smartport_card.hpp +120 -0
- package/src/core/cards/thunderclock_card.cpp +237 -0
- package/src/core/cards/thunderclock_card.hpp +122 -0
- package/src/core/cpu/cpu6502.cpp +1609 -0
- package/src/core/cpu/cpu6502.hpp +203 -0
- package/src/core/debug/condition_evaluator.cpp +470 -0
- package/src/core/debug/condition_evaluator.hpp +87 -0
- package/src/core/disassembler/disassembler.cpp +552 -0
- package/src/core/disassembler/disassembler.hpp +171 -0
- package/src/core/disk-image/disk_image.hpp +267 -0
- package/src/core/disk-image/dsk_disk_image.cpp +827 -0
- package/src/core/disk-image/dsk_disk_image.hpp +204 -0
- package/src/core/disk-image/gcr_encoding.cpp +147 -0
- package/src/core/disk-image/gcr_encoding.hpp +78 -0
- package/src/core/disk-image/woz_disk_image.cpp +1049 -0
- package/src/core/disk-image/woz_disk_image.hpp +343 -0
- package/src/core/emulator.cpp +2126 -0
- package/src/core/emulator.hpp +434 -0
- package/src/core/filesystem/dos33.cpp +178 -0
- package/src/core/filesystem/dos33.hpp +66 -0
- package/src/core/filesystem/pascal.cpp +262 -0
- package/src/core/filesystem/pascal.hpp +87 -0
- package/src/core/filesystem/prodos.cpp +369 -0
- package/src/core/filesystem/prodos.hpp +119 -0
- package/src/core/input/keyboard.cpp +227 -0
- package/src/core/input/keyboard.hpp +111 -0
- package/src/core/mmu/mmu.cpp +1387 -0
- package/src/core/mmu/mmu.hpp +236 -0
- package/src/core/types.hpp +196 -0
- package/src/core/video/video.cpp +680 -0
- package/src/core/video/video.hpp +156 -0
- package/src/css/assembler-editor.css +1617 -0
- package/src/css/base.css +470 -0
- package/src/css/basic-debugger.css +791 -0
- package/src/css/basic-editor.css +792 -0
- package/src/css/controls.css +783 -0
- package/src/css/cpu-debugger.css +1413 -0
- package/src/css/debug-base.css +160 -0
- package/src/css/debug-windows.css +6455 -0
- package/src/css/disk-drives.css +406 -0
- package/src/css/documentation.css +392 -0
- package/src/css/file-explorer.css +867 -0
- package/src/css/hard-drive.css +180 -0
- package/src/css/layout.css +217 -0
- package/src/css/memory-windows.css +798 -0
- package/src/css/modals.css +510 -0
- package/src/css/monitor.css +425 -0
- package/src/css/release-notes.css +101 -0
- package/src/css/responsive.css +400 -0
- package/src/css/rule-builder.css +340 -0
- package/src/css/save-states.css +201 -0
- package/src/css/settings-windows.css +1231 -0
- package/src/css/window-switcher.css +150 -0
- package/src/js/agent/agent-manager.js +643 -0
- package/src/js/agent/agent-tools.js +293 -0
- package/src/js/agent/agent-version-tools.js +131 -0
- package/src/js/agent/assembler-tools.js +357 -0
- package/src/js/agent/basic-program-tools.js +894 -0
- package/src/js/agent/disk-tools.js +417 -0
- package/src/js/agent/file-explorer-tools.js +269 -0
- package/src/js/agent/index.js +13 -0
- package/src/js/agent/main-tools.js +222 -0
- package/src/js/agent/slot-tools.js +303 -0
- package/src/js/agent/smartport-tools.js +257 -0
- package/src/js/agent/window-tools.js +80 -0
- package/src/js/audio/audio-driver.js +417 -0
- package/src/js/audio/audio-worklet.js +85 -0
- package/src/js/audio/index.js +8 -0
- package/src/js/config/default-layout.js +34 -0
- package/src/js/config/version.js +8 -0
- package/src/js/data/apple2-rom-routines.js +577 -0
- package/src/js/debug/assembler-editor-window.js +2993 -0
- package/src/js/debug/basic-breakpoint-manager.js +529 -0
- package/src/js/debug/basic-program-parser.js +436 -0
- package/src/js/debug/basic-program-window.js +2594 -0
- package/src/js/debug/basic-variable-inspector.js +447 -0
- package/src/js/debug/breakpoint-manager.js +472 -0
- package/src/js/debug/cpu-debugger-window.js +2396 -0
- package/src/js/debug/index.js +22 -0
- package/src/js/debug/label-manager.js +238 -0
- package/src/js/debug/memory-browser-window.js +416 -0
- package/src/js/debug/memory-heat-map-window.js +481 -0
- package/src/js/debug/memory-map-window.js +206 -0
- package/src/js/debug/mockingboard-window.js +882 -0
- package/src/js/debug/mouse-card-window.js +355 -0
- package/src/js/debug/rule-builder-window.js +648 -0
- package/src/js/debug/soft-switch-window.js +458 -0
- package/src/js/debug/stack-viewer-window.js +221 -0
- package/src/js/debug/symbols.js +416 -0
- package/src/js/debug/trace-panel.js +291 -0
- package/src/js/debug/zero-page-watch-window.js +297 -0
- package/src/js/disk-manager/disk-drives-window.js +212 -0
- package/src/js/disk-manager/disk-operations.js +284 -0
- package/src/js/disk-manager/disk-persistence.js +301 -0
- package/src/js/disk-manager/disk-surface-renderer.js +388 -0
- package/src/js/disk-manager/drive-sounds.js +139 -0
- package/src/js/disk-manager/hard-drive-manager.js +481 -0
- package/src/js/disk-manager/hard-drive-persistence.js +187 -0
- package/src/js/disk-manager/hard-drive-window.js +57 -0
- package/src/js/disk-manager/index.js +890 -0
- package/src/js/display/display-settings-window.js +383 -0
- package/src/js/display/index.js +10 -0
- package/src/js/display/screen-window.js +342 -0
- package/src/js/display/webgl-renderer.js +705 -0
- package/src/js/file-explorer/disassembler.js +574 -0
- package/src/js/file-explorer/dos33.js +266 -0
- package/src/js/file-explorer/file-viewer.js +359 -0
- package/src/js/file-explorer/index.js +1261 -0
- package/src/js/file-explorer/prodos.js +549 -0
- package/src/js/file-explorer/utils.js +67 -0
- package/src/js/help/documentation-window.js +1096 -0
- package/src/js/help/index.js +10 -0
- package/src/js/help/release-notes-window.js +85 -0
- package/src/js/help/release-notes.js +612 -0
- package/src/js/input/gamepad-handler.js +176 -0
- package/src/js/input/index.js +12 -0
- package/src/js/input/input-handler.js +396 -0
- package/src/js/input/joystick-window.js +404 -0
- package/src/js/input/mouse-handler.js +99 -0
- package/src/js/input/text-selection.js +462 -0
- package/src/js/main.js +653 -0
- package/src/js/state/index.js +15 -0
- package/src/js/state/save-states-window.js +393 -0
- package/src/js/state/state-manager.js +409 -0
- package/src/js/state/state-persistence.js +218 -0
- package/src/js/ui/confirm.js +43 -0
- package/src/js/ui/disk-drive-positioner.js +347 -0
- package/src/js/ui/reminder-controller.js +129 -0
- package/src/js/ui/slot-configuration-window.js +560 -0
- package/src/js/ui/theme-manager.js +61 -0
- package/src/js/ui/toast.js +44 -0
- package/src/js/ui/ui-controller.js +897 -0
- package/src/js/ui/window-switcher.js +275 -0
- package/src/js/utils/basic-autocomplete.js +832 -0
- package/src/js/utils/basic-highlighting.js +473 -0
- package/src/js/utils/basic-tokenizer.js +153 -0
- package/src/js/utils/basic-tokens.js +117 -0
- package/src/js/utils/constants.js +28 -0
- package/src/js/utils/indexeddb-helper.js +225 -0
- package/src/js/utils/merlin-editor-support.js +905 -0
- package/src/js/utils/merlin-highlighting.js +551 -0
- package/src/js/utils/storage.js +125 -0
- package/src/js/utils/string-utils.js +19 -0
- package/src/js/utils/wasm-memory.js +54 -0
- package/src/js/windows/base-window.js +690 -0
- package/src/js/windows/index.js +9 -0
- package/src/js/windows/window-manager.js +375 -0
- package/tests/catch2/catch.hpp +17976 -0
- package/tests/common/basic_program_builder.cpp +119 -0
- package/tests/common/basic_program_builder.hpp +209 -0
- package/tests/common/disk_image_builder.cpp +444 -0
- package/tests/common/disk_image_builder.hpp +141 -0
- package/tests/common/test_helpers.hpp +118 -0
- package/tests/gcr/gcr-test.cpp +142 -0
- package/tests/integration/check-rom.js +70 -0
- package/tests/integration/compare-boot.js +239 -0
- package/tests/integration/crash-trace.js +102 -0
- package/tests/integration/disk-boot-test.js +264 -0
- package/tests/integration/memory-crash.js +108 -0
- package/tests/integration/nibble-read-test.js +249 -0
- package/tests/integration/phase-test.js +159 -0
- package/tests/integration/test_emulator.cpp +291 -0
- package/tests/integration/test_emulator_basic.cpp +91 -0
- package/tests/integration/test_emulator_debug.cpp +344 -0
- package/tests/integration/test_emulator_disk.cpp +153 -0
- package/tests/integration/test_emulator_state.cpp +163 -0
- package/tests/klaus/6502_functional_test.bin +0 -0
- package/tests/klaus/65C02_extended_opcodes_test.bin +0 -0
- package/tests/klaus/klaus_6502_test.cpp +184 -0
- package/tests/klaus/klaus_65c02_test.cpp +197 -0
- package/tests/thunderclock/thunderclock_mmu_test.cpp +304 -0
- package/tests/thunderclock/thunderclock_test.cpp +550 -0
- package/tests/unit/test_assembler.cpp +521 -0
- package/tests/unit/test_audio.cpp +196 -0
- package/tests/unit/test_ay8910.cpp +311 -0
- package/tests/unit/test_basic_detokenizer.cpp +265 -0
- package/tests/unit/test_basic_tokenizer.cpp +382 -0
- package/tests/unit/test_block_device.cpp +259 -0
- package/tests/unit/test_condition_evaluator.cpp +219 -0
- package/tests/unit/test_cpu6502.cpp +1301 -0
- package/tests/unit/test_cpu_addressing.cpp +361 -0
- package/tests/unit/test_cpu_cycle_counts.cpp +409 -0
- package/tests/unit/test_cpu_decimal.cpp +166 -0
- package/tests/unit/test_cpu_interrupts.cpp +285 -0
- package/tests/unit/test_disassembler.cpp +323 -0
- package/tests/unit/test_disk2_card.cpp +330 -0
- package/tests/unit/test_dos33.cpp +273 -0
- package/tests/unit/test_dsk_disk_image.cpp +315 -0
- package/tests/unit/test_expansion_card.cpp +178 -0
- package/tests/unit/test_gcr_encoding.cpp +232 -0
- package/tests/unit/test_keyboard.cpp +262 -0
- package/tests/unit/test_mmu.cpp +555 -0
- package/tests/unit/test_mmu_slots.cpp +323 -0
- package/tests/unit/test_mockingboard.cpp +352 -0
- package/tests/unit/test_mouse_card.cpp +386 -0
- package/tests/unit/test_pascal.cpp +248 -0
- package/tests/unit/test_prodos.cpp +259 -0
- package/tests/unit/test_smartport_card.cpp +321 -0
- package/tests/unit/test_thunderclock.cpp +354 -0
- package/tests/unit/test_via6522.cpp +323 -0
- package/tests/unit/test_video.cpp +319 -0
- package/tests/unit/test_woz_disk_image.cpp +257 -0
- package/vite.config.js +96 -0
- package/wiki/AI-Agent.md +372 -0
- package/wiki/Architecture-Overview.md +303 -0
- package/wiki/Audio-System.md +449 -0
- package/wiki/CPU-Emulation.md +477 -0
- package/wiki/Debugger.md +516 -0
- package/wiki/Disk-Drives.md +161 -0
- package/wiki/Disk-System-Internals.md +547 -0
- package/wiki/Display-Settings.md +88 -0
- package/wiki/Expansion-Slots.md +187 -0
- package/wiki/File-Explorer.md +259 -0
- package/wiki/Getting-Started.md +156 -0
- package/wiki/Home.md +69 -0
- package/wiki/Input-Devices.md +183 -0
- package/wiki/Keyboard-Shortcuts.md +158 -0
- package/wiki/Memory-System.md +364 -0
- package/wiki/Save-States.md +172 -0
- package/wiki/Video-Rendering.md +658 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Audio Worklet Processor for Apple //e Emulator
|
|
2
|
+
// This runs in a separate thread and drives emulator timing
|
|
3
|
+
// Stereo output: PSG1 on left channel, PSG2 on right channel
|
|
4
|
+
|
|
5
|
+
class AppleAudioProcessor extends AudioWorkletProcessor {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this.running = false;
|
|
10
|
+
this.sampleBuffer = new Float32Array(0); // Interleaved stereo [L0, R0, L1, R1, ...]
|
|
11
|
+
this.bufferReadPos = 0;
|
|
12
|
+
this.pendingRequest = false;
|
|
13
|
+
|
|
14
|
+
// Handle messages from main thread
|
|
15
|
+
this.port.onmessage = (event) => {
|
|
16
|
+
if (event.data.type === "start") {
|
|
17
|
+
this.running = true;
|
|
18
|
+
this.pendingRequest = false;
|
|
19
|
+
} else if (event.data.type === "stop") {
|
|
20
|
+
this.running = false;
|
|
21
|
+
this.pendingRequest = false;
|
|
22
|
+
} else if (event.data.type === "samples") {
|
|
23
|
+
// Append new interleaved stereo samples to existing buffer
|
|
24
|
+
const newSamples = new Float32Array(event.data.data);
|
|
25
|
+
const remaining = this.sampleBuffer.length - this.bufferReadPos;
|
|
26
|
+
|
|
27
|
+
if (remaining > 0) {
|
|
28
|
+
// Append to remaining samples
|
|
29
|
+
const combined = new Float32Array(remaining + newSamples.length);
|
|
30
|
+
combined.set(this.sampleBuffer.subarray(this.bufferReadPos), 0);
|
|
31
|
+
combined.set(newSamples, remaining);
|
|
32
|
+
this.sampleBuffer = combined;
|
|
33
|
+
} else {
|
|
34
|
+
this.sampleBuffer = newSamples;
|
|
35
|
+
}
|
|
36
|
+
this.bufferReadPos = 0;
|
|
37
|
+
this.pendingRequest = false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
process(inputs, outputs, parameters) {
|
|
43
|
+
const output = outputs[0];
|
|
44
|
+
const leftChannel = output[0];
|
|
45
|
+
const rightChannel = output[1];
|
|
46
|
+
|
|
47
|
+
if (!this.running || !leftChannel) {
|
|
48
|
+
// Fill with silence
|
|
49
|
+
if (leftChannel) leftChannel.fill(0);
|
|
50
|
+
if (rightChannel) rightChannel.fill(0);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Buffer contains interleaved stereo samples, so remaining frames = remaining / 2
|
|
55
|
+
const remainingFrames = (this.sampleBuffer.length - this.bufferReadPos) / 2;
|
|
56
|
+
|
|
57
|
+
// Request more samples if buffer is getting low and no request pending
|
|
58
|
+
// Keep at least 2 frames worth of buffer to avoid underruns
|
|
59
|
+
if (remainingFrames < 1600 && !this.pendingRequest) {
|
|
60
|
+
this.pendingRequest = true;
|
|
61
|
+
this.port.postMessage({
|
|
62
|
+
type: "requestSamples",
|
|
63
|
+
count: 1600, // Number of sample frames (stereo pairs)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Copy interleaved samples to separate L/R channels
|
|
68
|
+
for (let i = 0; i < leftChannel.length; i++) {
|
|
69
|
+
if (this.bufferReadPos + 1 < this.sampleBuffer.length) {
|
|
70
|
+
leftChannel[i] = this.sampleBuffer[this.bufferReadPos++];
|
|
71
|
+
rightChannel[i] = this.sampleBuffer[this.bufferReadPos++];
|
|
72
|
+
} else {
|
|
73
|
+
leftChannel[i] = 0;
|
|
74
|
+
rightChannel[i] = 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
registerProcessor("apple-audio-processor", AppleAudioProcessor);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "prodos-243",
|
|
4
|
+
"name": "ProDOS 2.4.3",
|
|
5
|
+
"file": "ProDOS 2.4.3.po",
|
|
6
|
+
"type": "floppy",
|
|
7
|
+
"size": "140 KB",
|
|
8
|
+
"description": "ProDOS 2.4.3 system disk with BASIC.SYSTEM"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "dos33-master",
|
|
12
|
+
"name": "DOS 3.3 System Master",
|
|
13
|
+
"file": "Apple DOS 3.3 January 1983.dsk",
|
|
14
|
+
"type": "floppy",
|
|
15
|
+
"size": "140 KB",
|
|
16
|
+
"description": "Apple DOS 3.3 system master with Applesoft BASIC"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "prodos-243-hd",
|
|
20
|
+
"name": "ProDOS 2.4.3 HD + Games",
|
|
21
|
+
"file": "h32mb.2mg",
|
|
22
|
+
"type": "hard-drive",
|
|
23
|
+
"size": "32 MB",
|
|
24
|
+
"description": "ProDOS 2.4.3 hard drive volume + games"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Assembler
|
|
2
|
+
|
|
3
|
+
> 65C02 assembly editor with Merlin syntax support.
|
|
4
|
+
|
|
5
|
+
## Tool Operations
|
|
6
|
+
|
|
7
|
+
**Show the window:**
|
|
8
|
+
```
|
|
9
|
+
showWindow("assembler-editor")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Hide the window:**
|
|
13
|
+
```
|
|
14
|
+
hideWindow("assembler-editor")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Focus the window:**
|
|
18
|
+
```
|
|
19
|
+
focusWindow("assembler-editor")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Assemble source code:**
|
|
23
|
+
```
|
|
24
|
+
emma_command({ command: "asmAssemble", params: {} })
|
|
25
|
+
```
|
|
26
|
+
Assembles the current assembly source code in the editor.
|
|
27
|
+
|
|
28
|
+
**Write assembled code to memory:**
|
|
29
|
+
```
|
|
30
|
+
emma_command({ command: "asmWrite", params: {} })
|
|
31
|
+
```
|
|
32
|
+
Writes the assembled machine code into emulator memory.
|
|
33
|
+
|
|
34
|
+
**Execute assembled code:**
|
|
35
|
+
```
|
|
36
|
+
emma_command({ command: "directExecuteAssemblyAt", params: { addr: "$0800" } })
|
|
37
|
+
emma_command({ command: "directExecuteAssemblyAt", params: { addr: "$0800", returnTo: "monitor" } })
|
|
38
|
+
emma_command({ command: "directExecuteAssemblyAt", params: { addr: "$0800", returnTo: "basic" } })
|
|
39
|
+
emma_command({ command: "directExecuteAssemblyAt", params: { addr: "$0800", returnTo: "$E003" } })
|
|
40
|
+
```
|
|
41
|
+
Sets PC to the specified address and executes. Address supports hex (`"$0800"`) or decimal (`2048`). If `addr` is omitted, uses the origin from the last successful assembly. Set `paused: true` to pause after setting PC (useful for debugging). Default is `paused: false` (executes immediately).
|
|
42
|
+
|
|
43
|
+
`returnTo` pushes a return address onto the stack so programs ending with RTS return cleanly. Defaults to `"auto"`. Accepts:
|
|
44
|
+
- `"auto"` (default) - captures current PC as return address (returns to whatever was running)
|
|
45
|
+
- `"monitor"` - return to Apple II monitor ($FF69)
|
|
46
|
+
- `"basic"` - return to Applesoft BASIC prompt ($E003)
|
|
47
|
+
- `"$AABB"` - hex address
|
|
48
|
+
- `12345` - decimal address
|
|
49
|
+
|
|
50
|
+
**Load example program:**
|
|
51
|
+
```
|
|
52
|
+
emma_command({ command: "asmLoadExample", params: {} })
|
|
53
|
+
```
|
|
54
|
+
Loads a "Hello World" example program into the editor.
|
|
55
|
+
|
|
56
|
+
**Clear editor:**
|
|
57
|
+
```
|
|
58
|
+
emma_command({ command: "asmNew", params: {} })
|
|
59
|
+
```
|
|
60
|
+
Clears the editor and starts a new assembly file.
|
|
61
|
+
|
|
62
|
+
**Get assembly source:**
|
|
63
|
+
```
|
|
64
|
+
emma_command({ command: "asmGet", params: {} })
|
|
65
|
+
```
|
|
66
|
+
Retrieves the current assembly source code from the editor.
|
|
67
|
+
|
|
68
|
+
**Get assembly status:**
|
|
69
|
+
```
|
|
70
|
+
emma_command({ command: "asmGetStatus", params: {} })
|
|
71
|
+
```
|
|
72
|
+
Returns the assembly status (none/ok/error), status text, origin address, and assembled size. Status is "none" when no program has been assembled.
|
|
73
|
+
|
|
74
|
+
**Set assembly source:**
|
|
75
|
+
```
|
|
76
|
+
emma_command({ command: "asmSet", params: { source: "ORG $0800\nLDA #$00\nRTS" } })
|
|
77
|
+
```
|
|
78
|
+
Replaces the entire assembly source code in the editor.
|
|
79
|
+
|
|
80
|
+
**Get assembly source for saving:**
|
|
81
|
+
```
|
|
82
|
+
emma_command({ command: "saveAsmInEditorToLocal", params: {} })
|
|
83
|
+
```
|
|
84
|
+
Retrieves the assembly source from the editor. Use with save_asm_file MCP tool to save to filesystem.
|
|
85
|
+
|
|
86
|
+
**Save assembly source to filesystem (MCP tool):**
|
|
87
|
+
```
|
|
88
|
+
save_asm_file({ path: "~/Documents/program.s", content: "<source code>", overwrite: false })
|
|
89
|
+
```
|
|
90
|
+
Saves assembly source code to a file on the local filesystem. Supports ~ for home directory. Recommended extensions: .s, .asm.
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# BASIC Program
|
|
2
|
+
|
|
3
|
+
> View and load Applesoft and Integer BASIC programs from memory.
|
|
4
|
+
|
|
5
|
+
## Tool Operations
|
|
6
|
+
|
|
7
|
+
### Direct Memory Access
|
|
8
|
+
|
|
9
|
+
**Read BASIC program directly from memory:**
|
|
10
|
+
```
|
|
11
|
+
emma_command({ command: "directReadBasic", params: {} })
|
|
12
|
+
```
|
|
13
|
+
Reads the BASIC program directly from emulator memory via WASM bindings. Does not require the BASIC window to be open or focused. Returns the detokenized program text.
|
|
14
|
+
|
|
15
|
+
**Write BASIC program directly to memory:**
|
|
16
|
+
```
|
|
17
|
+
emma_command({ command: "directWriteBasic", params: { program: "10 PRINT \"HELLO\"\n20 GOTO 10" } })
|
|
18
|
+
```
|
|
19
|
+
Writes a BASIC program directly to emulator memory via WASM bindings. Tokenizes the program text and updates all zero-page pointers. Does not require the BASIC window to be open or focused. The emulator must be powered on.
|
|
20
|
+
|
|
21
|
+
**Run BASIC program directly:**
|
|
22
|
+
```
|
|
23
|
+
emma_command({ command: "directRunBasic", params: {} })
|
|
24
|
+
```
|
|
25
|
+
Executes the BASIC program currently in memory by simulating the RUN command. Unpauses the emulator and clears any breakpoint flags. Does not require the BASIC window to be open or focused. The emulator must be powered on.
|
|
26
|
+
|
|
27
|
+
**Clear BASIC program buffer (NEW):**
|
|
28
|
+
```
|
|
29
|
+
emma_command({ command: "directNewBasic", params: {} })
|
|
30
|
+
```
|
|
31
|
+
Clears the BASIC program buffer by resetting all zero-page pointers and writing the end-of-program marker. Equivalent to the NEW command. Does not require the BASIC window to be open or focused. The emulator must be powered on.
|
|
32
|
+
|
|
33
|
+
**Get BASIC program content from editor:**
|
|
34
|
+
```
|
|
35
|
+
emma_command({ command: "saveBasicInEditorToLocal", params: {} })
|
|
36
|
+
```
|
|
37
|
+
Retrieves the BASIC program text from the editor. Returns the content as a string. Use with save_basic_file MCP tool to save to filesystem.
|
|
38
|
+
|
|
39
|
+
**Get BASIC program content from memory:**
|
|
40
|
+
```
|
|
41
|
+
emma_command({ command: "directSaveBasicInMemoryToLocal", params: { path: "~/Documents/myprogram.bas" } })
|
|
42
|
+
```
|
|
43
|
+
Reads the BASIC program from emulator memory and returns the content. Use with save_basic_file MCP tool to save to filesystem.
|
|
44
|
+
|
|
45
|
+
**Save BASIC program to filesystem (MCP tool):**
|
|
46
|
+
```
|
|
47
|
+
save_basic_file({ path: "~/Documents/myprogram.bas", content: "<program text>", overwrite: false })
|
|
48
|
+
```
|
|
49
|
+
Saves BASIC program text to a file on the local filesystem. Supports ~ for home directory. Set overwrite: true to replace existing files. Can be used with saveBasicInEditorToLocal (from editor) or directSaveBasicInMemoryToLocal (from memory) to get the content first.
|
|
50
|
+
|
|
51
|
+
### Window Operations
|
|
52
|
+
|
|
53
|
+
**Show the window:**
|
|
54
|
+
```
|
|
55
|
+
showWindow("basic-program")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Hide the window:**
|
|
59
|
+
```
|
|
60
|
+
hideWindow("basic-program")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Focus the window:**
|
|
64
|
+
```
|
|
65
|
+
focusWindow("basic-program")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Editor Operations
|
|
69
|
+
|
|
70
|
+
**Load BASIC program from memory:**
|
|
71
|
+
```
|
|
72
|
+
emma_command({ command: "basicProgramLoadFromMemory", params: {} })
|
|
73
|
+
```
|
|
74
|
+
Reads the tokenized BASIC program from emulator memory and displays it in the editor.
|
|
75
|
+
|
|
76
|
+
**Load BASIC program into emulator:**
|
|
77
|
+
```
|
|
78
|
+
emma_command({ command: "basicProgramLoadIntoEmulator", params: {} })
|
|
79
|
+
```
|
|
80
|
+
Tokenizes the program in the editor and loads it into emulator memory. The emulator must be powered on for this to work.
|
|
81
|
+
|
|
82
|
+
**Run BASIC program:**
|
|
83
|
+
```
|
|
84
|
+
emma_command({ command: "basicProgramRun", params: {} })
|
|
85
|
+
```
|
|
86
|
+
Execute the BASIC program in the emulator.
|
|
87
|
+
|
|
88
|
+
**Pause BASIC program:**
|
|
89
|
+
```
|
|
90
|
+
emma_command({ command: "basicProgramPause", params: {} })
|
|
91
|
+
```
|
|
92
|
+
Pause BASIC program execution at the next statement.
|
|
93
|
+
|
|
94
|
+
**New BASIC program (clear editor):**
|
|
95
|
+
```
|
|
96
|
+
emma_command({ command: "basicProgramNew", params: {} })
|
|
97
|
+
```
|
|
98
|
+
Clear all text from the BASIC program editor and start a new program.
|
|
99
|
+
|
|
100
|
+
**Renumber BASIC program:**
|
|
101
|
+
```
|
|
102
|
+
emma_command({ command: "basicProgramRenumber", params: {} })
|
|
103
|
+
```
|
|
104
|
+
Renumber program lines in increments of 10, updating GOTO and GOSUB references.
|
|
105
|
+
|
|
106
|
+
**Format BASIC program:**
|
|
107
|
+
```
|
|
108
|
+
emma_command({ command: "basicProgramFormat", params: {} })
|
|
109
|
+
```
|
|
110
|
+
Auto-format the BASIC code with proper alignment and indentation.
|
|
111
|
+
|
|
112
|
+
**Get line and character count:**
|
|
113
|
+
```
|
|
114
|
+
emma_command({ command: "basicProgramLineCount", params: {} })
|
|
115
|
+
```
|
|
116
|
+
Returns the number of lines and characters in the editor.
|
|
117
|
+
|
|
118
|
+
**Get current program:**
|
|
119
|
+
```
|
|
120
|
+
emma_command({ command: "basicProgramGet", params: {} })
|
|
121
|
+
```
|
|
122
|
+
Returns the current BASIC program text from the editor.
|
|
123
|
+
|
|
124
|
+
**Edit program (find and replace):**
|
|
125
|
+
```
|
|
126
|
+
emma_command({ command: "basicProgramEdit", params: { oldText: "text to find", newText: "replacement text" } })
|
|
127
|
+
```
|
|
128
|
+
Find and replace specific text in the program.
|
|
129
|
+
|
|
130
|
+
**Set program (replace all):**
|
|
131
|
+
```
|
|
132
|
+
emma_command({ command: "basicProgramSet", params: { program: "full program text" } })
|
|
133
|
+
```
|
|
134
|
+
Replace the entire program with new content.
|
|
135
|
+
|
|
136
|
+
### Breakpoint and Debugging Operations
|
|
137
|
+
|
|
138
|
+
**List all breakpoints:**
|
|
139
|
+
```
|
|
140
|
+
emma_command({ command: "basicProgramListBreakpoints", params: {} })
|
|
141
|
+
```
|
|
142
|
+
Returns an array of all breakpoints currently set, including line number, statement index, enabled state, and type (line or statement). Each breakpoint entry includes:
|
|
143
|
+
- lineNumber: The BASIC line number
|
|
144
|
+
- statementIndex: -1 for whole line, 0+ for specific statement
|
|
145
|
+
- enabled: true if breakpoint is active
|
|
146
|
+
- type: "line" for whole-line breakpoints, "statement" for statement-level breakpoints
|
|
147
|
+
|
|
148
|
+
**Set a breakpoint on a BASIC line:**
|
|
149
|
+
```
|
|
150
|
+
emma_command({ command: "basicProgramSetBreakpoint", params: { lineNumber: 20 } })
|
|
151
|
+
```
|
|
152
|
+
Sets a whole-line breakpoint that will pause execution when that line is reached. Use lineNumber parameter to specify which line. Optional statementIndex parameter (default: -1 for whole line, 0+ for specific statement within a multi-statement line).
|
|
153
|
+
|
|
154
|
+
**Remove a breakpoint:**
|
|
155
|
+
```
|
|
156
|
+
emma_command({ command: "basicProgramUnsetBreakpoint", params: { lineNumber: 20 } })
|
|
157
|
+
```
|
|
158
|
+
Removes a breakpoint from the specified line. Use lineNumber parameter to specify which line. Optional statementIndex parameter (default: -1 for whole line, 0+ for specific statement).
|
|
159
|
+
|
|
160
|
+
**Step to next BASIC line:**
|
|
161
|
+
```
|
|
162
|
+
emma_command({ command: "basicProgramStepNext", params: {} })
|
|
163
|
+
```
|
|
164
|
+
When paused at a breakpoint, steps execution to the next BASIC line. Returns the previous and current line numbers. The emulator must be paused at a BASIC breakpoint for this to work. Clears the breakpoint hit flag and advances execution by one line.
|
|
165
|
+
|
|
166
|
+
**Get current line number:**
|
|
167
|
+
```
|
|
168
|
+
emma_command({ command: "basicProgramGetCurrentLine", params: {} })
|
|
169
|
+
```
|
|
170
|
+
Returns the current BASIC line number if stopped at a breakpoint, or undefined if not stopped. Useful for checking execution state. Returns:
|
|
171
|
+
- lineNumber: Current line number (or undefined if not at breakpoint)
|
|
172
|
+
- message: Description of current state
|
|
173
|
+
|
|
174
|
+
### Variable Inspection and Modification
|
|
175
|
+
|
|
176
|
+
**Get all BASIC variables:**
|
|
177
|
+
```
|
|
178
|
+
emma_command({ command: "basicProgramGetVariables", params: {} })
|
|
179
|
+
```
|
|
180
|
+
Returns all BASIC variables currently in memory, including both simple variables and arrays. Each simple variable includes:
|
|
181
|
+
- name: Variable name (e.g., "X", "A$", "COUNT%")
|
|
182
|
+
- type: "real", "integer", or "string"
|
|
183
|
+
- value: Raw value
|
|
184
|
+
- formattedValue: Formatted for display
|
|
185
|
+
|
|
186
|
+
Arrays include:
|
|
187
|
+
- name: Array name
|
|
188
|
+
- type: Variable type
|
|
189
|
+
- dimensions: Array dimensions (e.g., [10] for single dimension, [5, 10] for two dimensions)
|
|
190
|
+
- totalElements: Total number of elements
|
|
191
|
+
- values: Flat array of all element values
|
|
192
|
+
|
|
193
|
+
**Set a BASIC variable value:**
|
|
194
|
+
```
|
|
195
|
+
emma_command({ command: "basicProgramSetVariable", params: { name: "X", value: 42 } })
|
|
196
|
+
```
|
|
197
|
+
Sets a BASIC variable to a new value. The variable must already exist in memory (created by the running program). Parameters:
|
|
198
|
+
- name: Variable name (e.g., "X", "A$", "COUNT%")
|
|
199
|
+
- value: New value (number or string)
|
|
200
|
+
|
|
201
|
+
Returns the old and new values. Works with:
|
|
202
|
+
- Real numbers: `{ name: "X", value: 3.14 }`
|
|
203
|
+
- Integers: `{ name: "COUNT%", value: 100 }`
|
|
204
|
+
- Strings: `{ name: "A$", value: "HELLO" }` (quotes optional)
|
|
205
|
+
|
|
206
|
+
Note: This modifies variables in place in memory. The program must have already declared the variable (e.g., via assignment).
|
|
207
|
+
|
|
208
|
+
## Overview
|
|
209
|
+
|
|
210
|
+
The basic-program window displays BASIC programs currently loaded in memory. It automatically detects whether the program is Applesoft BASIC or Integer BASIC and detokenizes it for viewing.
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
## Features
|
|
214
|
+
|
|
215
|
+
### Code Editor
|
|
216
|
+
|
|
217
|
+
Large editable text area displaying the BASIC program with:
|
|
218
|
+
- Line numbers automatically shown
|
|
219
|
+
- Syntax highlighting for BASIC keywords
|
|
220
|
+
- Full editing capabilities (type, copy/paste, edit)
|
|
221
|
+
- Line and character count at bottom
|
|
222
|
+
|
|
223
|
+
### Control Buttons
|
|
224
|
+
|
|
225
|
+
**Run**: Execute the BASIC program in the emulator
|
|
226
|
+
**Pause**: Pause program execution
|
|
227
|
+
**Step**: Step through program line by line
|
|
228
|
+
|
|
229
|
+
### Status Indicators
|
|
230
|
+
|
|
231
|
+
- **IDLE**: Shows current execution state
|
|
232
|
+
- **LINE**: Current line number being executed (--- when idle)
|
|
233
|
+
- **PTR**: Memory pointer address ($---- when idle)
|
|
234
|
+
|
|
235
|
+
### Variables Panel
|
|
236
|
+
|
|
237
|
+
Right sidebar showing:
|
|
238
|
+
- List of active BASIC variables and their current values
|
|
239
|
+
- Shows "No variables" when program not running or no variables defined
|
|
240
|
+
|
|
241
|
+
### Breakpoints Panel
|
|
242
|
+
|
|
243
|
+
Right sidebar with tabs:
|
|
244
|
+
- **Breakpoints**: Set line number breakpoints for debugging
|
|
245
|
+
- **Line #**: Enter line number to break on
|
|
246
|
+
- **+** button: Add breakpoint
|
|
247
|
+
- Info button for breakpoint details
|
|
248
|
+
- Shows "No breakpoints" when none are set
|
|
249
|
+
|
|
250
|
+
### Action Buttons
|
|
251
|
+
|
|
252
|
+
**Load from Memory**: Read BASIC program currently in emulator memory and display in editor
|
|
253
|
+
**Load into Emulator**: Send program from editor into emulator memory
|
|
254
|
+
**Format**: Auto-format the BASIC program
|
|
255
|
+
**Renumber**: Renumber program lines (typically by 10s)
|
|
256
|
+
**New**: Clear the editor and start a new program
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Disk Drives
|
|
2
|
+
|
|
3
|
+
> Floppy disk drive management for the Disk II controller (slot 6).
|
|
4
|
+
|
|
5
|
+
## Tool Operations
|
|
6
|
+
|
|
7
|
+
**Show the window:**
|
|
8
|
+
```
|
|
9
|
+
showWindow("disk-drives")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Hide the window:**
|
|
13
|
+
```
|
|
14
|
+
hideWindow("disk-drives")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Focus the window:**
|
|
18
|
+
```
|
|
19
|
+
focusWindow("disk-drives")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Insert disk image by path:**
|
|
23
|
+
```
|
|
24
|
+
emma_command({ command: "driveInsertDisc", params: { driveNum: 1, path: "/path/to/disk.dsk" } })
|
|
25
|
+
```
|
|
26
|
+
Insert a disk image into drive 1 or 2 by providing a file path. The driveNum parameter defaults to 1 if not specified. The path can be a local filesystem path (with ~ expansion) or URL.
|
|
27
|
+
|
|
28
|
+
**Get list of recent disks:**
|
|
29
|
+
```
|
|
30
|
+
emma_command({ command: "driveRecentsList", params: { driveNum: 1 } })
|
|
31
|
+
```
|
|
32
|
+
Get the list of recently used disks for drive 1 or 2. Returns an array of disk entries with filename and access time. The driveNum parameter defaults to 1 if not specified.
|
|
33
|
+
|
|
34
|
+
**Clear recent disks:**
|
|
35
|
+
```
|
|
36
|
+
emma_command({ command: "drivesClearRecent", params: { driveNum: 1 } })
|
|
37
|
+
```
|
|
38
|
+
Clear all recent disks for drive 1 or 2. Removes all entries from the recent list for that drive. The driveNum parameter defaults to 1 if not specified.
|
|
39
|
+
|
|
40
|
+
**Insert a recent disk:**
|
|
41
|
+
```
|
|
42
|
+
emma_command({ command: "driveInsertRecent", params: { driveNum: 1, name: "ProDOS_2_4_2.dsk" } })
|
|
43
|
+
```
|
|
44
|
+
Insert a disk from the recent disks list into drive 1 or 2. The name parameter must match a filename from the recent list. The driveNum parameter defaults to 1 if not specified.
|
|
45
|
+
|
|
46
|
+
**Load a recent disk:**
|
|
47
|
+
```
|
|
48
|
+
emma_command({ command: "driveLoadRecent", params: { driveNum: 1, file: "ProDOS_2_4_2.dsk" } })
|
|
49
|
+
```
|
|
50
|
+
Load a disk from the recent disks list into drive 1 or 2. The file parameter must match a filename from the recent list. The driveNum parameter defaults to 1 if not specified.
|
|
51
|
+
|
|
52
|
+
**Eject a disk:**
|
|
53
|
+
```
|
|
54
|
+
emma_command({ command: "diskDriveEject", params: { driveNum: 1 } })
|
|
55
|
+
```
|
|
56
|
+
Eject the disk from drive 1 or 2. Removes the disk image from the drive and updates the UI to show the drive as empty. The driveNum parameter defaults to 1 if not specified. If no disk is inserted, returns success with a message indicating the drive is already empty.
|
|
57
|
+
|
|
58
|
+
## Overview
|
|
59
|
+
|
|
60
|
+
The disk-drives window manages 5.25" floppy disk images for Drive 1 and Drive 2.
|
|
61
|
+
|
|
62
|
+
## Supported Formats
|
|
63
|
+
|
|
64
|
+
| Format | Extension | Description |
|
|
65
|
+
|--------|-----------|-------------|
|
|
66
|
+
| DSK | .dsk | Raw sector-order disk image (140KB). Most common format. DOS 3.3 logical order. |
|
|
67
|
+
| DO | .do | Identical to DSK format. Extension explicitly indicates DOS 3.3 sector ordering. |
|
|
68
|
+
| PO | .po | ProDOS-order disk image (140KB). Sectors in ProDOS physical order. |
|
|
69
|
+
| NIB | .nib | Nibblised disk image (232,960 bytes). Raw GCR-encoded data as it appears on disk surface. |
|
|
70
|
+
| WOZ | .woz | Bit-level disk image with timing and metadata. Most accurate format for copy-protected disks. |
|
|
71
|
+
|
|
72
|
+
See /wiki/Disk-Drives.md for complete details on disk formats and operations.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# File Explorer
|
|
2
|
+
|
|
3
|
+
> Browse and read files from DOS 3.3 and ProDOS disk images.
|
|
4
|
+
|
|
5
|
+
## Tool Operations
|
|
6
|
+
|
|
7
|
+
**Show the window:**
|
|
8
|
+
```
|
|
9
|
+
showWindow("file-explorer-window")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Hide the window:**
|
|
13
|
+
```
|
|
14
|
+
hideWindow("file-explorer-window")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Focus the window:**
|
|
18
|
+
```
|
|
19
|
+
focusWindow("file-explorer-window")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**List files in a drive:**
|
|
23
|
+
```
|
|
24
|
+
emma_command({ command: "listDiskFiles", params: { drive: 0 } })
|
|
25
|
+
```
|
|
26
|
+
Lists all files on the disk in the specified drive (0 for drive 1, 1 for drive 2). Returns file catalog with filenames, types, sizes, and format (DOS 3.3 or ProDOS). Format the results as a table for the user, not as raw JSON.
|
|
27
|
+
|
|
28
|
+
**Get file content from disk:**
|
|
29
|
+
```
|
|
30
|
+
emma_command({ command: "getDiskFileContent", params: { drive: 0, filename: "HELLO", isBinary: true } })
|
|
31
|
+
```
|
|
32
|
+
Reads a file from the disk. Set `isBinary: false` for text files to get plain text content, or `isBinary: true` (default) for binary files to get base64-encoded data. For ProDOS, can use full path like "SUBDIR/FILE". Text files (TXT, BAS) should use `isBinary: false`.
|
|
33
|
+
|
|
34
|
+
**Save disk file to local filesystem (MCP tool):**
|
|
35
|
+
```
|
|
36
|
+
save_disk_file({ path: "~/Documents/file.bin", contentBase64: "<base64 data>", overwrite: false })
|
|
37
|
+
```
|
|
38
|
+
Saves file content to the local filesystem. Content must be base64 encoded (as returned by getDiskFileContent). Supports ~ for home directory.
|
|
39
|
+
|
|
40
|
+
## Workflow Examples
|
|
41
|
+
|
|
42
|
+
**Reading and displaying a text file:**
|
|
43
|
+
1. List files: `listDiskFiles({ drive: 0 })`
|
|
44
|
+
2. Get text content: `getDiskFileContent({ drive: 0, filename: "README", isBinary: false })`
|
|
45
|
+
3. Display the `content` field directly to the user
|
|
46
|
+
|
|
47
|
+
**Saving a binary file to local filesystem:**
|
|
48
|
+
1. List files: `listDiskFiles({ drive: 0 })`
|
|
49
|
+
2. Get binary content: `getDiskFileContent({ drive: 0, filename: "HELLO", isBinary: true })`
|
|
50
|
+
3. Save locally: `save_disk_file({ path: "~/file.bin", contentBase64: result.contentBase64 })`
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# SmartPort Hard Drives
|
|
2
|
+
|
|
3
|
+
> SmartPort hard drive image management for devices 1 and 2.
|
|
4
|
+
|
|
5
|
+
## Tool Operations
|
|
6
|
+
|
|
7
|
+
**Show the window:**
|
|
8
|
+
```
|
|
9
|
+
showWindow("hard-drives")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Hide the window:**
|
|
13
|
+
```
|
|
14
|
+
hideWindow("hard-drives")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Focus the window:**
|
|
18
|
+
```
|
|
19
|
+
focusWindow("hard-drives")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**List SmartPort-compatible slots:**
|
|
23
|
+
```
|
|
24
|
+
emma_command({ command: "smartportListSlots", params: {} })
|
|
25
|
+
```
|
|
26
|
+
Lists compatible expansion slots (2, 4, 5, 7) with current occupant and whether SmartPort is installed. Use this to find an available slot before installing.
|
|
27
|
+
|
|
28
|
+
**Install SmartPort card into a slot:**
|
|
29
|
+
```
|
|
30
|
+
emma_command({ command: "smartportInstallCard", params: { slot: 7 } })
|
|
31
|
+
```
|
|
32
|
+
Installs the SmartPort card into the specified slot. Replaces any existing card in that slot. Triggers an emulator reset. Compatible slots: 2, 4, 5, 7. The SmartPort card must be installed before images can be loaded.
|
|
33
|
+
|
|
34
|
+
**Insert SmartPort image by path:**
|
|
35
|
+
```
|
|
36
|
+
emma_command({ command: "smartportInsertImage", params: { deviceNum: 1, path: "/path/to/image.hdv" } })
|
|
37
|
+
```
|
|
38
|
+
Insert a SmartPort hard drive image into device 1 or 2 by providing a file path. The deviceNum parameter defaults to 1 if not specified.
|
|
39
|
+
|
|
40
|
+
**Get list of recent images:**
|
|
41
|
+
```
|
|
42
|
+
emma_command({ command: "smartportRecentsList", params: { deviceNum: 1 } })
|
|
43
|
+
```
|
|
44
|
+
Get the list of recently used images for device 1 or 2. Returns an array of image entries with filename and access time. The deviceNum parameter defaults to 1 if not specified.
|
|
45
|
+
|
|
46
|
+
**Insert a recent image:**
|
|
47
|
+
```
|
|
48
|
+
emma_command({ command: "smartportInsertRecent", params: { deviceNum: 1, name: "Total Replay.hdv" } })
|
|
49
|
+
```
|
|
50
|
+
Insert an image from the recent list into device 1 or 2. The name parameter must match a filename from the recent list. The deviceNum parameter defaults to 1 if not specified.
|
|
51
|
+
|
|
52
|
+
**Clear recent images:**
|
|
53
|
+
```
|
|
54
|
+
emma_command({ command: "smartportClearRecent", params: { deviceNum: 1 } })
|
|
55
|
+
```
|
|
56
|
+
Clear all recent images for device 1 or 2. The deviceNum parameter defaults to 1 if not specified.
|
|
57
|
+
|
|
58
|
+
**Eject a SmartPort image:**
|
|
59
|
+
```
|
|
60
|
+
emma_command({ command: "smartportEject", params: { deviceNum: 1 } })
|
|
61
|
+
```
|
|
62
|
+
Eject the hard drive image from device 1 or 2. Removes the image from the device and updates the UI to show the device as empty. The deviceNum parameter defaults to 1 if not specified. Requires the SmartPort card to be installed.
|
|
63
|
+
|
|
64
|
+
**Load SmartPort image from filesystem (MCP tool):**
|
|
65
|
+
```
|
|
66
|
+
load_smartport_image({ path: "~/images/prodos.hdv" })
|
|
67
|
+
```
|
|
68
|
+
Load a SmartPort image file from the local filesystem and return as base64. Supports ~ for home directory.
|
|
69
|
+
|
|
70
|
+
## Supported Formats
|
|
71
|
+
|
|
72
|
+
| Format | Extension | Description |
|
|
73
|
+
|--------|-----------|-------------|
|
|
74
|
+
| HDV | .hdv | Raw block device image. Most common SmartPort format. |
|
|
75
|
+
| PO | .po | ProDOS-order block image. |
|
|
76
|
+
| 2IMG | .2mg | Universal disk image with metadata header. |
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
The SmartPort card must be installed in a compatible expansion slot before images can be loaded. Use `smartportListSlots` to check, and `smartportInstallCard` to install if needed. Installing or changing slot configuration triggers an emulator reset.
|