News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

SleepSort is perhaps not the fastest sort algo, but it's fun ;-)

Started by jj2007, November 12, 2023, 06:08:40 AM

Previous topic - Next topic

jj2007

include \masm32\MasmBasic\MasmBasic.inc
.code
PrintSleep proc arg
  invoke Sleep, arg
  Print Str$("%i\n", arg)
  ret
PrintSleep endp
unsorted dw 999, 333, 666, 444, 111, 555, 888, 222, 777, 0
  Init
  Cls 5
  mov esi, offset unsorted
  .While 1
lodsw
.Break .if !ax
movzx eax, ax
push eax
invoke CreateThread, 0, 0, offset PrintSleep, eax, 0, esp
pop ecx
  .Endw
  MsgBox 0, "SleepSort is fun", "Hi", MB_OK
EndOfCode

Output:
111
222
333
444
555
666
777
888
999