Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Zulqurnain/c815414e858aaa09c92d to your computer and use it in GitHub Desktop.
Save Zulqurnain/c815414e858aaa09c92d to your computer and use it in GitHub Desktop.
[Assembly] Write a procedure in Assembly Language that finds a largest number in an array and store it in AX, assume that array offset is in BX and array length is in CX.
.model small ;preprocessors
data_seg segment 'data'
vargaye dw 1,0,5,8,3
data_seg ends
stack_seg segment 'stack'
db 100h dup(?)
stack_seg ends
code_seg segment 'code';code area
assume cs:code_seg,ss:stack_seg
Program proc far
mov ax,data_seg
mov ds,ax
mov si,0
mov ax,[vargaye]
Buhaha:
cmp ax,[vargaye+si]
jg direct
mov ax,[vargaye+si]
direct: add si,2
cmp si,10
jne Buhaha
mov ax,4c00h ;for dos
int 21h ;for dos
Program endp
code_seg ends
end Program ;termination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment