22 VTAB 20: HTAB 7: PRINT "PRESS 'ESC' FOR INSTRUCTIONS"
30 POKE 1012,0
40 POKE 0,0: POKE 48389,1
60 GOSUB 3000
80 DIM V%(102,3),P%(102)
90 EF = 1
100 D = 0:DF = 0: FOR I = 1 TO 102:P%(I) = I: NEXT
105 POKE IO +2,DF +1:T = 0:I = D:MF = 3: GOSUB 1050: ON C = 0 GOTO 150
110 FOR I = D +1 TO D +C:J = VE +3 *(I -D) -3:V%(I,0) = DF *8192 +(15 - PEEK(J +1)) *256 + PEEK(J +2): NEXT :D = D +C
120 T = 1:I = D:MF = 1: GOSUB 1050: FOR I = D +1 TO D +C:J = VE +3 *(I -D) -3:V%(I,0) = DF *8192 +4096 *( PEEK(J) >0) +(15 - PEEK(J +1)) *256 + PEEK(J +2):V%(I,3) = 1: NEXT :D = D +C
130 ON DF GOTO 150: POKE IO +2,2: POKE TY,2: CALL CA: IF PEEK(0) THEN POKE 0,0: GOTO 150
135 IF PEEK(BF +2) = 3 AND PEEK(BF +36) = 13 AND PEEK(BF +4) >240 THEN DF = 1: GOTO 105
150 FOR I = 2 TO D:K = I -1
154 IF V%(P%(K),0) >V%(P%(K +1),0) THEN Z = P%(K):P%(K) = P%(K +1):P%(K +1) = Z:K = K -1: IF K < >0 GOTO 154
157 NEXT
158 HGR2 : HGR :EF = 2
160 M = 1:DR = 1
163 J = P%(M): POKE ZP +53,0: POKE IO +2,1 +(V%(J,0) >8192): IF M = 1 THEN POKE BG,0
165 A = V%(J,1): POKE NB +17, FN L(A): POKE NB +18, FN H(A): POKE NB +19,2
170 A = V%(J,2): POKE NB +21, FN L(A): POKE NB +22, FN H(A): ON V%(J,3) < >1 GOTO 175: IF DR = -1 THEN 180
172 S = 24576: GOSUB 1150: POKE BG,255: GOTO 180
175 S = 33792: GOSUB 1250:A = PEEK(1)
176 IF A = 27 OR PEEK(49152) = 155 THEN GOSUB 850: CALL CM: ON PEEK(1) = 27 GOTO 176
179 DR = 1 -2 *( PEEK(MD) = 255): IF DR = -1 THEN POKE BG,0
180 M = M +DR:A = D *(M <1) +1 *(M >D):M = M * NOT A +A: GOTO 163
190 POKE BG,0: GOTO 160
850 POKE 49168,0: HOME :A = PEEK(49235): VTAB 20: PRINT
853 PRINT "PRESS 'RETURN' TO SKIP, SPACE TO PAUSE,'L' TO LOOP, ARROWS TO CHANGE DIRECTION. SPEED: 1 (FAST) TO 7 (SLOW) PRESS 'ESC' TO STOP OR START:";
857 FLASH : PRINT " ";: NORMAL
858 A = PEEK(49152): ON A <127 GOTO 858: IF A = 155 THEN POKE 49168,0
860 A = PEEK(49234):A = PEEK(1): POKE 1,0: RETURN
1000 C = 0: POKE TY,T: CALL CA
1005 CALL GT:A = PEEK(CH): ON NOT (A) GOTO 1020: IF A = 141 THEN C = C +1
1007 E = PEEK(49152): IF E = 155 THEN POKE 49168,0: GOTO 1070
1009 PRINT CHR$(A);
1010 GOTO 1005
1020 RETURN
1050 C = 0:FF = 0: POKE TY,T: CALL CA: ON PEEK(0) GOTO 1070
1055 CALL GT: ON PEEK(0) GOTO 1070:A = PEEK(CH): ON NOT A GOTO 1070: ON FF GOTO 1060:FF = 1:I = I +1:P = FN A(PR) -MF:B = PEEK(P +17): IF PEEK(PR) -MF = 238 THEN P = N2 -18
2000 POKE NB,J: FOR I = 1 TO J: POKE NB +I, ASC( MID$ (N$,I)): NEXT : POKE NB +21, FN L(L): POKE NB +22, FN H(L): POKE NB +30,195: POKE NB +37,2: POKE NB +31, FN L(S): POKE NB +32, FN H(S): CALL WT: RETURN