0% found this document useful (0 votes)
126 views1 page

Finding The Maximum Number Assembly Code

This assembly code finds the maximum number in an array of numbers input by the user. It uses loops and conditional jumps to compare each number, store the largest in a variable, and output the maximum number.

Uploaded by

Ann Juvie Papas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views1 page

Finding The Maximum Number Assembly Code

This assembly code finds the maximum number in an array of numbers input by the user. It uses loops and conditional jumps to compare each number, store the largest in a variable, and output the maximum number.

Uploaded by

Ann Juvie Papas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

; finding the maximum number assembly code

ok: mov si,offset store mov cx,3 loopmov: mov bl,[si] mov al,[si+1] cmp bl, al ja pushsi1 mov var,al pushsi1: mov var,bl mov dl,var2 cmp dl,var ja dakovar2 mov ah,var mov var2,ah jmp increment dakovar2: mov al,var2 mov var2,al increment: inc si loop loopmov mov ah,09 lea dx,str3 int 21h mov ah,2 mov dl,var2 int 21h int 20h ret

jmp start str1 db "String: $" str2 db 13,10,"Error $" store db 4 dup(' ') str3 db 0dh,0ah,"Maximum: $" var db 0 var2 db 0 start: mov ah,09 lea dx,str1 int 21h mov cx,3 mov si, offset store mov ah,01h

Author: Ann Juvie S. Papas BSCS 3 University of Southeastern Philippines [email protected]

string_input: int 21h mov [si],al inc si loop string_input mov si, offset store mov cx,3 check: mov al,[si] cmp al,30h jb error cmp al,39h ja error inc si loop check jmp ok error: mov ah,09 lea dx,str2 int 21h jmp start

You might also like