Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,91 @@
;bubble sort example for x86 DOS
;compiles to 549 bytes com file
program examples\bubble
data
int sorting[0]
int index[0]
int size[10]
int temp1[0]
int temp2[0]
int@ list[10]
begin
call fill
call sort
call output
pause
kill
end
sub fill
0 [index]
label loopfill
echo "Enter value #" \
echo [index]
echo ": " \
input @list{[index]}
+1 [index]
if [index] < [size] then loopfill
ret
sub sort
label loopsort
0 [sorting]
0 [index]
label process
[temp1] = [index] + 1
if @list{[index]} > @list{[temp1]} then
[temp2] = @list{[index]}
@list{[index]} = @list{[temp1]}
@list{[temp1]} = [temp2]
[sorting] = 1
endif
+1 [index]
if [index] < [size] - 1 then process
if [sorting] = 1 then loopsort
ret
sub output
0 [index]
label loopoutput
echo [index]
echo " : " \
echo @list{[index]}
crlf
+1 [index]
if [index] < [size] then loopoutput
ret