三角字符阵列图形
编程实现输入任意整数n后,可打印出n行三角字符阵列图形。例如,输入整数5时,程序运行结果如下:Enter a number:5
A C F J O
B E I N
D H M
G L
K
data segment nm db 0 row db 0 col db 0 row1 db 0 col1 db 0 count db 0 chr db 'A' message db 'Enter a number(1~9):','$' crlf db 13,10,'$' data ends code segment main proc far assume cs:code,ds:data start: push ds sub ax,ax push ax mov ax,data mov ds,ax lea dx,message mov ah,9 int 21h flag1: mov ah,1 int 21h cmp al,0dh jz exit1 cmp al,'1' jb flag2 cmp al,'9' ja flag2 jmp flag3 flag2: mov dl,08h mov ah,2 int 21h mov dl,20h int 21h mov dl,08h int 21h jmp flag1 flag3: sub al,30h mov nm,al mov ah,7 mov al,0 mov cx,0 mov dx,184fh mov bh,7 int 10h mov cx,0 jmp flag5 exit1: jmp exit flag5: inc cx push cx loop1: mov bh,0 mov dh,row1 mov dl,col1 mov ah,2 int 10h mov dl,chr add dl,count int 21h mov dl,' ' int 21h dec row1 inc col1 inc col1 inc count cmp count,26 jnz flag6 mov count,0 flag6: loop loop1 pop cx cmp cl,nm jz exit2 inc row mov al,row mov row1,al mov al,col mov col1,al jmp flag5 exit2: mov ch,0 mov cl,nm dec cl cmp cl,0 jz exit lea dx,crlf mov ah,9 loop2: int 21h loop loop2 exit: ret main endp code ends end start