Newsgroups: comp.sys.apple2,comp.sys.apple2.programmer
Path: blue.weeg.uiowa.edu!news.uiowa.edu!uunet!comp.vuw.ac.nz!actrix.gen.nz!dempson
From: dempson@actrix.gen.nz (David Empson)
Subject: Re: Caps lock on Extended Keyboard
Message-ID: <CuKxBJ.7rw@actrix.gen.nz>
Followup-To: comp.sys.apple2.programmer
Organization: Actrix Information Exchange
References: <32f95v$p7c@nyx.cs.du.edu> <CuFLu8.5tn@crash.cts.com> <CuI974.KBK@actrix.gen.nz> <CuJAp6.CGJ@crash.cts.com>
Date: Mon, 15 Aug 1994 13:54:54 GMT
Lines: 91
Xref: blue.weeg.uiowa.edu comp.sys.apple2:74669 comp.sys.apple2.programmer:2941

In article <CuJAp6.CGJ@crash.cts.com>,
Randy Shackelford <shack@crash.cts.com> wrote:
> In article <CuI974.KBK@actrix.gen.nz>,
> David Empson <dempson@actrix.gen.nz> wrote:
> >
> >Are you saying that the "AppleDesign" extended keyboard works properly
> >on a ROM 3?  This is the new el-cheapo extended keyboard.
> 
> Whatzat? It hasn't been very long since I've been to a dealer or looked at
> mail order ads in Mac rags and I ain't come across it. Are you sure it's not
> some New Zealand thing? :)

Nope (it might be an Australian thing, though - New Zealand is
effectively a subsidiary of Australia as far as Apple is concerned).

As far as I know, there are currently only two keyboards available
from Apple (in NZ, anyway): the "AppleDesign" extended keyboard and the
split-level one (whatever it is called).  The AppleDesign keyboard is a
lot cheaper (like about half the price) compared to the Extended
Keyboard and Extended Keyboard II.

I haven't actually seen one yet, but they have been mentioned a few
times on my user group's BBS.

> I just recently got an extended II for my Mac. I had been making do with a
> standard II which doesn't go with a Quadra too well. I have an original
> standard keyboard on the ROM 3 - it has the same layout as the IIgs kbd,
> but has full size keys and a much nicer feel. I tried the extended kbd
> on it but I already knew it worked great. So while we're talking about
> lights, how do you light up num lock and scroll lock on the extended?

The original "standard keyboard" has the same feel as the original
"extended keyboard", and both are excellent keyboards (IMHO).  I have
the original "extended keyboard" on my ROM 3, and a IIgs keyboard on
my ROM 1.  Guess which one I prefer typing on?  :-)

Yes, I do know how to control the lights in the extended keyboard.  It
is a matter of reading one of the keyboard registers using the ADB
toolset and writing the value back with the appropriate bits modified.

According to my notes, it is register 2.  Use the transmit2ADBBytes
call to set the register.  Courtesy of the Macintosh Family Hardware
Reference, here is the full definition of this register for an extended
keyboard:

Bit     Key or LED
15      None (reserved)
14      Delete
13      Caps Lock
12      Reset
11      Control
10      Shift
9       Option
8       Command (Apple)
7       Num Lock/Clear
6       Scroll Lock
5-3     None (reserved)
2       LED 3 (Scroll Lock)
1       LED 2 (Caps Lock)
0       LED 1 (Num Lock)

A bit value of 0 indicates the key is pressed or the LED is on.  I'm
not sure if the key state bits are read only or read/write, but I
believe they are read-only (I did most of my ADB experimentation back
in 1989, so I don't remember the details, but my notes imply they are
read only).

Note that the registers are in "big-endian" order, i.e. the high order
byte is sent FIRST when transmitting data.  I think they are in the
opposite order when receiving.  My test program uses AsyncADBReceive
to do a "Talk Register 2".  The LED bits are returned in the first
byte.  It then toggles each bit and uses SendInfo to trasmit the data
back to the keyboard, after swapping the bytes (i.e. send them in the
reverse order from which they are received).

You can use the "Listen Register 2" command, or "transmit2ADBBytes" to
send data to the keyboard (via SendInfo).


I wrote a simple "caps lock light" utility back in 1989, when I got my
extended keyboard (on the ROM 1 at that stage).  It worked by polling
the Caps Lock key from a heartbeat interrupt (looking at the keyboard
modifier register at $C025), and writing to register 2 in the keyboard
if Caps Lock changed state.


Followups are being directed to comp.sys.apple2.programmer.
-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand
