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,30 @@
.model tiny
.code
.486
org 100h
start: mov si, offset array
mov ax, 40 ;length of array (not including $)
call bsort
mov dx, si ;point to array
mov ah, 09h ;display it as a string
int 21h
ret
array db "Pack my box with five dozen liquor jugs.$"
;Bubble sort: si = array addrsss, ax = number of bytes
bsort: pusha
xchg cx, ax ;get size of array N
dec cx ;for J:= N-1 downto 0
bs10: xor bx, bx ;for I:= 0 to J-1
bs20: mov ax, [bx+si]
cmp al, ah ;if A(I) > A(I+1) then
jbe bs30
xchg al, ah ; swap bytes
mov [bx+si], ax
bs30: inc bx ;next I
cmp bx, cx
jb bs20
loop bs10
popa
ret
end start