Publication: Timex Sinclair User
Pub Details: Timex Sinclair User n6 (Volume 1, Issue 6)
Date: November 1983
Pages: 30
THIS program is somewhat unusual but also useful. It fills the screen with alphabet characters in random order, then does a sink sort on them to get them in order. It is interesting to watch and gives a very graphic demonstration of how a sink (or bubble) sort works. Of course, it should be run in the slow mode to watch it. It is very slow, however, and takes about 11 hours to run completely. Submitted by David Lee of Longwood, Florida. (T/S1000,1500,ZX81 16K)

1 REM ***********************
2 REM ** **
3 REM ** SCREEN SORT **
4 REM ** BY DAVID LEE **
6 REM ** **
7 REM ***********************
10 FOR A=1 TO 704
20 PRINT CHR$ INT (RND*26+38);
30 NEXT A
40 LET S=1+(PEEK 16396+256*PEEK 16397)
50 LET B=S+723
60 LET C=0
70 FOR A=S TO B
80 LET X=PEEK A
90 LET Y=PEEK (A+1)
100 IF X<=Y THEN GOTO 180
110 POKE A,Y
120 POKE A+1,X
130 LET C=1
140 NEXT A
150 IF C=0 THEN STOP
160 LET B=B-1
170 GOTO 60
180 IF Y<>118 THEN GOTO 140
190 LET Y=PEEK (A+2)
200 IF X>Y THEN GOTO 230
210 LET A=A+1
220 GOTO 140
230 POKE A,Y
240 POKE A+2,X
250 LET A=A+1
260 GOTO 130
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.