📄 913.asm
字号:
;例 在屏幕中心的小窗口显示字符。
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;eg9-13.asm
;Purpose: display characters in a window until Esc pressed
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
.model small
;--------------------------------------------------------------
;--------------------------------------------------------------
.code
Esc_key equ 1bh ;ASCII of Esc key
win_ulc equ 30 ;window upper left column
win_ulr equ 8 ;window upper left row
win_lrc equ 50 ;window lower right column
win_lrr equ 16 ;window lower right row
win_width equ 20 ;width of window
;include cls.inc ;clear the screen
; Main program
start:
call clear_screen ;clear the screen
locate:
mov ah,2 ;to locate cursor
mov dh,win_lrr ;dx<=start position
mov dl,win_ulc
mov bh,0 ;page# <= 0
int 10h ;call video BIOS
; get characters from kbd
mov cx, win_width ;cx <= width of window
get_char:
mov ah,1 ;to accept input
int 21h ;call DOS
cmp al,Esc_key ;judge whether Esc pressed
jz exit
loop get_char ;get another
;scroll up
mov ah,6 ;scroll up function
mov al,1 ;number of scroll lines
mov ch,win_ulr ;upper left row
mov cl,win_ulc ;upper left column
mov dh,win_lrr ;lower right row
mov dl,win_lrc ;lower right column
mov bh,7 ;attribute: normal
int 10h ;call video BIOS
jmp locate
exit:
mov ax,4c00h
int 21h
clear_screen proc
push ax
push bx
push cx
push dx
mov ah,6
mov al,0
mov bh,7
mov ch,0
mov cl,0
mov dh,24
mov dl,79
int 10h
mov dx,0
mov ah,2
int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
;----------------------------------------------------------------
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -