Loading Terminal Function Keys - Examples

Description

Example

Resets the fifth function key to the default value. The "0" invokes the reset function and the CHR(4) specifies the fifth function key. (Function key numbers are zero based.)

1000 PRINT 'FL',"0"+CHR(4),

Resets all function keys to their defaults.

1000 PRINT 'FL',"1",

Reads the value loaded into function key 4. Upon completion, A$ contains the text loaded in function key 4

0900 OPEN (1) FID(0)
1000 PRINT (1)'FL',"4"+CHR(3)
1010 READ RECORD(1,SIZ=1)A$
1020 IF A$<>$00$ THEN READ RECORD(1,SIZ=ASC(A$))A$

Loads the string "END" into function key 10. After execution, function key 10 will transmit the ASCII sequence "END" followed by a carriage return.

1000 PRINT 'FL',"2"+CHR(9)+CHR(4)+"END"+$0D$,

Reads the label for the first edit key. After execution, the string variable A$ will contain the first edit key label.

0900 OPEN (1) FID(0)
1000 PRINT 'EL',"6"+CHR(0),
1010 READ RECORD(1,SIZ=1)A$
1020 IF A$<>$00$ THEN READ RECORD(1,SIZ=ASC(A$))A$

Reads all the values for the edit key set. Upon exit, the numeric variable KEYS contains the number of edit keys and the string array KEYS$ contains the keys and the loaded values. KEYS$[KEY,0] contains the key number and length of loaded text and KEYS$[KEY,1] contains the key text. If the function were changed to a "7", this would load the KEYS$ array with the edit key labels. If the 'EL' mnemonic in line 1010 were changed to an 'FL' mnemonic, this would read the function key load data.

1000 REM 1000 "read load key set into KEYS$[]
1010 LET CH=UNT; OPEN (CH)FID(0); PRINT 'CI'+'EL'+"5",
1020 READ RECORD(CH,SIZ=1)A$
1030 LET KEYS=ASC(A$); IF KEYS=0 THEN GOTO 1100
1040 DIM KEYS$[KEYS,1]
1050 FOR KEY=0 TO KEYS-1
1060 READ RECORD(CH,SIZ=2)KEYS$[KEY,0]
1070 LET LEN=ASC(KEYS$[KEY,0](2))
1080 IF LEN>0 THEN READ RECORD(CH,SIZ=LEN)KEYS$[KEY,1]
1090 NEXT KEY
1100 CLOSE (CH)

Reloads the edit keys using the data returned from the previous function.

1200 REM 1200"load the edit keys using KEYS$[]
1210 PRINT 'EL'+"0",
1220 IF KEYS=0 THEN GOTO 1260
1230 FOR KEY=0 TO KEYS-1
1240 PRINT 'EL'+"2"+KEYS$[KEY,0]+KEYS$[KEY,1],
1250 NEXT KEY

Saves and restores the function key settings by an alternate method to the previous example.

1000 REM 1000"save the function key setting in KEYS$
1010 LET CH=UNT; OPEN(CH)FID(0); PRINT 'CI'+'EL'+"5",
1020 READ RECORD(CH,SIZ=1)KEYS$
1030 IF KEY$=$00$ THEN GOTO 1090
1040 FOR KEY=0 TO ASC(KEYS$)-1
1050 READ RECORD(CH,SIZ=2)TEMP$;LET KEYS$=KEYS$+TEMP$
1060 LEN=ASC(TEMP$(2))
1070 IF LEN READ RECORD(CH,SIZ=LEN)TEMP$;LET
1070:KEYS$=KEYS$+TEMP$
1080 NEXT KEY
1090 RETURN
1200 REM 1200"load the edit keys using KEYS$
1210 PRINT 'EL'+"3"+KEYS$,