用汇编在屏幕上开出了一个窗口,左上角(5,50),右下角(15,70,光标首先定位在窗口最下面行首,从键盘输入字符,显示在窗口,当按enter或一行显示满后,窗口自动向上滚动一行,输入的字符继续位于最低行,窗口最高一行上卷后消失,程序以esc键退出
- data segment
- num dw 0
- divisor dw 20
- point db 5,50,15,70
- data ends
- stack segment stack
- stk db 200h dup(?)
- stack ends
- code segment
- assume cs:code,ds:data,ss:stack
- main proc near
- mov ax,data
- mov ds,ax
- mov ax,600h
- mov bh,111b
- mov cx,0
- mov dh,25
- mov dl,80
- int 10h
- mov ah,2h
- mov bh,0
- mov dh,point[2]
- mov dl,point[1]
- int 10h
- show: mov ah,8h
- int 21h
- cmp al,1bh
- je exit
- cmp al,0dh
- je cr
- cmp al,8h
- je back
- cmp al,20h
- jb show
- mov dl,al
- mov ah,2h
- int 21h
- inc num
- mov ax,num
- mov dx,0
- div divisor
- mov num,dx
- cmp dx,0
- je cr
- jmp short show
- exit: mov ah,4ch
- int 21h
- cr: push ax
- push bx
- push cx
- push dx
- mov ax,601h
- mov bh,111b
- mov ch,point[0]
- mov cl,point[1]
- mov dh,point[2]
- mov dl,point[3]
- int 10h
- mov ah,3h
- mov bh,0
- int 10h
- mov ah,2h
- mov dl,point[1]
- int 10h
- pop dx
- pop cx
- pop bx
- pop ax
- jmp near ptr show
- back: push ax
- push bx
- push cx
- push dx
- hide: mov ah,3h
- mov bh,0
- int 10h
- dec dl
- cmp dl,point[1]
- jb line
- mov ah,2h
- int 10h
- sub dl,point[1]
- mov dh,0
- mov num,dx
- mov ah,9h
- mov al,' '
- mov bx,111b
- mov cx,1
- int 10h
- pop dx
- pop cx
- pop bx
- pop ax
- jmp near ptr show
- line: push ax
- push bx
- push cx
- push dx
- mov ax,701h
- mov bh,111b
- mov ch,point[0]
- mov cl,point[1]
- mov dh,point[2]
- mov dl,point[3]
- int 10h
- mov ah,2h
- mov bh,0
- mov dh,point[2]
- mov dl,point[3]
- int 10h
- pop dx
- pop cx
- pop bx
- pop ax
- jmp near ptr hide
- main endp
- code ends
- end main
阅读(2636) | 评论(0) | 转发(0) |