2014-12-03 144 views
0

我試圖檢查按鍵「ESC」是否按下。如果按下,我希望用戶能夠輸入文本並在之後立即打印。Emu8086檢查按鍵是否按下

我希望程序隨時檢查用戶是否按ESC。

這是我當前的代碼:

org 100h 
include "emu8086.inc" 


;mov ah, 01h 
;int 16h 

;mov ah, 00h 
;int 16h 

call cleanScreen 

printn "  ___"  
printn "  /\ \"  
printn " /::\ \" 
printn " /:/\ \ \" 
printn " _\:\~\ \ \" 
printn " /\ \:\ \ \__\" 
printn " \:\ \:\ \/__/" 
printn " \:\ \:\__\ " 
printn " \:\/:/ /" 
printn " \::/ /" 
printn "  \/__/" 
printn "Welcome to Sheridan"  

call cleanScreen 

printn "  ___"  
printn "  /\__\"  
printn " /:/ _/_" 
printn " /:/ /\ \" 
printn " /:/ /::\ \" 
printn " /:/_/:/\:\__\" 
printn " \:\/:/ /:/ /" 
printn " \::/ /:/ /" 
printn " \/_/:/ /" 
printn "  /:/ /" 
printn "  \/__/" 
printn "Welcome to Sheridan" 

call cleanScreen 

printn "  ___"  
printn " //\"  
printn " //:/_" 
printn " //:/ /\" 
printn "//:/ /::\" 
printn " /__/:/ /:/\:\" 
printn " \ \:\/:/~/:/" 
printn " \ \::/ /:/" 
printn " \__\/ /:/" 
printn "  /__/:/" 
printn "  \__\/"      
printn "Welcome to Sheridan" 

call cleanScreen 

printn "  ___"  
printn " //\"  
printn " //::\" 
printn " /__/:/\:\" 
printn " _\_ \:\ \:\" 
printn " /__/\ \:\ \:\" 
printn " \ \:\ \:\_\/" 
printn " \ \:\_\:\" 
printn " \ \:\/:/" 
printn " \ \::/" 
printn "  \__\/"  
printn "Welcome to Sheridan" 

cleanScreen proc 
INT 10h 
mov AH,0 
cleanScreen endp 

enterText: ;if ESC is press then get String and Print it 
call get_string     
call print_string              
RET      

hlt 
define_print_string 
define_get_string 
end 

感謝您的幫助!

回答

0

此代碼沒有意義。

cleanScreen proc 
INT 10h 
mov AH,0 
cleanScreen endp 

如果你想通過將其設定清潔屏幕重新再使用

cleanScreen proc 
mov al,3 ;Video mode number 
mov ah,0 ;Function number 
INT 10h 
cleanScreen endp 

等待ESC鍵使用此代碼

enterText: ;if ESC is press then get String and Print it 
mov ah,0 
int 16h 
cmp al,27 
jne enterText 

附:漂亮的ASCII藝術。