So, I keep getting this error in my assembly code and I don't know how to fix it
1>..\finalTe2.asm(175): warning A6004: procedure argument or local not referenced : address
Here is my declaration of the procedure and its parameters
displayBoard PROTO address:DWORD
and here is how I use it
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
I saw the other post about this same error, and I tried what they said, but it didn't work. I have this error on all of my procedures, and I just can't seem to get rid of them.
With most C compilers, int foo(int x) { return 0; }
would warn about unused x
whether or not you had a prototype before the definition.
This is the asm version of that: you're not using the parameter in the definition, I assume.
MASM probably doesn't notice that mov ESI, [EBP + 12]
is accessing your function arg; to keep it happy you'd probably have to use mov ESI, address
which is confusing (if you're not used to MASM) because that looks like a static symbol name, not a stack address with a base register!
If you don't like MASM, you don't have to use it. NASM works well. (Although you might be stuck with MASM for Irvine32. I think you can avoid using its parameter declaration stuff, though, and just write plain asm where you keep track of what you're doing with the stack / registers on your own. i.e. it's not going to complain if you push
stuff or put it in registers before a call
the normal way.)