这是我的代码:
.model small
.stack 100h
.data
A db 2,-5,3,4,-8
N equ 5
.code
mov ax, @data
mov ds, ax
mov si,offset A
mov cl,1
start:
cmp cl,N
je sof
mov al,[si]
cmp al,[si+1]
jg change
jmp next
change:
mov ah,al
mov al,[si+1]
mov [si],ah
mov [si+1],al
jmp next
next:
inc si
inc cl
jmp start
sof:
mov ah,9
mov cx, offset A
int 21h
.exit
end
我得到一个奇怪的出现了许多奇怪的字符:/
答案 0 :(得分:1)
您需要为0到9范围内的数字添加30h才能显示ascii字符。要显示字符,请使用
;al = digit to display
mov dl,al
add dl,030h
mov ah,02 ;display character (in dl)
int 21h