Subject: Re: Caps lock on Extended Keyboard
From: [email-masked] (David Empson)
Date: Mon, 15 Aug 1994 13:54:54 GMT
Newsgroups: comp.sys.apple2,comp.sys.apple2.programmer

In article <[email-masked]>,
Randy Shackelford <[email-masked]> wrote:
> In article <[email-masked]>,
> David Empson <[email-masked]> 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
[email-masked]
Snail mail: P.O. Box 27-103, Wellington, New Zealand