A JavaScript emulator for the laser310 computer by Leonardo Miliani.
Open the emulator directly in your browser: laser310-emu
- prg files (
.prg
) are plain files that are loaded in memory as-is
Dragging & dropping a file on the emulator's window causes the file to be loaded.
Once a file is loaded, it's also stored on the browser cache so that you don't have
to drag&drop it again; you can use the load()
function from the JavaScript console.
These are the commands you can type from the JavaScript console (F12 key):
load("file.prg" [,start])
loads a file at the specified addresssave("file.prg" [,start, end])
saves a filedownload("file.prg")
gets the file as a browser downloadremove("file.prg")
remove file from browser's cachedir()
lists files on browser's cachepaste(text)
paste a string of text (e.g. containing a BASIC program) via the laser310 serial line
You can plug your own Javascript debug functions by defining
debugBefore()
and debugAfter(elapsed)
in the JavaScript console.
debugBefore
is executed before any Z80 instruction; debugAfter
is executed
after.
To activate the debug mode use sys_set_debug(true)
and sys_set_debug(false)
to deactivate it. Within the debug functions you can access all the emulator variables,
most likely you'll want to read the Z80 state with cpu.getState()
or the memory content
with mem_read()
and mem_write()
.
To select a different firmware than the latest one, use the querystring parameter
rom
, e.g.:
https://nippur72.github.io/laser310-emu?rom=314
to start with firmware named "laser310-firmware-r314.rom"
The emulator can be used in cross-development allowing to automate the process of loading and executing the program being developed. This will save lot of annoying drag&drops.
To enable "autoload":
- clone the emulator on your local machine (it won't work in the online-version because of browser restrictions)
- in your compile chain (
make
etc..), copy the binary you want to execute in the emulator directory naming itautoload.bin
- execute
node makeautoload
, this will turnautoload.bin
into JavaScript code (autoload.js
). - refresh the browser, the program will be loaded in memory and make it RUN
When you no longer want the file to be autoloaded, delete autoload.bin
and run again node makeautoload
.