⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keybrd.asm

📁 汇编语言 参考书 包含作业与答案 从入门到精通 通俗易懂
💻 ASM
字号:
; This sample shows the
; use of keyboard functions.
; Try typing something to
; "User Screen". 
;
; When "step delay" is too
; long, keyboard buffer
; is used.
;
; Try setting "step delay"
; to 1, for more realistic
; emulation.
;
; This code will loop until
; you press ESC key, other
; keys will be printed.


#make_COM#

; Used to print a message:
include 'emu8086.inc'

ORG     100h

; Print a welcome message:
LEA     SI, msg1
CALL    print_string

;============================
; Eternal loop to get
; and print keys:

wait_for_key:

; check for keystroke in
; keyboard buffer:
        MOV     AH, 1
        INT     16h
        JZ      wait_for_key

; get keystroke from keyboard:
; (remove from the buffer)
MOV     AH, 0
INT     16h

; print the key:
MOV     AH, 0Eh
INT     10h

; press 'ESC' to exit:
CMP     AL, 1Bh
JZ      exit

JMP     wait_for_key
;============================

exit:
RET

DEFINE_PRINT_STRING

msg1 DB 'Type anything...', 13, 10
     DB '[Enter] - carriage return.', 13, 10
     DB '[Ctrl]+[Enter] - line feed.', 13, 10
     DB 'You will hear a beep', 13, 10
     DB '    when buffer is overflown.', 13, 10
     DB 'Press ESC to exit.', 13, 10, 0

END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -