mu/shell
Kartik K. Agaram 143cce94ee support for arrow keys
Mu's keyboard handling is currently a bit of a mess, and this commit might
be a bad idea.

Ideally keyboards would return Unicode. Currently Mu returns single bytes.
Mostly ASCII. No support for international keyboards yet.

ASCII and Unicode have some keyboard scancodes grandfathered in, that don't
really make sense for data transmission. Like backspace and delete. However,
other keyboard scancodes don't have any place in Unicode. Including arrow keys.

So Mu carves out an exception to Unicode for arrow keys. We'll place the
arrow keys in a part of Unicode that is set aside for implementation-defined
behavior (https://en.wikipedia.org/wiki/C0_and_C1_control_codes#C1_controls):

  0x80: left arrow
  0x81: down arrow
  0x82: up arrow
  0x83: right arrow

The order is same as hjkl for mnemonic convenience. I'd _really_ to follow
someone else's cannibalization here. If I find one later, I'll switch to
it.

Applications that blindly assume the keyboard generates Unicode will have
a bad time. Events like backspace, delete and arrow keys are intended to
be processed early and should not be in text.

With a little luck I won't need to modify this convention when I support
international keyboards.
2021-04-05 22:37:27 -07:00
..
README.md bochs support for disk drives 2021-03-23 21:53:41 -07:00
cell.mu 7862 - shell: more informative traces for eval 2021-03-07 10:55:11 -08:00
evaluate.mu . 2021-04-05 19:41:46 -07:00
gap-buffer.mu support for arrow keys 2021-04-05 22:37:27 -07:00
grapheme-stack.mu 7866 2021-03-07 19:46:21 -08:00
main.mu . 2021-03-28 08:36:03 -07:00
parse.mu 7866 2021-03-07 19:46:21 -08:00
print.mu 7866 2021-03-07 19:46:21 -08:00
read.mu 7849 - shell: literal numbers 2021-03-04 22:05:39 -08:00
sandbox.mu shell: clean up unimplemented menu items 2021-04-05 19:46:47 -07:00
tokenize.mu strip spaces when tokenizing 2021-03-08 17:54:07 -08:00
trace.mu support for arrow keys 2021-04-05 22:37:27 -07:00
vimrc.vim 7842 - new directory organization 2021-03-03 22:21:03 -08:00

README.md

A prototype shell for the Mu computer

Currently runs a tiny subset of Lisp. Steps to run it from the top-level:

  1. Build it:
$ ./translate shell/*.mu      # generates disk.img
  1. Run it:
$ qemu-system-i386 disk.img

or:

$ bochs -f bochsrc

To save typing in a large s-expression, create a secondary disk for data:

$ dd if=/dev/zero of=data.img count=20160

Load an s-expression into it:

$ echo '(+ 1 1)' |dd of=data.img conv=notrunc

Now run with both code and data disks:

$ qemu-system-i386 -hda disk.img -hdb data.img

or:

$ bochs -f bochsrc.2disks

You can type in expressions, hit ctrl-s to see their results, and hit Tab to focus on the ... below and browse how the results were computed. Here's a demo. The bottom of the screen shows context-dependent keyboard shortcuts (there's no mouse in the Mu computer at the moment).

Known issues

  • There's no way to save to disk.

  • Don't press keys too quickly (such as by holding down a key). The Mu computer will crash (and often Qemu will segfault).