;****************************************************************
;*                                                              *
;*           FREEDOM 100 AlphaCALC TERMINAL TABLE               *
;*                                                              *
;*                            by                                *
;*                                                              *
;*        ULTRASCIENCE DIVISION OF GIBBS LABORATORIES           *
;*                                                              *
;*              Copyright Ultrascience 1984 (C)                 *
;*                                                              *
;*           1824 WILMETTE AVE, WILMETTE, IL 60091              *
;*                                                              *
;*                       312/256-0080                           *
;*                                                              *
;*              REV. 4.12  LAST UPDATE 10/01/84                 *
;*                                                              *
;****************************************************************
;
; IMPORTANT MESSAGE:
;
; THIS PROGRAM OR ANY PART OF THIS PROGRAM MAY NOT BE COPIED FOR
; PROFIT BY ANYONE OTHER THAN ULTRASCIENCE.    ANYONE WISHING TO
; USE THE PROGRAM MAY DO SO AT NO CHARGE,  PROVIDED  THEY NOTIFY
; ULTRASCIENCE THAT THEY ARE USING THE PROGRAM AND AGREE TO SEND
; INFORMATION ABOUT BUGS OR IMPROVEMENTS TO ULTRASCIENCE.   THIS
; BUG AND IMPROVEMENT INFORMATION WILL BE AVAILABLE TO ALL USERS
; OF THE PROGRAM.
;
;   The character directory table has an entry for every character in the
; ASCII table (from 1 to 127). There are also extra entries after the
; 127 th and these are used for function key handling. The unshifted
; function keys start at 128 and extend to 137 while the shifted function.
; keys start at 160 and go up to 169. The above is true only for the unlabeled
; function keys (F1-F10). The labeled functions are scattered over the rest
; of the table and do not follow any pattern. As can be seen, characters which
; do not require translation have an 'N' as their table entry. By finding
; label N: in the program it can be seen that it contains a null word which
; means that the character does not get translated. If it is desired to
; re-define a character simply replace the original pointer with a new
; label and put the replacement string at the label. It is possible to
; set up the table so that pressing one character may cause AlphaCalc to
; output a pre-defined string of characters. The only thing to remember
; is to place a null at the end of the string.
;   If character "A" is to be re-defined in order to output a string
; such as "OP" the following steps are to be executed:
;   Find entry location in the table for "A" (ASCII 65). It is the 65 th
; entry in the table. Change the null pointer 'N' with a new label (anything
; up to 6 chrs.) let's call it ADEF. The replacement string may be located
; anywhere AFTER the entry table. When a spot has been selected the following
; line should be typed in:
;
; ADEF: BYTE    'O,'P,0,0
;
; Note however that the word ADEF: should begin in the first column and the
; semicolon (;) must NOT be used.
; Once this is done just execute M68.LIT on it and it should be ready to
; go (if it is in DSK0:[7,0] and it has the terminal driver's name). To
; test it just go into AlphaCalc (no need to re-boot the system) and press
; "A". Instead of an "A" you should get an "OP". The other keys can be
; re-defined the same way.
; NOTE: If the number of bytes in the re-defined string is even it must be
; followed by two nulls but if it is odd only one null should be used. Since
; the string "OP" contains an even number of bytes it was followed by two
; nulls.
;  If you want to re-define a character to output a control code you can put
; the ASCII value for it instead of a character but do not use the leading
; apostrophe. If you wanted to re-define "A" to a ^B (control B) you could
; change "'O,'P,0,0" to "2,0" or "'B-100,0". As you can see, subtracting
; 100 (octal) from a character makes it a control character.
;
;   The reason that the function keys are not located in the table where they
; should be is because the terminal driver converts them. For example, pressing
; f1 normally causes the terminal to send an "@". That's what happens out of
; AlphaCalc but if the terminal driver sees that the user is running AlphaCalc
; it converts the function keys. Pressing any function key (labeled or
; unlabeled) causes the driver to add 128 to the value so pressing f1 normally
; sends a "@" (ASCII 64) but the driver steps it up to ASCII 192. At this
; point if the function was an unlabeled function (f1-f10,F1-F10) it gets
; stepped down by 64 so that f1 gets converted to ASCII 128, f2 = ASCII 129,
; etc. Labeled function keys do not get stepped down. This conversion is made
; so that function keys will not be confused with regular character (f1 is not
; the same as "@"). This way the replacement table can convert f1 to something
; and "@" to something else without any connection between the two.

       OBJNAM  FRE100.CAX
       LWORD   0

; *** BEGINNING OF ENTRY TABLE ***

; No conversions on regular characters
       WORD    N,N,N,N,N,N,N,N,N,TT,N,N,N,N,N,N,N      ; 0-16
       WORD    CQ,N,N,N,N,N,N,CX,N,SH,N,N,N,N,N,N      ; 17-32 (SPACE)
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N         ; 33-48
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N         ; 49-64 ("@")
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N         ; "A"-"P"
       WORD    N,N,N,N,N,N,N,N,N,N                     ; "Q"-"Z"
       WORD    N,N,N,N,N,AP                            ; 91-96  [,\,],^,-,`
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N         ; "a"-"p"
       WORD    N,N,N,N,N,N,N,N,N,N                     ; "q"-"z"
       WORD    N,N,N,TD,N                              ; 123-127
; Unshifted function keys (f1-f10)
       WORD    e1,e2,e3,e4,e5,e6,e7,e8,e9,e10
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
; Shifted function keys (F1-F10)                        ; 240-251 oct
       WORD    F1,F2,F3,F4,F5,F6,F7,F8,F9,F10
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
; Labeled function keys
       WORD    N,N,N,N,N,N,N,N,N,N,N,IL,N,N,N,ST,N     ; 272-312 oct
       WORD    N,SP,N,N,N,PP,IC,DL,N,EL,N,N,DC,N,EP,N  ; 313-332 oct
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N         ; 333-352
       WORD    N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
       WORD    N,N,N,N,N
; *** END OF ENTRY TABLE ***

;       DATA REPLACEMENTS

; NULLS USED FOR NON-TRANSLATIONS
N:      WORD    0

; FUNCTION KEY TRANSLATION

; Unshifted
E1:     BYTE    33,'E,0         ; EDIT
E2:     BYTE    '\-100,0        ; AUTO ADVANCE
E3:     BYTE    33,'X,0         ; EXECUTE
E4:     BYTE    33,'C,0         ; BLOCK COPY
E5:     BYTE    33,'Q,0         ; BLOCK CLEAR
E6:     BYTE    33,'[,0         ; SCREEN LEFT
E7:     BYTE    'E-100,0        ; SCREEN LAST (End of Worksheet (Shift HOME))
E8:     BYTE    'T-100,0        ; SCREEN NEXT
E9:     BYTE    'N-100,0        ; Shift Right Arrow (END OF LINE)
E10:    BYTE    'W-100,0        ; NEXT WORD
; Shifted
F1:     BYTE    33,33,0         ; CANCEL / MENU
F2:     BYTE    33,'\-100,0     ; AUTO EDIT
F3:     BYTE    33,'R,0         ; RECOMPUTE
F4:     BYTE    33,37,0         ; BLOCK ERASE
F5:     BYTE    'P-100,0        ; BLOCK MARK
F6:     BYTE    33,'],0         ; SCREEN RIGHT
F7:     BYTE    'S-100,0        ; SCREEN CENTER
F8:     BYTE    'R-100,0        ; SCREEN PREVIOUS
F9:     BYTE    'U-100,0        ; Shift Left Arrow (BEG. OF LINE)
F10:    BYTE    'A-100,0        ; PREVIOUS WORD

; PRE-LABELED KEY TRANSLATION

CX:     BYTE    33,'p,0         ; PROTECT CELL (^X)
CQ:     BYTE    33,'?,0         ; HELP, QUERY (^Q)
SH:     BYTE    'E-100,0        ; END OF FILE (Shift HOME)
EL:     BYTE    33,'Y-100,0     ; ERASE ROW (CLR EOL)
EP:     BYTE    33,'V-100,0     ; ERASE COLUMN (CLR EOP)
IL:     BYTE    'B-100,0        ; ROW INSERT (INS LINE)
DL:     BYTE    'Z-100,0        ; ROW DELETE (DEL LINE)
IC:     BYTE    'F-100,0        ; INSERT CHARACTER (CHR INS)
DC:     BYTE    'D-100,0        ; DELETE CHARACTER (CHR DEL)
SP:     BYTE    33,'D-100,0     ; COLUMN DELETE (Shift PRINT)
PP:     BYTE    33,'F-100,0     ; COLUMN INSERT (PRINT)
TT:     BYTE    33,'I,0         ; LOCK ROW (TAB)
ST:     BYTE    33,'L,0         ; LOCK COLUMN (Shift TAB)
AP:     BYTE    33,'B,0         ; BORDER ROW (`)
TD:     BYTE    33,'b,0         ; BORDER COLUMN (~)
       EVEN
       WORD    0

;                   Function Keys Defined As:
;
;  Shifted Functions            Unshifted functions
;
;  F1  - CANCEL                 f1  - EDIT
;  F2  - AUTO EDIT              f2  - AUTO ADVANCE
;  F3  - RECOMPUTE              f3  - EXECUTE
;  F4  - BLOCK ERASE            f4  - BLOCK COPY
;  F5  - BLOCK MARK             f5  - BLOCK CLEAR
;  F6  - SCREEN RIGHT           f6  - SCREEN LEFT
;  F7  - SCREEN CENTER          f7  - SCREEN LAST
;  F8  - SCREEN PREVIOUS        f8  - SCREEN NEXT
;  F9  - BEGGINING OF LINE      f9  - END OF LINE
;  F10 - PREVIOUS WORD          f10 - NEXT WORD
;
;  Freedom 100 Key -   AlphaCALC function
;
;  ^Q ................ HELP
;  ^X ................ PROTECT CELL
;  CHR INS ........... INSERT CHRACTER
;  CHR DEL ........... DELETE CHARACTER
;  LINE INS .......... INSERT ROW
;  LINE DEL .......... DELETE ROW
;  CLR EOP ........... ERASE COLUMN
;  CLR EOL ........... ERASE ROW
;  PRINT ............. COLUMN INSERT
;  Shift PRINT ....... COLUMN DELETE
;  TAB ............... LOCK COLUMN
;  Shift TAB ......... LOCK ROW
;  ` ................. BORDER ROW
;  ~ ................. BORDER COLUMN

       END