Skip to content

Correcting the UK APL*PLUS/PC Kbd

Vector 3:1, page 102

system interfaces user interfaces

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 102

Hacker’s Corner (2)

by Adrian Smith

One of the few minor niggles with APL*PLUS/PC is the way the keyboard reverts to the US version when you shift out of APL mode. This moves a couple of keys round, and (more importantly) leaves you without a £ sign.

Before you start poking around in the key definitions, you need a little function to show you what the current settings are:

     R←MODE SEE KEY;TAB
     ------------------
[1]   ⍝DISPLAY CURRENT KEY DEFINITIONS
[2]   ⍝NOTE THAT <MODE> DEFAULTS TO ALL 6 DEFINITIONS.
[3]   ⍝
[4]    ⍎(0=⎕NC 'MODE')/'MODE←0 1 2 3 4 5'
[5]    TAB←256⊥⎕PEEK 198 197
[6]    R←⎕AV[1+⎕PEEK TAB+MODE∘.+8×KEY-1]
     ∇

The relevant key numbers (row by row, left to right) are:

STANDARD PC PC/AT
NOS: 1+⍳12 41,(1+⍳12),43
QW : 15+⍳12 15+⍳12
AS : 29+⍳12 29+⍳11
ZX : 42+⍳11 43+⍳10

To set the text keyboard to match the keytops (and get diamond back where you expect it on the PC/AT) you should:

82 KB∆SET ⎕AV[178 49 178 69 49 178]       ⍝SHOP DEFNS ON <INS> KEY

40 41 3 4 KB∆SET ⎕AV[2 4⍴40 36 51 52, 65 127 35 157]    ... PC

41 3 4 40 KB∆SET ⎕AV[2 4⍴93 51 52 40, 125 35 157 65]
43        KB∆SET '£~⋄⋄'                                  ... PC/AT
     R←KEY KB∆SET DEFN;MODE;TAB
     --------------------------
[1]   ⍝REPLACE CURRENT KEY DEFINITIONS WITH TABLE SUPPLIED.
[2]   ⍝
[3]   ⍝ <KEY>  IS A VECTOR OF KEY NUMBERS.
[4]   ⍝ <DEFN> IS A MATRIX OF CHARS WITH AS MANY COLS AS THERE
[5]   ⍝        ARE ELEMENTS IN <KEY>. EACH ROW REDEFINES:
[6]   ⍝
[7]   ⍝                     1) LOWER CASE TEXT
[8]   ⍝                     2) UPPER CASE TEXT
[9]   ⍝                     4) LOWER CASE APL
[10]  ⍝                     5) UPPER CASE APL
[11]  ⍝                     6) ALT-SHIFT APL
[12]  ⍝ ACDS NOVEMBER 1985
[13]  ⍝
[14]   MODE←0,⍳¯1+1↑⍴DEFN
[15]   TAB←256⊥⎕PEEK 198 197
[16]   R←(¯1+⎕AV⍳DEFN)⎕POKE TAB+MODE∘.+8×KEY-1
[17]   R←'KEYS REDEFINED .... ',,⍉DEFN,[1] ' '
     ∇

Of course this opens up lots of interesting ideas. How about saving some Alt-shifts by copying grade-up and grade-down on to shifted A and W? Maybe transpose could find another home on shift-X? I would certainly like to get the brackets and punctuation back where they belong; on a PC which is mainly used for Lotus and WP, the last thing I want is stickers which ruin the feel of the keyboard and confuse everyone else.

Why not have a go . . . find the layout which best suits your way of working, and then we can all have a jolly good barney about it at APL-86!