A
A
Alertoso2021-02-21 18:35:32
assembler
Alertoso, 2021-02-21 18:35:32

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

1 answer(s)
G
galaxy, 2021-02-21
@galaxy

One number, obviously. The algorithm is something like this:

num = 183
count = 0
while num > 0:
  push num % 10
  count++
  num = num / 10

while count > 0:
  count--
  pop digit
  print digit // через int 21h ah=02h

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question