0

i should to move the biggest value to the last index in the array then to print the array.
when i print it i get things like letters, smiles...
what is the wrong in the code?

.model small
.stack 100h
.data
array db 3,8,5,3
n equ 4
b db dup 6 ('$')
.code
mov ax,@data
mov ds,ax
mov cl,0
mov si ,offset array
mov di ,offset b
mov ax,[si]
myloop:
cmp cl,n-1
je theend
cmp ax,[si+1]
jb next 
cmp ax,[si+1]
jae continue
next:
mov di ,ax
add di ,48
jmp my
continue:
mov di,[si+1]
add di,48
jmp my
my:
inc si
inc di
inc cl
theend:
mov ah,9
mov dx,di
int 21h
.exit
end
2
Contributors
1
Reply
6
Views
11 Months
Discussion Span
Last Post by rproffitt
0

I see the ASCII for 3 is indeed a heart. http://ascii-table.com/codepage.php?863

So nothing wrong with your code at all. It does what you told it to do. Now I would be guessing you wanted to print a number but that's not what you asked in your code or your post. Think carefully about your questions and specifications here.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.