'14 red LEDs being flashed by two 4511 BCD to seven-segment
'decoders with their MSBs grounded and the remaining bits
'being driven from the opposite ends of the parallel outputs
'of an 8 bit pseudo-random sequence generator.
'John Fields, 24 July 2005
SCREEN 12
CLS
q1 = 0
q2 = 0
q3 = 0
q4 = 0
q5 = 0
q6 = 0
q7 = 0
q8 = 0
clk = 0
n = 1
x = 160
s = 4500000
zero$ = "xxxxxx "
one$ = " xx "
two$ = "xx xx x"
three$ = "xxxx x"
four$ = " xx xx"
five$ = "x xx xx"
six$ = "x xxxxx"
seven$ = "xxx "
eight$ = "xxxxxxx"
nine$ = "xxxx xx"
PRINT "Press " + CHR$(34) + "f" + CHR$(34) + " to increase display speed, " + CHR$(34) + "s" + CHR$(34) + " to decrease it, or " + CHR$(34) + "q" + CHR$(34) + " to quit."
shift: n = 1
x = 160
nor = q1 OR q2 OR q3 OR q4 OR q5 OR q6 OR q7
IF nor = 0 THEN nor = 1 ELSE nor = 0
tap1 = q3 XOR q5
tap2 = q6 XOR q8
tap3 = tap1 XOR tap2
srin = nor XOR tap3
q8 = q7
q7 = q6
q6 = q5
q5 = q4
q4 = q3
q3 = q2
q2 = q1
q1 = srin
clk = clk + 1
IF clk = 256 THEN clk = 1
lsd = q1 + (2 * q2) + (4 * q3)
msd = q6 + (2 * q7) + (4 * q8)
IF lsd = 0 THEN lsd$ = zero$
IF lsd = 1 THEN lsd$ = one$
IF lsd = 2 THEN lsd$ = two$
IF lsd = 3 THEN lsd$ = three$
IF lsd = 4 THEN lsd$ = four$
IF lsd = 5 THEN lsd$ = five$
IF lsd = 6 THEN lsd$ = six$
IF lsd = 7 THEN lsd$ = seven$
IF lsd = 8 THEN lsd$ = eight$
IF lsd = 9 THEN lsd$ = nine$
IF msd = 0 THEN msd$ = zero$
IF msd = 1 THEN msd$ = one$
IF msd = 2 THEN msd$ = two$
IF msd = 3 THEN msd$ = three$
IF msd = 4 THEN msd$ = four$
IF msd = 5 THEN msd$ = five$
IF msd = 6 THEN msd$ = six$
IF msd = 7 THEN msd$ = seven$
IF msd = 8 THEN msd$ = eight$
IF msd = 9 THEN msd$ = nine$
disp$ = lsd$ + msd$
DO WHILE n < 15
z$ = MID$(disp$, n, 1)
IF z$ = "x" THEN CIRCLE (x, 240), 10, 4 ELSE PAINT (x, 240), 0, 0
IF z$ = "x" THEN PAINT (x, 240), 4, 4
n = n + 1
x = x + 25
LOOP
FOR t = 1 TO s: NEXT t
s$ = INKEY$
IF s$ = "f" THEN s = s - 100000
IF s$ = "s" THEN s = s + 100000
IF s$ = "q" THEN END
IF s <= 0 THEN s = 0
GOTO shift
END