警告 A6004:未引用过程参数或局部:地址 MASM 程序集
warning A6004: procedure argument or local not referenced : address MASM assembly
所以,我的汇编代码中一直出现这个错误,我不知道如何修复它
1>..\finalTe2.asm(175): warning A6004: procedure argument or local not referenced : address
这是我对程序及其参数的声明
displayBoard PROTO address:DWORD
下面是我的使用方法
displayBoard PROC address:DWORD
.data
boardRow BYTE '----------------', 0Ah, 0Dh, 0
boardColumn BYTE '|', 0
.code
push EBP
mov EBP, ESP
mov ESI, [EBP + 12] ;The address of the 2D array on the stack
mov ECX, 3h ;Loop 3 times for the number of rows
BOARD1:
mov EDX, OFFSET boardRow ;Display the first set of row characters
coutS
push ECX ;preserve ECX
clearECX
mov ECX, 3h ;Loop 3 times for the number of columns
BOARD2:
mov EDX, OFFSET boardColumn ;display the first column character
coutS
invoke displayCell, ESI ;Call the proc that assigns the color of each cell
inc ESI ;Inc ESI to step through the 2D array this is used in the testCell proc
loop BOARD2
pop ECX
mov EDX, OFFSET boardColumn
coutS
call crlf
loop BOARD1
mov EDX, OFFSET boardRow
coutS
pop EBP
ret
displayBoard ENDP
我看到另一个 post 关于同样的错误,我尝试了他们所说的,但没有用。我的所有程序都有这个错误,而且我似乎无法摆脱它们。
对于大多数 C 编译器,int foo(int x) { return 0; }
会警告未使用 x
无论您在定义之前是否有原型。
这是它的汇编版本:我假设您没有在定义中使用参数。
MASM 可能没有注意到 mov ESI, [EBP + 12]
正在访问您的函数 arg; 为了让它开心,您可能不得不使用 mov ESI, address
,这很令人困惑(如果您不习惯 MASM),因为它看起来像静态符号名称,而不是带基址寄存器的堆栈地址!
如果您不喜欢 MASM,则不必使用它。 NASM 效果很好。 (虽然你可能会被 Irvine32 的 MASM 困住。不过我认为你可以避免使用它的参数声明的东西,而只是编写普通的 asm,你可以在其中跟踪你自己对堆栈/寄存器所做的事情。即它是如果你 push
东西或在 call
之前以正常方式将其放入寄存器,则不会抱怨。)
所以,我的汇编代码中一直出现这个错误,我不知道如何修复它
1>..\finalTe2.asm(175): warning A6004: procedure argument or local not referenced : address
这是我对程序及其参数的声明
displayBoard PROTO address:DWORD
下面是我的使用方法
displayBoard PROC address:DWORD
.data
boardRow BYTE '----------------', 0Ah, 0Dh, 0
boardColumn BYTE '|', 0
.code
push EBP
mov EBP, ESP
mov ESI, [EBP + 12] ;The address of the 2D array on the stack
mov ECX, 3h ;Loop 3 times for the number of rows
BOARD1:
mov EDX, OFFSET boardRow ;Display the first set of row characters
coutS
push ECX ;preserve ECX
clearECX
mov ECX, 3h ;Loop 3 times for the number of columns
BOARD2:
mov EDX, OFFSET boardColumn ;display the first column character
coutS
invoke displayCell, ESI ;Call the proc that assigns the color of each cell
inc ESI ;Inc ESI to step through the 2D array this is used in the testCell proc
loop BOARD2
pop ECX
mov EDX, OFFSET boardColumn
coutS
call crlf
loop BOARD1
mov EDX, OFFSET boardRow
coutS
pop EBP
ret
displayBoard ENDP
我看到另一个 post 关于同样的错误,我尝试了他们所说的,但没有用。我的所有程序都有这个错误,而且我似乎无法摆脱它们。
对于大多数 C 编译器,int foo(int x) { return 0; }
会警告未使用 x
无论您在定义之前是否有原型。
这是它的汇编版本:我假设您没有在定义中使用参数。
MASM 可能没有注意到 mov ESI, [EBP + 12]
正在访问您的函数 arg; 为了让它开心,您可能不得不使用 mov ESI, address
,这很令人困惑(如果您不习惯 MASM),因为它看起来像静态符号名称,而不是带基址寄存器的堆栈地址!
如果您不喜欢 MASM,则不必使用它。 NASM 效果很好。 (虽然你可能会被 Irvine32 的 MASM 困住。不过我认为你可以避免使用它的参数声明的东西,而只是编写普通的 asm,你可以在其中跟踪你自己对堆栈/寄存器所做的事情。即它是如果你 push
东西或在 call
之前以正常方式将其放入寄存器,则不会抱怨。)