2015-11-03 117 views
1

等待按鍵並返回按下的鍵的宏。 宏應該包含ASCII代碼和鍵盤掃描代碼的參數。彙編語言(Irvine) - 一個等待按鍵並返回按下的鍵的宏

我有以下代碼,但我得到兩個錯誤。這些錯誤在我的源代碼下面。

錯誤:

錯誤A2006:未定義SYV

錯誤MSB3721:該命令 「ML.EXE/C/NOLOGO /紫 /Fo"Debug\ch10_01.obj」/ FL「zprob1 .LST」/I 「C:\歐文」/ W3 /errorReport:提示/Ta"....\ASM解\ CH10 \ ch10_01.asm 「」 與代碼1個

源代碼退出 :

INCLUDE Irvine16.inc 
ASSUME DS:_DATA 

mReadkey MACRO ascii, scan 
    mov ah,10h  ; BIOS keyboard input function 
    int 16h 
    mov scan,ah 
    mov ascii,al 
ENDM 

.data 
ascii BYTE ? 
scan BYTE ? 
str1 BYTE "ASCII code: ",0 
str2 BYTE "Scan code: ",0 

.code 
main PROC 
mov ax,@data 
mov ds,ax 

; Wait for a key; when the macro returns, the two arguments 
; contain the ASCII code and scan code of the key. 
mReadkey ascii, scan 

; Display the values. 
    mov edx,OFFSET str1 
    call WriteString 
    movzx eax,ascii 
    call WriteHex 
    call Crlf 

    mov edx,OFFSET str2 
    call WriteString 
    movzx eax,scan 
    call WriteHex 
    call Crlf 

    exit 
main ENDP 
END main 
+0

錯誤在線20 –

回答

2

您試圖將16位實模式代碼編譯爲32位受保護模式的可執行文件。這是行不通的。將/omf添加到命令行ml.exe,並確保link16.exe將用作鏈接器。

相關問題