Answer the question
In order to leave comments, you need to log in
How to display numbers greater than 9 in the console?
The essence of the task is to find min and max in a one-dimensional array, and print the result max-min, I can’t figure out how to print numbers> 9, please help
org 100h
Start:
mov cx, 10
mov si, Mas
sub si, 1
mov bl, byte[si+1]
mov bh, byte[si+1]
A1:
inc si
mov al, byte [si]
cmp al, bl
ja B1
cmp al, bh
jb B2
jmp A2
B2:
mov bh, al
jmp A2
B1:
mov bl, al
A2:
loop A1
Exit:
mov dx, Str1
mov ah, 09h
int 21h
mov dl, bl
add dl, 30h
mov ah, 02h
int 21h
mov dx, Str2
mov ah, 09h
int 21h
mov dl, bh
add dl, 30h
mov ah, 02h
int 21h
mov dx, Str3
mov ah, 09h
int 21h
sub bl, bh
mov dl, bl
add dl, 30h
mov ah, 02h
int 21h
mov ah, 08h
int 21h
ret
Mas db 1, 2, 3, 4, 5, 6, 8, 7, 5, 9
Str1 db "Max = $"
Str2 db 10, 13, "Min = $"
Str3 db 10, 13, "result = $"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question