Home » CEEFAX disks » telesoftware1.adl » Utils/TOKEN6

Utils/TOKEN6

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware1.adl
Filename: Utils/TOKEN6
Read OK:
File size: 10A6 bytes
Load address: 1900
Exec address: 8023
File contents
   10REM ***************************
   20REM * TOKEN6: Two stroke      *
   30REM * keyword entry for       *
   40REM * BBC Micro OS 1.2        *
   45REM * Version 1.1 (telesoft)  *
   50REM * Last Updated: 20-Oct-86 *
   55REM * by Gavin Haines         *
   57REM * Not Second Processor    *
   60REM *************************** 
   65 REM
   70 START%=&900 :REM RS423 buffer 
   80OSNEWL%=&FFE7
   90OSBYTE%=&FFF4
  100RDCHV%=&210
  110VL%=?RDCHV%
  120VH%=RDCHV%?1
  130OSRDCH%=VL%+256*VH% 
  140ACC=&70
  150xsav=&71
  160ysav=&72
  170REM ----- assembler
  180FOR PASS%=0 TO 2 STEP 2
  190P%=START%
  200[OPT PASS%
  210.start
  220     LDA #TRAP MOD 256 \connect this routine 
  230     STA RDCHV%        \to the keyboard vector, 
  240     LDA #TRAP DIV 256               
  250     STA RDCHV%+1
  260     RTS
  270.save
  280     STA ACC
  290     STY ysav
  300     STX xsav
  310     RTS
  320.restore
  330     LDA ACC
  340     LDX xsav
  350     LDY ysav
  360     RTS
  370 .error
  380     LDA #&7D
  390     JSR OSBYTE%
  400 .escape
  410     JSR restore
  420     RTS
  430.TRAP                    \BASIC calls here to get a character
  440     JSR save
  450     JSR OSRDCH%
  460     BCS error
  470     CMP #&1B
  480     BEQ escape 
  490     CMP #9              \TAB key down?
  500     BNE EXIT            \No, branch, output char in normal way
  510.KBD CLC                 \just a precaution
  520     JSR OSRDCH%         \get next character
  530     BCS error
  540     CMP #&5F            \is it in the range A-Z?
  550     BCS KBD
  560     CMP #&3F
  570     BCC EXIT
  580.index CLC               \must clear the carry before doing subtraction
  590     SBC #&40            \form index into table of tokens
  600     TAX
  610     LDA token,X         \pick up token (in DATA statement below)
  620     JSR decrunch        \turn token into keyword
  630     LDA #0              \turn TAB character into a null character
  640.EXIT                    \so that we will be able to backspace OK.
  650     CLC                 \signal valid character
  660     RTS                 \goes back to caller, i.e. BASIC
  670.decrunch                \ ***** Tokens to keywords routine
  680     JSR save            \must save X and Y registers, or else.
  690     STA &37             \index to table of keywords
  700     CMP #&80            \is character a token?
  710     BCC insert          \no, branch.  
  720     LDA #&6D            \index into keyword
  730     STA &38
  740     LDA #&80
  750     STA &39
  760     STY &3A
  770.tok1 LDY #&00
  780.tok2 INY
  790     LDA (&38),Y          \pick up character
  800     BPL tok2
  810     CMP &37
  820     BEQ loop1
  830     INY
  840     TYA
  850     SEC
  860     ADC &38
  870     STA &38
  880     BCC tok1
  890     INC &39
  900     BCS tok1
  910.loop1 LDY #&00
  920.loop2 LDA (&38),Y
  930     BMI endtok
  940     JSR insert           \put character into keyboard buffer
  950     INY
  960     BNE loop2
  970.endtok LDY &3A           \end of token decrunch routine
  980     RTS
  990.insert                   \character in the Accumulator
 1000     JSR save
 1010     PHA
 1020     LDA &23              \is COUNT greater than WIDTH? 
 1030     CMP &1E
 1040     BCS OK
 1050     JSR OSNEWL%          \Yes, send a newline
 1060     LDA #0
 1070     STA &1E              \initialize COUNT
 1080.OK
 1090     PLA
 1100     INC &1E
 1110     LDX #0
 1120     TAY
 1130     LDA #&8A 
 1140     JSR OSBYTE%          \insert character
 1150     LDX xsav             \restore X and Y as a precaution
 1160     LDY ysav
 1170     RTS                  \back to caller. 
 1180.token
 1190] 
 1200NEXT PASS%
 1210REM ----- Enter tokens
 1220FOR L%=P% TO P%+28
 1230READ T$
 1240T%=EVAL("&"+T$ )
 1250?L%=T%
 1260NEXT
 1270DATAC6,CC,FB,DF,8B,E3,E5,9D,E8,B2,D7,C9,EB,ED,CB,F0,EA,F9,88,8C,FD,EF,F7,F2,F5,E0,C8,CD,F1,E2,E8 
 1280REM ------------------
 1290 CALL start
 1296 CLS
 1300 REM --- Test routine.  Prints out keywords Delete from working program
 1305 DIM A$(28)
 1306 VDU21
 1310 FOR A%=65 TO 93
 1315 *FX138,0,13  
 1320 CALL index:INPUT A$
 1327 A$(A%-65)=A$  
 1330 NEXT A%
 1334 *FX138,0,13   
 1335 *FX15,0
 1336 VDU6
 1337 PRINT''"Try TAB and then another key"  
 1338 PRINT
 1339 PRINT  
 1340 FOR I=1 TO 14
 1350 PRINT CHR$(I+64),A$(I),CHR$(I+78),A$(I+14)   
 1360 NEXT 
 1380 PRINT
 1390 PRINT"(Pressing BREAK key stops it.)"
 1400REM ****************************
 1410REM * Details in The BBC Micro *
 1420REM * and Electron Book or SAE *
 1430REM * (at least 4" x 9 ") to:- *
 1440REM * G. Haines, 43 Cornwallis *
 1450REM * Gardens, Hastings, East  *
 1460REM * Sussex, TN34 1LX.        *
 1470REM ****************************

!� ***************************
!� * TOKEN6: Two stroke      *
!� * keyword entry for       *
(!� * BBC Micro OS 1.2        *
-!� * Version 1.1 (telesoft)  *
2!� * Last Updated: 20-Oct-86 *
7!� * by Gavin Haines         *
9!� * Not Second Processor    *
<"� *************************** 
A �
F! START%=&900 :� RS423 buffer 
POSNEWL%=&FFE7
ZOSBYTE%=&FFF4
dRDCHV%=&210
nVL%=?RDCHV%
xVH%=RDCHV%?1
�OSRDCH%=VL%+256*VH% 
�ACC=&70
�xsav=&71
�ysav=&72
�� ----- assembler
�� PASS%=0 � 2 � 2
�
P%=START%
�[OPT PASS%
�
.start
�/     LDA #TRAP � 256 \connect this routine 
�4     STA RDCHV%        \to the keyboard vector, 
�'     LDA #TRAP � 256               
�     STA RDCHV%+1
     RTS
	.save
     STA ACC
"     STY ysav
,     STX xsav
6     RTS
@.restore
J     LDA ACC
T     LDX xsav
^     LDY ysav
h     RTS
r .error
|     LDA #&7D
�     JSR OSBYTE%
� .escape
�     JSR restore
�     RTS
�A.TRAP                    \BASIC calls here to get a character
�     JSR save
�     JSR OSRDCH%
�     BCS error
�     CMP #&1B
�     BEQ escape 
�+     CMP #9              \TAB key down?
�C     BNE EXIT            \No, branch, output char in normal way
�/.KBD CLC                 \just a precaution
0     JSR OSRDCH%         \get next character
     BCS error
5     CMP #&5F            \is it in the range A-Z?
&     BCS KBD
0     CMP #&3F
:     BCC EXIT
DK.index CLC               \must clear the carry before doing subtraction
N=     SBC #&40            \form index into table of tokens
X     TAX
bB     LDA token,X         \pick up token (in � statement below)
l5     JSR decrunch        \turn token into keyword
vF     LDA #0              \turn TAB character into a null character
�F.EXIT                    \so that we will be able to backspace OK.
�4     CLC                 \signal valid character
�=     RTS                 \goes back to caller, i.e. BASIC
�?.decrunch                \ ***** Tokens to keywords routine
�C     JSR save            \must save X and Y registers, or else.
�8     STA &37             \index to table of keywords
�3     CMP #&80            \is character a token?
�+     BCC insert          \no, branch.  
�0     LDA #&6D            \index into keyword
�     STA &38
�     LDA #&80
�     STA &39
�     STY &3A
.tok1 LDY #&00

.tok2 INY
0     LDA (&38),Y          \pick up character
      BPL tok2
*     CMP &37
4     BEQ loop1
>     INY
H     TYA
R     SEC
\     ADC &38
f     STA &38
p     BCC tok1
z     INC &39
�     BCS tok1
�.loop1 LDY #&00
�.loop2 LDA (&38),Y
�     BMI endtok
�A     JSR insert           \put character into keyboard buffer
�     INY
�     BNE loop2
�<.endtok LDY &3A           \end of token decrunch routine
�     RTS
�;.insert                   \character in the Accumulator
�     JSR save
�     PHA
�4     LDA &23              \is � greater than �? 
     CMP &1E
     BCS OK
2     JSR OSNEWL%          \Yes, send a newline
$     LDA #0
.+     STA &1E              \initialize �
8.OK
B     PLA
L     INC &1E
V     LDX #0
`     TAY
j     LDA #&8A 
t/     JSR OSBYTE%          \insert character
~>     LDX xsav             \restore X and Y as a precaution
�     LDY ysav
�/     RTS                  \back to caller. 
�
.token
�] 
�� PASS%
�� ----- Enter tokens
�� L%=P% � P%+28
�� T$
�T%=�("&"+T$ )
�
?L%=T%
��
�b�C6,CC,FB,DF,8B,E3,E5,9D,E8,B2,D7,C9,EB,ED,CB,F0,EA,F9,88,8C,FD,EF,F7,F2,F5,E0,C8,CD,F1,E2,E8 
� ------------------

 � start
 �
I � --- Test routine.  Prints out keywords Delete from working program

 � A$(28)
 �21
 � A%=65 � 93
# *FX138,0,13  
( � index:� A$
/ A$(A%-65)=A$  
2	 � A%
6 *FX138,0,13   
7 *FX15,0
8 �6
9( �''"Try TAB and then another key"  
: �
; �  
< � I=1 � 14
F( � �(I+64),A$(I),�(I+78),A$(I+14)   
P � 
d �
n& �"(Pressing BREAK key stops it.)"
x"� ****************************
�"� * Details in The BBC Micro *
�"� * and Electron Book or SAE *
�"� * (at least 4" x 9 ") to:- *
�"� * G. Haines, 43 Cornwallis *
�"� * Gardens, Hastings, East  *
�"� * Sussex, TN34 1LX.        *
�"� ****************************
�
00000000  0d 00 0a 21 f4 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |...!. **********|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00000020  2a 0d 00 14 21 f4 20 2a  20 54 4f 4b 45 4e 36 3a  |*...!. * TOKEN6:|
00000030  20 54 77 6f 20 73 74 72  6f 6b 65 20 20 20 20 20  | Two stroke     |
00000040  20 2a 0d 00 1e 21 f4 20  2a 20 6b 65 79 77 6f 72  | *...!. * keywor|
00000050  64 20 65 6e 74 72 79 20  66 6f 72 20 20 20 20 20  |d entry for     |
00000060  20 20 2a 0d 00 28 21 f4  20 2a 20 42 42 43 20 4d  |  *..(!. * BBC M|
00000070  69 63 72 6f 20 4f 53 20  31 2e 32 20 20 20 20 20  |icro OS 1.2     |
00000080  20 20 20 2a 0d 00 2d 21  f4 20 2a 20 56 65 72 73  |   *..-!. * Vers|
00000090  69 6f 6e 20 31 2e 31 20  28 74 65 6c 65 73 6f 66  |ion 1.1 (telesof|
000000a0  74 29 20 20 2a 0d 00 32  21 f4 20 2a 20 4c 61 73  |t)  *..2!. * Las|
000000b0  74 20 55 70 64 61 74 65  64 3a 20 32 30 2d 4f 63  |t Updated: 20-Oc|
000000c0  74 2d 38 36 20 2a 0d 00  37 21 f4 20 2a 20 62 79  |t-86 *..7!. * by|
000000d0  20 47 61 76 69 6e 20 48  61 69 6e 65 73 20 20 20  | Gavin Haines   |
000000e0  20 20 20 20 20 20 2a 0d  00 39 21 f4 20 2a 20 4e  |      *..9!. * N|
000000f0  6f 74 20 53 65 63 6f 6e  64 20 50 72 6f 63 65 73  |ot Second Proces|
00000100  73 6f 72 20 20 20 20 2a  0d 00 3c 22 f4 20 2a 2a  |sor    *..<". **|
00000110  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00000120  2a 2a 2a 2a 2a 2a 2a 2a  2a 20 0d 00 41 06 20 f4  |********* ..A. .|
00000130  0d 00 46 21 20 53 54 41  52 54 25 3d 26 39 30 30  |..F! START%=&900|
00000140  20 3a f4 20 52 53 34 32  33 20 62 75 66 66 65 72  | :. RS423 buffer|
00000150  20 0d 00 50 11 4f 53 4e  45 57 4c 25 3d 26 46 46  | ..P.OSNEWL%=&FF|
00000160  45 37 0d 00 5a 11 4f 53  42 59 54 45 25 3d 26 46  |E7..Z.OSBYTE%=&F|
00000170  46 46 34 0d 00 64 0f 52  44 43 48 56 25 3d 26 32  |FF4..d.RDCHV%=&2|
00000180  31 30 0d 00 6e 0f 56 4c  25 3d 3f 52 44 43 48 56  |10..n.VL%=?RDCHV|
00000190  25 0d 00 78 10 56 48 25  3d 52 44 43 48 56 25 3f  |%..x.VH%=RDCHV%?|
000001a0  31 0d 00 82 18 4f 53 52  44 43 48 25 3d 56 4c 25  |1....OSRDCH%=VL%|
000001b0  2b 32 35 36 2a 56 48 25  20 0d 00 8c 0b 41 43 43  |+256*VH% ....ACC|
000001c0  3d 26 37 30 0d 00 96 0c  78 73 61 76 3d 26 37 31  |=&70....xsav=&71|
000001d0  0d 00 a0 0c 79 73 61 76  3d 26 37 32 0d 00 aa 15  |....ysav=&72....|
000001e0  f4 20 2d 2d 2d 2d 2d 20  61 73 73 65 6d 62 6c 65  |. ----- assemble|
000001f0  72 0d 00 b4 15 e3 20 50  41 53 53 25 3d 30 20 b8  |r..... PASS%=0 .|
00000200  20 32 20 88 20 32 0d 00  be 0d 50 25 3d 53 54 41  | 2 . 2....P%=STA|
00000210  52 54 25 0d 00 c8 0e 5b  4f 50 54 20 50 41 53 53  |RT%....[OPT PASS|
00000220  25 0d 00 d2 0a 2e 73 74  61 72 74 0d 00 dc 2f 20  |%.....start.../ |
00000230  20 20 20 20 4c 44 41 20  23 54 52 41 50 20 83 20  |    LDA #TRAP . |
00000240  32 35 36 20 5c 63 6f 6e  6e 65 63 74 20 74 68 69  |256 \connect thi|
00000250  73 20 72 6f 75 74 69 6e  65 20 0d 00 e6 34 20 20  |s routine ...4  |
00000260  20 20 20 53 54 41 20 52  44 43 48 56 25 20 20 20  |   STA RDCHV%   |
00000270  20 20 20 20 20 5c 74 6f  20 74 68 65 20 6b 65 79  |     \to the key|
00000280  62 6f 61 72 64 20 76 65  63 74 6f 72 2c 20 0d 00  |board vector, ..|
00000290  f0 27 20 20 20 20 20 4c  44 41 20 23 54 52 41 50  |.'     LDA #TRAP|
000002a0  20 81 20 32 35 36 20 20  20 20 20 20 20 20 20 20  | . 256          |
000002b0  20 20 20 20 20 0d 00 fa  15 20 20 20 20 20 53 54  |     ....     ST|
000002c0  41 20 52 44 43 48 56 25  2b 31 0d 01 04 0c 20 20  |A RDCHV%+1....  |
000002d0  20 20 20 52 54 53 0d 01  0e 09 2e 73 61 76 65 0d  |   RTS.....save.|
000002e0  01 18 10 20 20 20 20 20  53 54 41 20 41 43 43 0d  |...     STA ACC.|
000002f0  01 22 11 20 20 20 20 20  53 54 59 20 79 73 61 76  |.".     STY ysav|
00000300  0d 01 2c 11 20 20 20 20  20 53 54 58 20 78 73 61  |..,.     STX xsa|
00000310  76 0d 01 36 0c 20 20 20  20 20 52 54 53 0d 01 40  |v..6.     RTS..@|
00000320  0c 2e 72 65 73 74 6f 72  65 0d 01 4a 10 20 20 20  |..restore..J.   |
00000330  20 20 4c 44 41 20 41 43  43 0d 01 54 11 20 20 20  |  LDA ACC..T.   |
00000340  20 20 4c 44 58 20 78 73  61 76 0d 01 5e 11 20 20  |  LDX xsav..^.  |
00000350  20 20 20 4c 44 59 20 79  73 61 76 0d 01 68 0c 20  |   LDY ysav..h. |
00000360  20 20 20 20 52 54 53 0d  01 72 0b 20 2e 65 72 72  |    RTS..r. .err|
00000370  6f 72 0d 01 7c 11 20 20  20 20 20 4c 44 41 20 23  |or..|.     LDA #|
00000380  26 37 44 0d 01 86 14 20  20 20 20 20 4a 53 52 20  |&7D....     JSR |
00000390  4f 53 42 59 54 45 25 0d  01 90 0c 20 2e 65 73 63  |OSBYTE%.... .esc|
000003a0  61 70 65 0d 01 9a 14 20  20 20 20 20 4a 53 52 20  |ape....     JSR |
000003b0  72 65 73 74 6f 72 65 0d  01 a4 0c 20 20 20 20 20  |restore....     |
000003c0  52 54 53 0d 01 ae 41 2e  54 52 41 50 20 20 20 20  |RTS...A.TRAP    |
000003d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003e0  5c 42 41 53 49 43 20 63  61 6c 6c 73 20 68 65 72  |\BASIC calls her|
000003f0  65 20 74 6f 20 67 65 74  20 61 20 63 68 61 72 61  |e to get a chara|
00000400  63 74 65 72 0d 01 b8 11  20 20 20 20 20 4a 53 52  |cter....     JSR|
00000410  20 73 61 76 65 0d 01 c2  14 20 20 20 20 20 4a 53  | save....     JS|
00000420  52 20 4f 53 52 44 43 48  25 0d 01 cc 12 20 20 20  |R OSRDCH%....   |
00000430  20 20 42 43 53 20 65 72  72 6f 72 0d 01 d6 11 20  |  BCS error.... |
00000440  20 20 20 20 43 4d 50 20  23 26 31 42 0d 01 e0 14  |    CMP #&1B....|
00000450  20 20 20 20 20 42 45 51  20 65 73 63 61 70 65 20  |     BEQ escape |
00000460  0d 01 ea 2b 20 20 20 20  20 43 4d 50 20 23 39 20  |...+     CMP #9 |
00000470  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 54 41  |             \TA|
00000480  42 20 6b 65 79 20 64 6f  77 6e 3f 0d 01 f4 43 20  |B key down?...C |
00000490  20 20 20 20 42 4e 45 20  45 58 49 54 20 20 20 20  |    BNE EXIT    |
000004a0  20 20 20 20 20 20 20 20  5c 4e 6f 2c 20 62 72 61  |        \No, bra|
000004b0  6e 63 68 2c 20 6f 75 74  70 75 74 20 63 68 61 72  |nch, output char|
000004c0  20 69 6e 20 6e 6f 72 6d  61 6c 20 77 61 79 0d 01  | in normal way..|
000004d0  fe 2f 2e 4b 42 44 20 43  4c 43 20 20 20 20 20 20  |./.KBD CLC      |
000004e0  20 20 20 20 20 20 20 20  20 20 20 5c 6a 75 73 74  |           \just|
000004f0  20 61 20 70 72 65 63 61  75 74 69 6f 6e 0d 02 08  | a precaution...|
00000500  30 20 20 20 20 20 4a 53  52 20 4f 53 52 44 43 48  |0     JSR OSRDCH|
00000510  25 20 20 20 20 20 20 20  20 20 5c 67 65 74 20 6e  |%         \get n|
00000520  65 78 74 20 63 68 61 72  61 63 74 65 72 0d 02 12  |ext character...|
00000530  12 20 20 20 20 20 42 43  53 20 65 72 72 6f 72 0d  |.     BCS error.|
00000540  02 1c 35 20 20 20 20 20  43 4d 50 20 23 26 35 46  |..5     CMP #&5F|
00000550  20 20 20 20 20 20 20 20  20 20 20 20 5c 69 73 20  |            \is |
00000560  69 74 20 69 6e 20 74 68  65 20 72 61 6e 67 65 20  |it in the range |
00000570  41 2d 5a 3f 0d 02 26 10  20 20 20 20 20 42 43 53  |A-Z?..&.     BCS|
00000580  20 4b 42 44 0d 02 30 11  20 20 20 20 20 43 4d 50  | KBD..0.     CMP|
00000590  20 23 26 33 46 0d 02 3a  11 20 20 20 20 20 42 43  | #&3F..:.     BC|
000005a0  43 20 45 58 49 54 0d 02  44 4b 2e 69 6e 64 65 78  |C EXIT..DK.index|
000005b0  20 43 4c 43 20 20 20 20  20 20 20 20 20 20 20 20  | CLC            |
000005c0  20 20 20 5c 6d 75 73 74  20 63 6c 65 61 72 20 74  |   \must clear t|
000005d0  68 65 20 63 61 72 72 79  20 62 65 66 6f 72 65 20  |he carry before |
000005e0  64 6f 69 6e 67 20 73 75  62 74 72 61 63 74 69 6f  |doing subtractio|
000005f0  6e 0d 02 4e 3d 20 20 20  20 20 53 42 43 20 23 26  |n..N=     SBC #&|
00000600  34 30 20 20 20 20 20 20  20 20 20 20 20 20 5c 66  |40            \f|
00000610  6f 72 6d 20 69 6e 64 65  78 20 69 6e 74 6f 20 74  |orm index into t|
00000620  61 62 6c 65 20 6f 66 20  74 6f 6b 65 6e 73 0d 02  |able of tokens..|
00000630  58 0c 20 20 20 20 20 54  41 58 0d 02 62 42 20 20  |X.     TAX..bB  |
00000640  20 20 20 4c 44 41 20 74  6f 6b 65 6e 2c 58 20 20  |   LDA token,X  |
00000650  20 20 20 20 20 20 20 5c  70 69 63 6b 20 75 70 20  |       \pick up |
00000660  74 6f 6b 65 6e 20 28 69  6e 20 dc 20 73 74 61 74  |token (in . stat|
00000670  65 6d 65 6e 74 20 62 65  6c 6f 77 29 0d 02 6c 35  |ement below)..l5|
00000680  20 20 20 20 20 4a 53 52  20 64 65 63 72 75 6e 63  |     JSR decrunc|
00000690  68 20 20 20 20 20 20 20  20 5c 74 75 72 6e 20 74  |h        \turn t|
000006a0  6f 6b 65 6e 20 69 6e 74  6f 20 6b 65 79 77 6f 72  |oken into keywor|
000006b0  64 0d 02 76 46 20 20 20  20 20 4c 44 41 20 23 30  |d..vF     LDA #0|
000006c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 74  |              \t|
000006d0  75 72 6e 20 54 41 42 20  63 68 61 72 61 63 74 65  |urn TAB characte|
000006e0  72 20 69 6e 74 6f 20 61  20 6e 75 6c 6c 20 63 68  |r into a null ch|
000006f0  61 72 61 63 74 65 72 0d  02 80 46 2e 45 58 49 54  |aracter...F.EXIT|
00000700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000710  20 20 20 20 5c 73 6f 20  74 68 61 74 20 77 65 20  |    \so that we |
00000720  77 69 6c 6c 20 62 65 20  61 62 6c 65 20 74 6f 20  |will be able to |
00000730  62 61 63 6b 73 70 61 63  65 20 4f 4b 2e 0d 02 8a  |backspace OK....|
00000740  34 20 20 20 20 20 43 4c  43 20 20 20 20 20 20 20  |4     CLC       |
00000750  20 20 20 20 20 20 20 20  20 20 5c 73 69 67 6e 61  |          \signa|
00000760  6c 20 76 61 6c 69 64 20  63 68 61 72 61 63 74 65  |l valid characte|
00000770  72 0d 02 94 3d 20 20 20  20 20 52 54 53 20 20 20  |r...=     RTS   |
00000780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 67  |              \g|
00000790  6f 65 73 20 62 61 63 6b  20 74 6f 20 63 61 6c 6c  |oes back to call|
000007a0  65 72 2c 20 69 2e 65 2e  20 42 41 53 49 43 0d 02  |er, i.e. BASIC..|
000007b0  9e 3f 2e 64 65 63 72 75  6e 63 68 20 20 20 20 20  |.?.decrunch     |
000007c0  20 20 20 20 20 20 20 20  20 20 20 5c 20 2a 2a 2a  |           \ ***|
000007d0  2a 2a 20 54 6f 6b 65 6e  73 20 74 6f 20 6b 65 79  |** Tokens to key|
000007e0  77 6f 72 64 73 20 72 6f  75 74 69 6e 65 0d 02 a8  |words routine...|
000007f0  43 20 20 20 20 20 4a 53  52 20 73 61 76 65 20 20  |C     JSR save  |
00000800  20 20 20 20 20 20 20 20  20 20 5c 6d 75 73 74 20  |          \must |
00000810  73 61 76 65 20 58 20 61  6e 64 20 59 20 72 65 67  |save X and Y reg|
00000820  69 73 74 65 72 73 2c 20  6f 72 20 65 6c 73 65 2e  |isters, or else.|
00000830  0d 02 b2 38 20 20 20 20  20 53 54 41 20 26 33 37  |...8     STA &37|
00000840  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 69 6e  |             \in|
00000850  64 65 78 20 74 6f 20 74  61 62 6c 65 20 6f 66 20  |dex to table of |
00000860  6b 65 79 77 6f 72 64 73  0d 02 bc 33 20 20 20 20  |keywords...3    |
00000870  20 43 4d 50 20 23 26 38  30 20 20 20 20 20 20 20  | CMP #&80       |
00000880  20 20 20 20 20 5c 69 73  20 63 68 61 72 61 63 74  |     \is charact|
00000890  65 72 20 61 20 74 6f 6b  65 6e 3f 0d 02 c6 2b 20  |er a token?...+ |
000008a0  20 20 20 20 42 43 43 20  69 6e 73 65 72 74 20 20  |    BCC insert  |
000008b0  20 20 20 20 20 20 20 20  5c 6e 6f 2c 20 62 72 61  |        \no, bra|
000008c0  6e 63 68 2e 20 20 0d 02  d0 30 20 20 20 20 20 4c  |nch.  ...0     L|
000008d0  44 41 20 23 26 36 44 20  20 20 20 20 20 20 20 20  |DA #&6D         |
000008e0  20 20 20 5c 69 6e 64 65  78 20 69 6e 74 6f 20 6b  |   \index into k|
000008f0  65 79 77 6f 72 64 0d 02  da 10 20 20 20 20 20 53  |eyword....     S|
00000900  54 41 20 26 33 38 0d 02  e4 11 20 20 20 20 20 4c  |TA &38....     L|
00000910  44 41 20 23 26 38 30 0d  02 ee 10 20 20 20 20 20  |DA #&80....     |
00000920  53 54 41 20 26 33 39 0d  02 f8 10 20 20 20 20 20  |STA &39....     |
00000930  53 54 59 20 26 33 41 0d  03 02 12 2e 74 6f 6b 31  |STY &3A.....tok1|
00000940  20 4c 44 59 20 23 26 30  30 0d 03 0c 0d 2e 74 6f  | LDY #&00.....to|
00000950  6b 32 20 49 4e 59 0d 03  16 30 20 20 20 20 20 4c  |k2 INY...0     L|
00000960  44 41 20 28 26 33 38 29  2c 59 20 20 20 20 20 20  |DA (&38),Y      |
00000970  20 20 20 20 5c 70 69 63  6b 20 75 70 20 63 68 61  |    \pick up cha|
00000980  72 61 63 74 65 72 0d 03  20 11 20 20 20 20 20 42  |racter.. .     B|
00000990  50 4c 20 74 6f 6b 32 0d  03 2a 10 20 20 20 20 20  |PL tok2..*.     |
000009a0  43 4d 50 20 26 33 37 0d  03 34 12 20 20 20 20 20  |CMP &37..4.     |
000009b0  42 45 51 20 6c 6f 6f 70  31 0d 03 3e 0c 20 20 20  |BEQ loop1..>.   |
000009c0  20 20 49 4e 59 0d 03 48  0c 20 20 20 20 20 54 59  |  INY..H.     TY|
000009d0  41 0d 03 52 0c 20 20 20  20 20 53 45 43 0d 03 5c  |A..R.     SEC..\|
000009e0  10 20 20 20 20 20 41 44  43 20 26 33 38 0d 03 66  |.     ADC &38..f|
000009f0  10 20 20 20 20 20 53 54  41 20 26 33 38 0d 03 70  |.     STA &38..p|
00000a00  11 20 20 20 20 20 42 43  43 20 74 6f 6b 31 0d 03  |.     BCC tok1..|
00000a10  7a 10 20 20 20 20 20 49  4e 43 20 26 33 39 0d 03  |z.     INC &39..|
00000a20  84 11 20 20 20 20 20 42  43 53 20 74 6f 6b 31 0d  |..     BCS tok1.|
00000a30  03 8e 13 2e 6c 6f 6f 70  31 20 4c 44 59 20 23 26  |....loop1 LDY #&|
00000a40  30 30 0d 03 98 16 2e 6c  6f 6f 70 32 20 4c 44 41  |00.....loop2 LDA|
00000a50  20 28 26 33 38 29 2c 59  0d 03 a2 13 20 20 20 20  | (&38),Y....    |
00000a60  20 42 4d 49 20 65 6e 64  74 6f 6b 0d 03 ac 41 20  | BMI endtok...A |
00000a70  20 20 20 20 4a 53 52 20  69 6e 73 65 72 74 20 20  |    JSR insert  |
00000a80  20 20 20 20 20 20 20 20  20 5c 70 75 74 20 63 68  |         \put ch|
00000a90  61 72 61 63 74 65 72 20  69 6e 74 6f 20 6b 65 79  |aracter into key|
00000aa0  62 6f 61 72 64 20 62 75  66 66 65 72 0d 03 b6 0c  |board buffer....|
00000ab0  20 20 20 20 20 49 4e 59  0d 03 c0 12 20 20 20 20  |     INY....    |
00000ac0  20 42 4e 45 20 6c 6f 6f  70 32 0d 03 ca 3c 2e 65  | BNE loop2...<.e|
00000ad0  6e 64 74 6f 6b 20 4c 44  59 20 26 33 41 20 20 20  |ndtok LDY &3A   |
00000ae0  20 20 20 20 20 20 20 20  5c 65 6e 64 20 6f 66 20  |        \end of |
00000af0  74 6f 6b 65 6e 20 64 65  63 72 75 6e 63 68 20 72  |token decrunch r|
00000b00  6f 75 74 69 6e 65 0d 03  d4 0c 20 20 20 20 20 52  |outine....     R|
00000b10  54 53 0d 03 de 3b 2e 69  6e 73 65 72 74 20 20 20  |TS...;.insert   |
00000b20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b30  5c 63 68 61 72 61 63 74  65 72 20 69 6e 20 74 68  |\character in th|
00000b40  65 20 41 63 63 75 6d 75  6c 61 74 6f 72 0d 03 e8  |e Accumulator...|
00000b50  11 20 20 20 20 20 4a 53  52 20 73 61 76 65 0d 03  |.     JSR save..|
00000b60  f2 0c 20 20 20 20 20 50  48 41 0d 03 fc 34 20 20  |..     PHA...4  |
00000b70  20 20 20 4c 44 41 20 26  32 33 20 20 20 20 20 20  |   LDA &23      |
00000b80  20 20 20 20 20 20 20 20  5c 69 73 20 9c 20 67 72  |        \is . gr|
00000b90  65 61 74 65 72 20 74 68  61 6e 20 fe 3f 20 0d 04  |eater than .? ..|
00000ba0  06 10 20 20 20 20 20 43  4d 50 20 26 31 45 0d 04  |..     CMP &1E..|
00000bb0  10 0f 20 20 20 20 20 42  43 53 20 4f 4b 0d 04 1a  |..     BCS OK...|
00000bc0  32 20 20 20 20 20 4a 53  52 20 4f 53 4e 45 57 4c  |2     JSR OSNEWL|
00000bd0  25 20 20 20 20 20 20 20  20 20 20 5c 59 65 73 2c  |%          \Yes,|
00000be0  20 73 65 6e 64 20 61 20  6e 65 77 6c 69 6e 65 0d  | send a newline.|
00000bf0  04 24 0f 20 20 20 20 20  4c 44 41 20 23 30 0d 04  |.$.     LDA #0..|
00000c00  2e 2b 20 20 20 20 20 53  54 41 20 26 31 45 20 20  |.+     STA &1E  |
00000c10  20 20 20 20 20 20 20 20  20 20 20 20 5c 69 6e 69  |            \ini|
00000c20  74 69 61 6c 69 7a 65 20  9c 0d 04 38 07 2e 4f 4b  |tialize ...8..OK|
00000c30  0d 04 42 0c 20 20 20 20  20 50 4c 41 0d 04 4c 10  |..B.     PLA..L.|
00000c40  20 20 20 20 20 49 4e 43  20 26 31 45 0d 04 56 0f  |     INC &1E..V.|
00000c50  20 20 20 20 20 4c 44 58  20 23 30 0d 04 60 0c 20  |     LDX #0..`. |
00000c60  20 20 20 20 54 41 59 0d  04 6a 12 20 20 20 20 20  |    TAY..j.     |
00000c70  4c 44 41 20 23 26 38 41  20 0d 04 74 2f 20 20 20  |LDA #&8A ..t/   |
00000c80  20 20 4a 53 52 20 4f 53  42 59 54 45 25 20 20 20  |  JSR OSBYTE%   |
00000c90  20 20 20 20 20 20 20 5c  69 6e 73 65 72 74 20 63  |       \insert c|
00000ca0  68 61 72 61 63 74 65 72  0d 04 7e 3e 20 20 20 20  |haracter..~>    |
00000cb0  20 4c 44 58 20 78 73 61  76 20 20 20 20 20 20 20  | LDX xsav       |
00000cc0  20 20 20 20 20 20 5c 72  65 73 74 6f 72 65 20 58  |      \restore X|
00000cd0  20 61 6e 64 20 59 20 61  73 20 61 20 70 72 65 63  | and Y as a prec|
00000ce0  61 75 74 69 6f 6e 0d 04  88 11 20 20 20 20 20 4c  |aution....     L|
00000cf0  44 59 20 79 73 61 76 0d  04 92 2f 20 20 20 20 20  |DY ysav.../     |
00000d00  52 54 53 20 20 20 20 20  20 20 20 20 20 20 20 20  |RTS             |
00000d10  20 20 20 20 20 5c 62 61  63 6b 20 74 6f 20 63 61  |     \back to ca|
00000d20  6c 6c 65 72 2e 20 0d 04  9c 0a 2e 74 6f 6b 65 6e  |ller. .....token|
00000d30  0d 04 a6 06 5d 20 0d 04  b0 0b ed 20 50 41 53 53  |....] ..... PASS|
00000d40  25 0d 04 ba 18 f4 20 2d  2d 2d 2d 2d 20 45 6e 74  |%..... ----- Ent|
00000d50  65 72 20 74 6f 6b 65 6e  73 0d 04 c4 13 e3 20 4c  |er tokens..... L|
00000d60  25 3d 50 25 20 b8 20 50  25 2b 32 38 0d 04 ce 08  |%=P% . P%+28....|
00000d70  f3 20 54 24 0d 04 d8 11  54 25 3d a0 28 22 26 22  |. T$....T%=.("&"|
00000d80  2b 54 24 20 29 0d 04 e2  0a 3f 4c 25 3d 54 25 0d  |+T$ )....?L%=T%.|
00000d90  04 ec 05 ed 0d 04 f6 62  dc 43 36 2c 43 43 2c 46  |.......b.C6,CC,F|
00000da0  42 2c 44 46 2c 38 42 2c  45 33 2c 45 35 2c 39 44  |B,DF,8B,E3,E5,9D|
00000db0  2c 45 38 2c 42 32 2c 44  37 2c 43 39 2c 45 42 2c  |,E8,B2,D7,C9,EB,|
00000dc0  45 44 2c 43 42 2c 46 30  2c 45 41 2c 46 39 2c 38  |ED,CB,F0,EA,F9,8|
00000dd0  38 2c 38 43 2c 46 44 2c  45 46 2c 46 37 2c 46 32  |8,8C,FD,EF,F7,F2|
00000de0  2c 46 35 2c 45 30 2c 43  38 2c 43 44 2c 46 31 2c  |,F5,E0,C8,CD,F1,|
00000df0  45 32 2c 45 38 20 0d 05  00 18 f4 20 2d 2d 2d 2d  |E2,E8 ..... ----|
00000e00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 05  |--------------..|
00000e10  0a 0c 20 d6 20 73 74 61  72 74 0d 05 10 06 20 db  |.. . start.... .|
00000e20  0d 05 14 49 20 f4 20 2d  2d 2d 20 54 65 73 74 20  |...I . --- Test |
00000e30  72 6f 75 74 69 6e 65 2e  20 20 50 72 69 6e 74 73  |routine.  Prints|
00000e40  20 6f 75 74 20 6b 65 79  77 6f 72 64 73 20 44 65  | out keywords De|
00000e50  6c 65 74 65 20 66 72 6f  6d 20 77 6f 72 6b 69 6e  |lete from workin|
00000e60  67 20 70 72 6f 67 72 61  6d 0d 05 19 0d 20 de 20  |g program.... . |
00000e70  41 24 28 32 38 29 0d 05  1a 08 20 ef 32 31 0d 05  |A$(28).... .21..|
00000e80  1e 11 20 e3 20 41 25 3d  36 35 20 b8 20 39 33 0d  |.. . A%=65 . 93.|
00000e90  05 23 12 20 2a 46 58 31  33 38 2c 30 2c 31 33 20  |.#. *FX138,0,13 |
00000ea0  20 0d 05 28 11 20 d6 20  69 6e 64 65 78 3a e8 20  | ..(. . index:. |
00000eb0  41 24 0d 05 2f 13 20 41  24 28 41 25 2d 36 35 29  |A$../. A$(A%-65)|
00000ec0  3d 41 24 20 20 0d 05 32  09 20 ed 20 41 25 0d 05  |=A$  ..2. . A%..|
00000ed0  36 13 20 2a 46 58 31 33  38 2c 30 2c 31 33 20 20  |6. *FX138,0,13  |
00000ee0  20 0d 05 37 0c 20 2a 46  58 31 35 2c 30 0d 05 38  | ..7. *FX15,0..8|
00000ef0  07 20 ef 36 0d 05 39 28  20 f1 27 27 22 54 72 79  |. .6..9( .''"Try|
00000f00  20 54 41 42 20 61 6e 64  20 74 68 65 6e 20 61 6e  | TAB and then an|
00000f10  6f 74 68 65 72 20 6b 65  79 22 20 20 0d 05 3a 06  |other key"  ..:.|
00000f20  20 f1 0d 05 3b 08 20 f1  20 20 0d 05 3c 0f 20 e3  | ...;. .  ..<. .|
00000f30  20 49 3d 31 20 b8 20 31  34 0d 05 46 28 20 f1 20  | I=1 . 14..F( . |
00000f40  bd 28 49 2b 36 34 29 2c  41 24 28 49 29 2c bd 28  |.(I+64),A$(I),.(|
00000f50  49 2b 37 38 29 2c 41 24  28 49 2b 31 34 29 20 20  |I+78),A$(I+14)  |
00000f60  20 0d 05 50 07 20 ed 20  0d 05 64 06 20 f1 0d 05  | ..P. . ..d. ...|
00000f70  6e 26 20 f1 22 28 50 72  65 73 73 69 6e 67 20 42  |n& ."(Pressing B|
00000f80  52 45 41 4b 20 6b 65 79  20 73 74 6f 70 73 20 69  |REAK key stops i|
00000f90  74 2e 29 22 0d 05 78 22  f4 20 2a 2a 2a 2a 2a 2a  |t.)"..x". ******|
00000fa0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00000fb0  2a 2a 2a 2a 2a 2a 0d 05  82 22 f4 20 2a 20 44 65  |******...". * De|
00000fc0  74 61 69 6c 73 20 69 6e  20 54 68 65 20 42 42 43  |tails in The BBC|
00000fd0  20 4d 69 63 72 6f 20 2a  0d 05 8c 22 f4 20 2a 20  | Micro *...". * |
00000fe0  61 6e 64 20 45 6c 65 63  74 72 6f 6e 20 42 6f 6f  |and Electron Boo|
00000ff0  6b 20 6f 72 20 53 41 45  20 2a 0d 05 96 22 f4 20  |k or SAE *...". |
00001000  2a 20 28 61 74 20 6c 65  61 73 74 20 34 22 20 78  |* (at least 4" x|
00001010  20 39 20 22 29 20 74 6f  3a 2d 20 2a 0d 05 a0 22  | 9 ") to:- *..."|
00001020  f4 20 2a 20 47 2e 20 48  61 69 6e 65 73 2c 20 34  |. * G. Haines, 4|
00001030  33 20 43 6f 72 6e 77 61  6c 6c 69 73 20 2a 0d 05  |3 Cornwallis *..|
00001040  aa 22 f4 20 2a 20 47 61  72 64 65 6e 73 2c 20 48  |.". * Gardens, H|
00001050  61 73 74 69 6e 67 73 2c  20 45 61 73 74 20 20 2a  |astings, East  *|
00001060  0d 05 b4 22 f4 20 2a 20  53 75 73 73 65 78 2c 20  |...". * Sussex, |
00001070  54 4e 33 34 20 31 4c 58  2e 20 20 20 20 20 20 20  |TN34 1LX.       |
00001080  20 2a 0d 05 be 22 f4 20  2a 2a 2a 2a 2a 2a 2a 2a  | *...". ********|
00001090  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
000010a0  2a 2a 2a 2a 0d ff                                 |****..|
000010a6
Utils/TOKEN6.m0
Utils/TOKEN6.m1
Utils/TOKEN6.m2
Utils/TOKEN6.m4
Utils/TOKEN6.m5