汇编语言循环的问题
题目:按15*16列的表格形式显示ASCII码为10H-100H的所有字符,即以行为主的顺序及ASCII码递增的次序依次显示对应的字符.每16个字符为一行,每行中相邻两个字符之间用空白符(ASCII码为0)隔开
datarea segment
datarea ends
prognam segment
main proc far
assume cs:prognam, ds:datarea, es:datarea
start: ;starting execution address
;set up stack for return
push ds
sub ax, ax
push ax
;set DS register to current data segment
mov ax, datarea
mov ds, ax
mov es, ax
;MAIN PART OF PROGRAM GOES HERE
mov dl, 10h
mov cx, 20h
mov ax, 101h
print:mov ah, 02h
int 21h
inc dl
push dx ;输出空格
mov dl, 0h
mov ah, 02h
int 21h
pop dx
dec cx
loop print
push dx ;输出换行回车
mov dx, 0Ah
mov ah, 02h
int 21h
mov dx, 0Dh
mov ah, 02h
int 21h
pop dx
cmp dx, ax ;前面都没问题,能显示一行和换行,只是加上这两行后
jnz print ;是死循环,这是怎么一回事呢
ret ;return to DOS
main endp ;end of main part of program
;---------------------------------------------------------------------
prognam ends ;end of code segment
;*********************************************************************
end start ;end assembly