汇编语言 (Irvine) - 等待击键和 returns 按下的键的宏
Assembly Language (Irvine)-a macro that waits for a keystroke and returns the key that was pressed
等待击键的宏和 returns 被按下的键。
宏应包含 ASCII 码和键盘扫描码的参数。
我有以下代码,但出现两个错误。错误在下面,下面是我的源代码。
错误:
error A2006: undefined syV
error MSB3721: The command "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"" exited
with code 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
您试图将 16 位实模式代码编译为 32 位保护模式可执行文件。那行不通的。在ml.exe
的命令行中添加一个/omf
并确保link16.exe
将用作链接器。
等待击键的宏和 returns 被按下的键。 宏应包含 ASCII 码和键盘扫描码的参数。
我有以下代码,但出现两个错误。错误在下面,下面是我的源代码。
错误:
error A2006: undefined syV
error MSB3721: The command "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"" exited with code 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
您试图将 16 位实模式代码编译为 32 位保护模式可执行文件。那行不通的。在ml.exe
的命令行中添加一个/omf
并确保link16.exe
将用作链接器。