?? dazi.txt
字號:
;-----------------宏定義------------------
;--清屏宏定義-----------------------------
clear_screen macro op1,op2,op3,op4
mov ah,06h
mov al,00h
mov bh,07h
mov ch,op1
mov cl,op2
mov dh,op3
mov dl,op4
int 10h
mov ah,02h
mov bh,00h
mov dh,00h
mov dl,00h
int 10h
endm
;-----------------------------------------
;--移動光標-------------------------------
move_cur macro x,y
mov ah,02h
mov dh,x
mov dl,y
mov bh,00h
int 10h
endm
;-----------------------------------------
;--字符串輸出-----------------------------
str_print macro x,y,addr_str
mov ah,02h
mov bh,00h
mov dh,x
mov dl,y
int 10h
mov ah,09h
lea dx,addr_str
int 21h
endm
;-----------------------------------------
;-----------------------------------------
stack segment para stack 'stack'
db 64 dup(?)
stack ends
;-----------------------------------------
data segment
str_welcome db 'WELCOME TO PLAY$'
str_copy db 'Edit:leiyuming 20054973$'
str_data db 'date:2008/1/5$'
str_message db 'press Enter key to continue.......$'
str_quit db 'press ESC to quit.$'
str_letter db 'asdfghjkl;zxcvbnm,./$'
str_tip_1 db 'press ESC to back$'
str_tip_2 db ''
str_warn_1 db 'you press a wrong key.$'
buffer db 100 dup(0)
buffer_ip db 0
cur_position db 2 dup(?)
old_cs dw ?
old_ip dw ?
wrong db 0 ;按下了多少次退格鍵
data ends
;-----------------------------------------
code segment
assume cs:code,ds:data,ss:stack
;--主程序------------------
main proc
start:
mov ax,data
mov ds,ax
clear_screen 00d,00d,24d,79d
str_print 05d,15d,str_welcome
str_print 07d,15d,str_copy
str_print 09d,15d,str_data
str_print 11d,15d,str_message
str_print 013d,15d,str_quit
mov ah,01h ;從鍵盤輸入任意字符
int 21h
cmp al,00011011b
jz exit ;是ESC鍵被按下,退出
clear_screen 00d,00d,24d,79d
mov ah,35h ;獲取鍵盤中服地址
mov al,09h
int 21h
mov old_cs,es
mov old_ip,bx
push ds ;修改鍵盤中服地址
mov dx,seg kbint
mov ds,dx
mov dx,offset kbint
mov al,09h
mov ah,25h
int 21h
pop ds
sti
str_print 00d,20d,str_tip_1
str_print 02d,01d,str_letter
move_cur 03d,01d
mov ah,09h
int 21h
;q: jmp q
exit:
push ds
mov dx,old_ip
mov ax,old_cs
mov ds,ax
mov al,09h
mov ah,25h
int 21h
pop ds
mov ah,4ch ;程序退出
int 21h
main endp
;------------------------------------------
;--鍵盤輸入調用----------------------------
kbint proc near
push ax ;寄存器保護
push bx
kbint_exit:
pop bx
pop ax
iret
kbint endp
code ends
end start
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -