Created
April 6, 2014 19:59
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .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