您的位置:首页 > 其它

汇编语言: .写一段子程序 SKIPLINES,完成输出空行的功能。空行的行数由用户在主程序中通过 键盘输入,并将行数放在 AX 寄存器中。

2017-06-05 19:52 1031 查看
写一段子程序 SKIPLINES,完成输出空行的功能。空行的行数由用户在主程序中通过 键盘输入,并将行数放在 AX 寄存器中。

data segment

spaceline db 0dh,0ah,'$'

data ends

stack segment stack
dw 20h dup(?)
top label word
stack ends

code segment
assume ds:data,cs:code,ss:stack
p proc far

mov ax,data
mov ds,ax

mov ax,stack
mov ss,ax
lea sp,top

mov cx,5
xor bx,bx

l2: mov ah,01h
int 21h
cmp al,0dh
je input

and ax,1111b
xchg ax,bx
mov si,10
mul si
jc exit
add bx,ax
jc exit
loop l2

input:

mov cx,16
l3: rol bx,1
mov dl,bl
and dl,1
add dl,30h
mov ah,02h
int 21h
loop l3

mov ax,bx
call SKIPLINES
jmp exit

;in ax
SKIPLINES proc near
mov cx,ax
l1: lea dx,spaceline
mov ah,09
int 21h
loop l1
ret
SKIPLINES endp

exit:
mov ah,4ch
int 21h

p endp
code ends
end p
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐