Created
June 26, 2025 21:16
-
-
Save James-Livesey/0e62609a3b0131513c40733b881c0690 to your computer and use it in GitHub Desktop.
Record sorting algorithm demo for the Psion Organiser II (public domain — CC0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SORT: | |
LOCAL A%,B%,I% | |
REM Set up file | |
IF EXIST("A:LIST") | |
DELETE "A:LIST" | |
ENDIF | |
CREATE "A:LIST",A,V% | |
REM Get items (0 to end) | |
WHILE 1 | |
PRINT "ENTER ITEM: "; | |
INPUT A.V% | |
IF A.V%=0 | |
BREAK | |
ENDIF | |
APPEND | |
ENDWH | |
REM Main sorting algorithm | |
FIRST | |
WHILE 1 | |
REM Get A% and B% values | |
A%=A.V% | |
NEXT | |
IF EOF | |
BREAK | |
ENDIF | |
B%=A.V% | |
BACK | |
IF A%>B% :REM Value comparison | |
UPDATE | |
FIRST | |
ELSE | |
NEXT | |
ENDIF | |
REM Display current iteration | |
SORTSHOW: | |
PRINT "POS ";POS;" ITER ";I% | |
PAUSE 10 | |
I%=I%+1 | |
ENDWH | |
REM Display final result | |
SORTSHOW: | |
PRINT "DONE ";I%;" ITERS" | |
GET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SORTSHOW: | |
LOCAL P% | |
P%=POS | |
FIRST | |
CLS | |
WHILE NOT EOF | |
PRINT A.V%;" "; | |
NEXT | |
ENDWH | |
POSITION P% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment