New to assembly here. I am playing with implementation of different sorting algorithms, specifically bubble and insertion sort. The following code takes user input (10 integers) and stores that input in an array. How would I sort this data using the above mentioned sort types. I am familiar with the logic just not the implementation in assembly. FYI I am working in Visual Studio 2017.
.586
.MODEL FLAT
INCLUDE io.h
.STACK 4096
.DATA
user_array DWORD 10 DUP (?)
nbrElts DWORD 10
welcomeLbl BYTE "Array Bubble Sorting Program ", 0
wel_message BYTE "Please enter 10 unique integers", 0
prompt1 BYTE "Please enter a number: ", 0
string BYTE 40 DUP (?)
array_contentLbl BYTE "The values you entered: ", 0
array_val DWORD ?, 0ah, 0dh
resultLbl BYTE "Program will now sort the numbers", 0
waitMsg BYTE "Please wait.....",0
.CODE
_MainProc PROC
output welcomeLbl, wel_message
lea ebx, user_array
mov ecx, nbrElts
forCount1:
input prompt1, string, 40 ; prompt user for a number
atod string ;convert to integer
mov [ebx], eax
add ebx, 4
loop forCount1
lea ebx, user_array ;ptr to array, index 0
mov ecx, nbrElts ;move counter to ecx for loop
output resultLbl, waitMsg
;call bubble_sort
forCount2: ;loop to output array contents
mov eax, [ebx]
mov array_val, eax
dtoa array_val, eax
output array_contentLbl, array_val
add ebx, 4
loop forCount2
quit: mov eax, 0 ;clear memory
mov ebx, 0
mov ecx, 0
mov edx, 0
ret
_MainProc ENDP
;bubble_sort PROC
;bubble_sort ENDP
END