【问题标题】:Assembly Language (Irvine)-a macro that waits for a keystroke and returns the key that was pressed汇编语言 (Irvine) - 一个等待击键并返回被按下的键的宏
【发布时间】:2016-02-03 20:16:10
【问题描述】:

等待击键并返回按下的键的宏。 宏应包括 ASCII 代码和键盘扫描代码的参数。

我有以下代码,但出现两个错误。错误在下面,我的源代码在它们下面。

错误:

错误 A2006:未定义的 syV

错误 MSB3721:命令“ml.exe /c /nologo /Zi /Fo"调试\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

【问题讨论】:

  • 第 20 行出现错误

标签: assembly macros ascii masm irvine16


【解决方案1】:

您尝试将 16 位实模式代码编译为 32 位保护模式可执行文件。那是行不通的。在ml.exe 的命令行中添加/omf 并确保link16.exe 将用作链接器。

【讨论】:

    猜你喜欢
    • 2015-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-31
    • 1970-01-01
    • 1970-01-01
    • 2014-05-08
    相关资源
    最近更新 更多