Question: Please provide a flowchart, using standard flowchart symbols, illustrating the algorithm implemented in the program. Please provide screenshots as well!! Thank you! TITLE SortArrasys.asm, Version
Please provide a flowchart, using standard flowchart symbols, illustrating the algorithm implemented in the program. Please provide screenshots as well!! Thank you!
TITLE SortArrasys.asm, Version 1
INCLUDE Irvine32.inc ; this allows us access Irvine's pre-written routines/procedures.
.data ; data segment begins here
array1 DWORD 0C0D12AFh, 00030256h, 0FFAABBCCh, 0F700F70h, 00000000h, 0E222111Fh, 0ABCDEF01h, 01234567h
array2 DWORD 61A80000h,024F4A37h,0EC010203h,0FAEEDDCCh,2c030175h,84728371h,63AA5678h,0CD454443h,22222222h,61B1C2D3h,7A4E96C2h,81002346h,0FDB2726Eh,65432100h,0FFFFFFFFh
message BYTE "The largest unsigned value in the array is: ",0
.code ; code segment begins here
main PROC ; begin main procedure for program
MOV ESI, offset array1
MOV ECX, LENGTHOF array1
MOV EBX, TYPE array1
call DumpMem
MOV ESI, offset array2
MOV ECX, LENGTHOF array2
MOV EBX, TYPE array2
call DumpMem
MOV ESI, offset array1
MOV ECX, LENGTHOF array1
call sortArray
MOV ESI, offset array1
MOV ECX, LENGTHOF array1
MOV EBX, TYPE array1
call DumpMem
;working on it below
mov edx,offset message
call WriteString; writes string
call WriteInt; writes
exit ; end main program
main ENDP ; close main procedure
sortArray PROC
;call DumpRegs
MOV EBP, 2
firstLoop:
MOV EAX, [ESI]
MOV EBX, ECX
;call DumpRegs
secondLoop:
MOV EDX, [ESI+EBP]
CMP EAX, EDX
JBE alreadyInOrder
XCHG EAX, EDX
MOV [ESI], EAX
MOV [ESI+EBP], EDX
MOV EAX, [ESI]
call DumpRegs
alreadyInOrder:
ADD EBP, 2
LOOP secondLoop
ADD ESI,2
MOV ECX, EBX
DEC EBX
;call DumpRegs
LOOP firstLoop
RET
sortArray ENDP
END main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
