diff --git a/recipes/rc2014/ps2/Makefile b/recipes/rc2014/ps2/Makefile deleted file mode 100644 index a4eed73..0000000 --- a/recipes/rc2014/ps2/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -PROGNAME = ps2ctl -AVRDUDEMCU ?= t45 -AVRDUDEARGS ?= -c usbtiny -P usb -TARGETS = $(PROGNAME).hex os.bin -BASEDIR = ../../.. -ZASM = $(BASEDIR)/emul/zasm/zasm -KERNEL = $(BASEDIR)/kernel -APPS = $(BASEDIR)/apps - -# Rules - -.PHONY: send all clean - -all: $(TARGETS) - @echo Done! - -send: $(PROGNAME).hex - avrdude $(AVRDUDEARGS) -p $(AVRDUDEMCU) -U flash:w:$(PROGNAME).hex - -$(PROGNAME).hex: $(PROGNAME).asm - avra -o $@ $(PROGNAME).asm - -os.bin: glue.asm - $(ZASM) $(KERNEL) $(APPS) < glue.asm > $@ - -clean: - rm -f $(TARGETS) *.eep.hex *.obj os.bin diff --git a/recipes/rc2014/ps2/README.md b/recipes/rc2014/ps2/README.md index 7ba292f..8392d9b 100644 --- a/recipes/rc2014/ps2/README.md +++ b/recipes/rc2014/ps2/README.md @@ -61,10 +61,23 @@ probably have gone the flip-flop way. Seems more solid. ## Using the PS/2 interface -After having built and flashed the `glue.asm` supplied with this recipe, you end -up with a shell driven by the PS/2 keyboard (but it still outputs to ACIA). +To use this interface, you have to build a new Collapse OS binary. We'll use +the xcomp unit from the base recipe and modify it. -There are still a few glitches, especially at initialization or at connect and -disconnect, but it otherwise works rather well! +First, we need a `(ps2kc)` routine. In this case, it's easy, it's +`: (ps2kc) 8 PC@ ;`. Add this after ACIA loading. Then, we can load PS/2 +subsystem. You add `411 414 LOADR`. Then, at initialization, you add `PS2$` +after `ACIA$`. You also need to define `PS2_MEM` at the top. You can probably +use `RAMSTART + 0x7a`. + +Rebuild, reflash, should work. For debugging purposes, you might not want to +go straight to plugging PS/2 `(key)` into the system. What I did myself was +to load the PS/2 subsystem *before* ACIA (which overrides with its own `(key)`) +and added a dummy word in between to access PS/2's key. + +Also (and this is a TODO: investigate), I had a problem where the break key I +got from `(ps2kc)` was 0x70 instead of 0xf0 which had the effect of duplicating +all my keystrokes. I added a 0x70 -> 0xf0 replacement in my version of +`(ps2kc)`. Does the trick (at the cost of a non-functional numpad 0). [avra]: https://github.com/hsoft/avra diff --git a/recipes/rc2014/ps2/glue.asm b/recipes/rc2014/ps2/glue.asm deleted file mode 100644 index 55b1c04..0000000 --- a/recipes/rc2014/ps2/glue.asm +++ /dev/null @@ -1,59 +0,0 @@ -.equ RAMSTART 0x8000 -.equ RAMEND 0xffff -.equ ACIA_CTL 0x80 ; Control and status. RS off. -.equ ACIA_IO 0x81 ; Transmit. RS on. -.equ KBD_PORT 0x08 - -jp init - -.inc "err.h" -.inc "ascii.h" -.inc "core.asm" -.inc "str.asm" -.equ ACIA_RAMSTART RAMSTART -.inc "acia.asm" - -.equ KBD_RAMSTART ACIA_RAMEND -.inc "kbd.asm" - -.equ STDIO_RAMSTART KBD_RAMEND -.equ STDIO_GETC kbdGetC -.equ STDIO_PUTC aciaPutC -.inc "stdio.asm" - -; *** BASIC *** - -; RAM space used in different routines for short term processing. -.equ SCRATCHPAD_SIZE STDIO_BUFSIZE -.equ SCRATCHPAD STDIO_RAMEND -.inc "lib/util.asm" -.inc "lib/ari.asm" -.inc "lib/parse.asm" -.inc "lib/fmt.asm" -.equ EXPR_PARSE parseLiteralOrVar -.inc "lib/expr.asm" -.inc "basic/util.asm" -.inc "basic/parse.asm" -.inc "basic/tok.asm" -.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE -.inc "basic/var.asm" -.equ BUF_RAMSTART VAR_RAMEND -.inc "basic/buf.asm" -.equ BAS_RAMSTART BUF_RAMEND -.inc "basic/main.asm" - -init: - di - ld sp, RAMEND - im 1 - - call aciaInit - call kbdInit - call basInit - ei - jp basStart - -KBD_FETCHKC: - in a, (KBD_PORT) - ret -