等待击键并返回按下的键的宏。宏应包括 ASCII 代码和键盘扫描代码的参数。
我有以下代码,但出现两个错误。错误在下面,我的源代码在它们下面。
错误:
错误 A2006:未定义的 syV
错误 MSB3721:命令 "ml.exe /c /nologo /Zi /Fo"Debug\ch10_01.obj" /Fl"zprob1.lst" /I "c:\Irvine" /W3 /errorReport:prompt /Ta".. ..\ASM Solutions\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