[comp.sys.handhelds] Soft Keys Application

jthornto@fs1.ee.ubc.ca (THORNTON JOHAN A) (11/19/90)

This is my "Soft Keys" application.

The ability to redefine keys on the 48SX is invaluable.  But many users
quickly find themselves out of keys - there are only so many keys you
"don't really need."  That's where Soft Keys come in.  By redefining only
one key to run the KEYS program, it doesn't tie up user keys while
allowing the whole keyboard to be given new functionality.  I chose
[blue] [NXT] as the hot key; it's not used for anything anyways.

The KEYS program needs KLIST, which contains a list of programs and their
assigned "soft keys".  The format for KLIST is essentially the same as for
the built in user key assignments:

 { \<< program for key #aa \>> aa \<< program for key #bb \>> bb ... }

where aa, bb are the standard key addresses (11 for [A], 21 for [G] etc.).
without the decimal alpha-shift notation - note that shift combinations are
not possible (except that they could link into another level of key
definitions); in fact, the shift and alpha keys are valid soft keys.

The KASN program is similar to the ASN command.  It takes a program in level
2 and a key address in level 1.  You can also edit and store (or visit) KLIST.

The program makes no attempt at sorting the keys, or removing duplicate
key definitions.  That's your duty.  Also, it'll probably crash if you
screw up while editing KLIST.  Error checking takes too much memory.

INSTALLATION:  Put KEYS, KASN and KLIST in your HOME directory.  Then
define the KEYS program to [blue] [NXT]:

  'keys' 26.3 ASN

Alternately, put the program on the stack ([blue] [KEYS]), do 26.3 ASN, and
then purge KEYS.  Then you can recall KASN and soft-define it to K:

  [blue] [KASN] 25 KASN

and purge KASN.  Then the only thing you need in the HOME directory is KLIST.

Make sure you're always in user mode.

Have fun.



@ KEYS - the soft key program
%%HP: T(3)A(D)F(.);
\<<
"Press soft key..."
1 DISP                          @ tell 'em the program is running.  Removable.
  WHILE KEY NOT
  REPEAT                        @ wait till key pressed
  END 0 0 \-> k i j             @ put key# in K, create local vars i,j
  \<< KLIST OBJ\-> 'i'          @ 2*(# keys in list) into i
STO
    WHILE i                     @ loop ...
    REPEAT 'i' 2                @ i:=i-2
STO- k ==
      IF
      THEN 'j' STO              @ program stored in j
i DROPN 0 'i' STO               @ clear rest of stack, exit loop
j EVAL                          @ run specified program
      ELSE DROP                 @ no matching key
      END
    END
  \>>
\>>


@ KASN - key assign
%%HP: T(3)A(D)F(.);
\<< SWAP 'KLIST' SWAP
STO+ 'KLIST' SWAP
STO+
\>>


@ Here's part of my KLIST.  Use as a base.
%%HP: T(3)A(D)F(.);
{
\<< ASC\->
\>> 11                          @ A: ASC\->
\<< SEND
\>> 41                          @ S: SEND
\<< -49 FS?
  IF
  THEN -50 CF -49
CF
  ELSE -50 SF -49
SF -45 SF -46 SF
-47 CF -48 CF
  END                           @ E: Toggle between 3 decimal place
\>> 15                          @ engineering mode and floating point modes
\<< -63 FC?C
  IF
  THEN -63 SF
"Active" 1 DISP 1
FREEZE
  END
\>> 44                          @ V: Toggle vectored enter mode
\<< -40 FC?C
  IF
  THEN -40 SF
  END
\>> 72                          @ 4 (time): Toggle clock
\<< MAIN FUN CHIP
\>> 21                          @ G: Go to [my] CHIP games directory
\<< PUSHD
\>> 71                          @ orange shift: PUSHD (see prev. posting)
\<< POPD
\>> 81                          @ blue shift: POPD
\<< PICT STO { }
PVIEW                           @ P: View a GROB (_P_icture)
\>> 34
\<< BYTES SWAP DROP             @ B: How big is it (checksum is DROPped)
\>> 12
\<< MAIN TEMP                   @ T: Go to temporary (junk) directory
\>> 42 }


All the stuff about not being responsible if this program causes your
corporation to go bankrupt, bridges to fall down and robots go on a
murdering rampage applies.


 -------  _/__/   -----------------------------------------------------
        _|  ___|    E l e c t r i c a l      |  Johan Thornton, Esq.
       | | |_/     E n g i n E E r i n g     |-------------------------
       |/|  __|     U n i v e r s i t y      |  jthornto@fs1.ee.ubc.ca
       |-| |/__     o f   B r i t i s h      |-------------------------
       | |_____|      C o l u m b i a        |   This space for rent
 ----  |__|/_|   ------------------------------------------------------