Feature/lua scripting#167
Merged
Merged
Conversation
53909de to
c532ef7
Compare
…ng on_start() method.
Make script engine lifecycle start before emulator is started. New coroutine wait option "yield" not tied to emulator is generating frames.
…in a reasonable number of instructions, and will then log error and disable them.
…visible in the UI with status Disabled.
…engine than MoonSharp will be used in the future.
… not tied to any specific Lua engine to Highbyte.DotNet6502.Systems library.
…ability to open that folder in OS file browser, and refresh all of them.
…ead and persist data.
…lies to desktop).
Move Lua example scripts to common directory.
…Lua script when app is started
f54e540 to
9cc9b35
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add Lua scripting support
Adds a Lua scripting engine to the emulator, exposed in the Avalonia Desktop and Browser host apps. Scripts run as coroutines alongside the emulator and can read/write CPU registers and memory, inject input, observe emulator state, and control the emulator lifecycle — enabling automation, TAS-style input playback, and in-emulator tooling without modifying the core.
Scripting model
Two styles can be mixed in a single script:
while true do … emu.frameadvance() end— reads like a sequential program, suspends on each frameon_before_frame(),on_started(),on_stopped(), etc.) called at specific emulator lifecycle pointsPowered by MoonSharp, with AOT-compatible configuration for the WASM/Browser target.
Lua API surface
emu.start/pause/stop/reset/select/quit(),emu.config_valid()emu.state(),emu.framecount(),emu.time(),emu.selected_system/variant()cpu.*mem.read(addr)/mem.write(addr, val)— routes through the same address decoding as the emulated CPUinput.key_press,input.joystick_set, etc.)http.*(works in both Desktop and Browser)file.*read/write with configurable base-directory sandboxing (Desktop only)tcp.*(Desktop only, opt-in)localStoragein BrowserC64-specific integrations
.d64disk images at runtimeHost app integration
Desktop:
appsettings.json)--script <file>CLI argument to load and run a single script on startup (useful for CI/automation pipelines)Browser:
localStoragestoreAPI backed bylocalStorageinstead of the filesystemScripts tab UI
Both apps show a Scripts tab with live status for all loaded scripts:
Configuration
All behaviour is controlled via
appsettings.jsonunderHighbyte.DotNet6502.Scripting: master enable switch, script directory, per-feature allow-flags (AllowFileIO,AllowHttpRequests,AllowTcpClient,AllowStore), execution warning threshold, and runaway-script instruction limit.