電子時鐘顯示系統時間,并且用改寫int 9中斷的方式實作“時間顯示期間能夠鍵入任意字符,顯示到螢屏上”。改寫的int 9中斷代碼如下:
int9:
push ax
push bx
push dx
in al,60h
pushf
pushf
pop bx
and bh,11111100b
push bx
popf
call dword ptr ds:[0]
cmp al, 01h ;esc鍵的掃描碼
jne int9ret
;恢復中斷向量
mov ax,0
mov es,ax
push ds:[0]
pop es:[9*4]
push ds:[2]
pop es:[9*4+2]
mov ax,4c00h
int 21h
int9ret:
mov ah,01h
int 16h
pushf ;檢測當前有無鍵盤輸入
pop bx
and bl,01000000b
cmp bl,01000000b
je over ;沒有鍵盤輸入
mov ah,00h ;有鍵盤輸入就讀取ASCII
int 16h
mov dl,al ;顯示在螢屏上
mov ah,02h
int 21h
over: pop dx
pop bx
pop ax
iret
為什么要加紅色字體的部分,不是觸發int 9中斷就意味著已經有鍵盤輸入了嗎??
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/36640.html
標籤:其他技術討論專區
上一篇:libreoffice將ppt/pptx轉換為pdf,檔案格式錯亂
下一篇:延續伸展
