.386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD .data Array WORD 10, 2, 23, 45, 21, 11 MAXIMUM WORD ? .code main PROC mov ecx, LENGTHOF Array ; to loop through every item mov esi, OFFSET Array ; points to the first item of the array mov ax, 0 ; start with 0 as the highest value L1: XXXXXX ; compares current max with current item JAE L2 ; if ax is larger or equal to the current item, no change in ax. Just move to next element XXXXXXX ; update ax with the current element, so it becomes the new max L2: XXXXXXX ; move to the next item of the array loop L1 ; if there are more items, loop again mov MAXIMUM, ax ; finally, move the max value into MAXIMUM INVOKE ExitProcess, 0 main ENDP END main
Please fill in the blanks where all the XXXXXXX is at
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode: DWORD
.data
Array WORD 10, 2, 23, 45, 21, 11
MAXIMUM WORD ?
.code
main PROC
mov ecx, LENGTHOF Array ; to loop through every item
mov esi, OFFSET Array ; points to the first item of the array
mov ax, 0 ; start with 0 as the highest value
L1:
XXXXXX ; compares current max with current item
JAE L2 ; if ax is larger or equal to the current item, no change in ax. Just move to next element
XXXXXXX ; update ax with the current element, so it becomes the new max
L2:
XXXXXXX ; move to the next item of the array
loop L1 ; if there are more items, loop again
mov MAXIMUM, ax ; finally, move the max value into MAXIMUM
INVOKE ExitProcess, 0
main ENDP
END main
Trending now
This is a popular solution!
Step by step
Solved in 2 steps