;; ------------------------------------------------------------------ ;; The Machine-Human Interface (BIOS) (define abort (lambda (x) (error 'abort "undefined"))) (define walk (lambda () (call-with-current-continuation (lambda (k) (set! abort k) (set-pc! 0) (shell))))) (define shell (local ((define install (lambda (value) (if (value? value) (begin (set-mem! (get-pc) value) (print-cell (get-pc)) (newline) (get&inc-pc)) (printf "Warning: not a command!~n"))))) (lambda () (begin (print-cell (get-pc)) (printf " % ") ; input prompt (local ([define command (read)]) (cond ((cons? command) (install (assemble command))) ((number? command) (install command)) ((symbol? command) ((find-command command the-command-list))) (else (default-action)))) (shell))))) (define find-command (lambda (command command-list) (local ((define r (assq command command-list))) (if r (entry-action r) default-action)))) (define entry-action caddr) (define entry-description cadr)