[comp.sys.apple] Keyboard buffering on //c, enhanced //e

mackay@dalcsug.UUCP (Daniel MacKay) (03/30/88)

Hello, net.apple.land!

I bought my _//c Technical Reference Manual_ a couple of months ago,
and while flipping through the index looking for something else, 
(Buttons, I think probably) was surprised to see Buffering, Keyboard.

Now keyboard buffering (or lack thereof) on the Apple // has always grated
on me; to me any real computer should have a healthy keyboard buffer to
increase productivity.  My pal's Apple /// has a keyboard buffer
(implemented in the OS, I believe) that works great.  So it was a bit of a
surprise to learn that my little //c had the ability to keyboard
buffer up to 128 chars, built into firmware.  I flipped to the relevant 
page, and since I was then working on a project in FORTH, I turned on 
the keyboard buffering in the FORTH (so that at least that environment 
would have it).

I THINK you should be able to turn it on from AppleSloth but I'm not
sure. It's really simple.  All you do is disable interrupts (while 
you're fiddling with the interrupts), drop some $ 80s into some 
locations, mask out one little nibble, and turn the interrupts back on.  

Here's what the FORTH code looks like:

: KB-BUF-PTRS	     \  Enable keyboard buffering & set the buf ptrs.
  $ 80		     \ 
      DUP $ 5FA C!   \  Turn on buffering.
      DUP $ 5FF C!   \
          $ 6FF C! ; \  Set the pointers into buffer

CODE INT-ON  CLI, NEXT JMP, END-CODE \ enable all interrupts
CODE INT-OFF SEI, NEXT JMP, END-CODE \ disable all interrupts

: KB-ON INT-OFF KB-BUF-PTRS          \ turn on keyboard buffering
  $ C0AA DUP C@ $ F OR SWAP C! INT-ON ;

: KB-OFF INT-OFF KB-BUF-PTRS         \ turn it back off.;
  $ C0AA DUP C@ $ F0 AND SWAP C! INT-ON ;

The last two words, KB-ON and KB-OFF, of course do all the work.  

It works just great on my FORTH.  It is really nice to be able to type
the next command while the machine's thinking about the last one.

You can try this one at home, kiddies!
---
+---------+				Dalhousie University
|    _    |     From the		Halifax, Nova Scotia
|   (_)===|     Disk of ...		Canada
|         |      Daniel		mackay@dalcsug.UUCP
+---------+			...{utai,uunet}!dalcs!dalcsug!mackay