[comp.sys.handhelds] New and improved Soft Keys

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

OK, I've rewritten the Soft Keys program.  It now fits in 86 bytes (or as
low as 51 bytes) instead of 208 bytes.  It also uses shift and alpha
combinations.

----

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.  A good suggestion
for the [SOFT] key is [BLUE]-[UP].

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.a \>> aa.a \<< program for key #bb.b \>> bb.b ... }

where aa.a, bb.b are the standard key addresses (see p. 217).

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] [up]:

  'keys' 25.3 ASN

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

  [blue] [KASN] 25.1 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..."      @ You can remove the "..." 1 DISP if you like
1 DISP KLIST DUP 0
WAIT POS 1 -
  IFERR GET
  THEN DROP2
  ELSE EVAL
  END
\>>

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

@ Here's part of my KLIST.  Use as a base.
%%HP: T(3)A(D)F(.);
{
\<< ASC\->
\>> 11.1
\<< SEND
\>> 41.1
\<< -49 FS?
  IF
  THEN -50 CF -49
CF
  ELSE -50 SF -49
SF -45 SF -46 SF
-47 CF -48 CF
  END
\>> 15.1             @ Toggle floating and 3 place engineering modes
\<< -63 FC?C
  IF
  THEN -63 SF
"Active" 1 DISP 1
FREEZE
  END
\>> 44.1             @ Toggle vectored enter
\<< -40 FC?C
  IF
  THEN -40 SF
  END
\>> 72.1             @ Toggle time (the clock)
\<< MAIN FUN CHIP
2 MENU
\>> 21.1             @ Go to my games directory
\<< PUSHD
\>> 24.2
\<< POPD
\>> 24.3
\<< PICT STO { }
PVIEW
\>> 34.1             @ View the GROB (_P_icture) on level 1
\<< BYTES SWAP DROP
\>> 12.1             @ How big is it?
\<< MAIN TEMP 2 MENU
\>> 42.1             @ Go to TEMPorary directory
\<< DUP CRDIR EVAL
\>> 14.1 }           @ Create and go to new subdirectory



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.

Thanks to Jan Brittenson and John Paul Morrison.
 -------  _/__/   -----------------------------------------------------
        _|  ___|    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
 ----  |__|/_|   ------------------------------------------------------