Add editor start scripts

This commit is contained in:
John Lorentzson 2025-07-29 11:57:56 +02:00
parent 5a7cf8f7c4
commit 47e189f709
4 changed files with 49 additions and 3 deletions

View file

@ -6,8 +6,8 @@ Livecoding a Commodore 64 in a language compiled on a modern PC written via an e
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. 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/<the tty device>")` where `<the tty device>` 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. If you have Roswell installed, running the editor can be done by running one of the two start scripts, `run-editor-real.ros` for situations where the host program will not change, and `run-editor-preview.ros` for situations where it may. These are run like any other script from the shell. The scripts must be given a parameter in the form `/dev/<the tty device>` where `<the tty device>` 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.
The editor should now run. Keybindings will eventually be listed, but for now the source code is the canonical list of bindings. The editor should now run. Keybindings will eventually be listed, but for now the source code is the canonical list of bindings. A *clear screen* command is required before anything will show on the display.
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. 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.

View file

@ -11,7 +11,7 @@ terminal giving the pts as a command-line parameter.~%"))
(defun main (tty &key refresh-asm-functions-p) (defun main (tty &key refresh-asm-functions-p)
(format t "C64 Livecoding editor, v~A~%" (format t "C64 Livecoding editor, v~A~%"
#.(asdf:component-version (asdf:find-system '#:user-side-compiler))) #.(asdf:component-version (asdf:find-system '#:user-side-compiler)))
(let ((tty (probe-file tty))) (let ((tty (or (ignore-errors (probe-file tty)) nil)))
(unless tty (unless tty
(batch-help) (batch-help)
(abort)) (abort))

23
run-editor-preview.ros Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
(when (member :asdf3 *features*)
(asdf:initialize-source-registry
'(:source-registry (:tree :here)
:inherit-configuration)))
#-quicklisp (error "Quicklisp must be available to your Roswell install.")
#+quicklisp (ql:quickload '() :silent t)
#+quicklisp (ql:quickload '#:editor :silent t))
(defpackage :ros.script.run-editor-preview.3962771665
(:use :cl))
(in-package :ros.script.run-editor-preview.3962771665)
(defun main (&rest argv)
(declare (ignorable argv))
(editor:main (first argv) :refresh-asm-functions-p t))
;;; vim: set ft=lisp lisp:

23
run-editor-real.ros Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
(when (member :asdf3 *features*)
(asdf:initialize-source-registry
'(:source-registry (:tree :here)
:inherit-configuration)))
#-quicklisp (error "Quicklisp must be available to your Roswell install.")
#+quicklisp (ql:quickload '() :silent t)
#+quicklisp (ql:quickload '#:editor :silent t))
(defpackage :ros.script.run-editor-real.3962771235
(:use :cl))
(in-package :ros.script.run-editor-real.3962771235)
(defun main (&rest argv)
(declare (ignorable argv))
(editor:main (first argv) :refresh-asm-functions-p nil))
;;; vim: set ft=lisp lisp: