diff --git a/README.md b/README.md index e6bcba2..c825d6e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # C64 Livecoding demo -WIP +Livecoding a Commodore 64 in a language compiled on a modern PC written via an editor running on a VT220. + +## Editor + +In a real hardware setup, the editor, which is integrated with the compiler, runs the show. In this setup, running it is simple. Running it interactively is almost as simple. + +To first enter an environment in which the editor can be easily loaded, enter Lisp using the command `ros run -- --load asdf-paths.lisp`. Then load the editor by typing `(asdf:load-system "editor")`. The editor can now be started by typing `(editor:main "/dev/")` where `` is the terminal you wish to have the editor run on. This is most likely `/dev/ttyUSB0`, but may be something like `/dev/pts/3` if you're testing without a real VT220. **If the host program is likely to change during the editor process's life time**, add `:refresh-asm-functions-p t` to the call to `EDITOR::MAIN`, after the terminal path. This will ensure it reads the host program's listing before each compile to find the addresses of built-in functions. + +The editor should now run. Keybindings will eventually be listed, but for now the source code is the canonical list of bindings. + +The editor will, when the *compile* command is issued, perform a compilation, write statistics and IR to standard output, save both the source code and 6502 binary to the current working directory, then attempt to upload the code to the C64 via a serial device on `/dev/ttyACM0`. This path should ideally not change, but if the need arises, it can be changed simply be changing the variable `USC::*C64-TTY*`. In the event this transfer fails to begin, for example if the serial device is missing, a warning is printed to standard output, but the editor does not display anything. Saved files are unaffected by a failed transfer. diff --git a/editor/binary-build.lisp b/editor/binary-build.lisp index 40a8db4..2453307 100644 --- a/editor/binary-build.lisp +++ b/editor/binary-build.lisp @@ -8,16 +8,16 @@ open it, check which pts it's running on using \"ps\", run a command like \"clear; while true; do sleep 1000;done\", then start the editor in another terminal giving the pts as a command-line parameter.~%")) -(defun main (&rest arguments) +(defun main (tty &key refresh-asm-functions-p) (format t "C64 Livecoding editor, v~A~%" #.(asdf:component-version (asdf:find-system '#:user-side-compiler))) - (let ((tty (and (first arguments) - (probe-file (first arguments))))) + (let ((tty (probe-file tty))) (unless tty (batch-help) (abort)) (let ((*terminal-path* tty)) (make-editor)) + (setf *refresh-asm-functions-p* refresh-asm-functions-p) (editor-loop))) (defun batch-main ()