📄 huibianyili.txt
字号:
从键盘输入一个字符,要求调用bios中断,并用八进制的形式显示其扫描码和ascii码
;*************************☆ Keyboard I/O test ☆**********************
; -(2003 414 901)
;print out scan code and ASCII of any key
;QUFU Normal university
;Institute of Computer Science and Technology
;----------------------------------------------------------------------
data segment
msg1 db 0dh,0ah,' CHAR Scancode ASCII',0dh,0ah,'$'
msg2 db ' $'
data ends
;----------------------------------------------------------------------
stack segment para stack 'stack'
db 64 DUP(?)
stack ends
;----------------------------------------------------------------------
pro_nam segment
;----------------------------------------------------------------------
main proc far
assume cs:pro_nam,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov dx, offset msg1
mov ah,09h
int 21h
again:
mov ah,0
int 16h
cmp ah, 01h ;is ESC?
je exit ;yes,exit to DOS
mov bx,ax
mov dx,offset msg2
mov ah,9h
int 21h
mov dl,bl ; print character
mov ah,2h
int 21h
call display ; print scancode
mov bh,bl
call display ; print ASCII
mov dl,0ah ; print CR
mov ah,2h
int 21h
mov dl,0dh ; and LF
mov ah,2h
int 21h
jmp again
exit: ret
main endp
;----------------------------------------------------------------------
display proc near
push bx
mov ch,3
mov cl,3
shr bx,1
mov dx,offset msg2
mov ah,9h
int 21h
rotate:
rol bx,cl
mov al,bl
and al,07h
add al,30h
print:
mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate
pop bx
ret
display endp
;----------------------------------------------------------------------
pro_nam ends
;**********************************************************************
end start
;--------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -