Skip to content

Instantly share code, notes, and snippets.

@xl00t
Last active May 8, 2022 15:51
Show Gist options
  • Save xl00t/510c6f6912e8418f0861b4020c8c04be to your computer and use it in GitHub Desktop.
Save xl00t/510c6f6912e8418f0861b4020c8c04be to your computer and use it in GitHub Desktop.
.386
.model flat
.data
array DWORD 7,8,9,0,64,10,0,147,14
.code
main proc
xor ecx, ecx
xor eax, eax
lea esi, array
OurLoop:
mov ebx, [esi + ecx * TYPE array]
cmp ebx, eax
jge moveax
here:
inc ecx
cmp ecx, LENGTHOF array
jne OurLoop
ret
moveax:
mov eax, ebx
jmp here
main endp
end main
.386
.model flat
.data
array DWORD 1, 2, 5, 0, 189, 1337, 142, 88
.code
checkgreater proto
main proc
xor ecx, ecx
xor eax, eax
lea esi, array
OurLoop:
mov ebx, [esi + ecx * TYPE array]
invoke checkgreater
inc ecx
cmp ecx, LENGTHOF array
jne OurLoop
ret
main endp
checkgreater proc
cmp ebx, eax
jg moveeax
ret
moveeax:
mov eax, ebx
ret
checkgreater endp
end main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment