How to fix my Assmbely Language Code: *The number in the ( ) is the line number
ID: 3839502 • Letter: H
Question
How to fix my Assmbely Language Code:
*The number in the ( ) is the line number
----------------------------------------------------
INCLUDE Irvine32.inc
SetColor PROTO,fore:BYTE,back:BYTE
WriteColorChar PROTO,fore:BYTE,back:BYTE,char1:BYTE
DrawOddRow PROTO
DrawEvenRow PROTO
.data
rows=8
cols=8
colorConstant DWORD ?
.code
main PROC
call Clrscr
mov ecx,16
mov colorConstant,0
L1:
push ecx
mov ecx,rows/2
L2:
call DrawOddRow
call Crlf
call DrawEvenRow
call Crlf
loop L2
mov eax,50
call Delay
inc colorConstant
pop ecx
loop L1
exit
main ENDP
DrawOddRow PROC
mov ecx,cols/2
L1:
(35)INVOKE WriteColorChar,colorConstant,colorConstant,'0'
(36)INVOKE WriteColorChar,colorConstant,colorConstant,'0'
(37)INVOKE WriteColorChar,white,white,'0'
(38)INVOKE WriteColorChar,white,white,'0'
loop L1
ret
DrawOddRow ENDP
DrawOddEven PROC
mov ecx,cols/2
L1:
(45)INVOKE WriteColorChar,white,white,'0'
(46)INVOKE WriteColorChar,white,white,'0'
(47)INVOKE WriteColorChar,colorConstant,colorConstant,'0'
(48)INVOKE WriteColorChar,colorConstant,colorConstant,'0'
loop L1
ret
DrawOddEven ENDP
SetColor PROC USES eax,
fore:BYTE,
back:BYTE
(55)mov eax,fore+(back*16)
call SetTextColor
ret
SetColor ENDP
WriteColorChar PROC USES eax,
fore:BYTE,
back:BYTE,
char1:BYTE
INVOKE SetColor,fore,back
mov al,char1
call WriteChar
ret
WriteColorChar ENDP
END main
------------------------------------------
1>1.asm(35): error A2114: INVOKE argument type mismatch : argument : 2
1>1.asm(35): error A2114: INVOKE argument type mismatch : argument : 1
1>1.asm(36): error A2114: INVOKE argument type mismatch : argument : 2
1>1.asm(36): error A2114: INVOKE argument type mismatch : argument : 1
1>1.asm(47): error A2114: INVOKE argument type mismatch : argument : 2
1>1.asm(47): error A2114: INVOKE argument type mismatch : argument : 1
1>1.asm(48): error A2114: INVOKE argument type mismatch : argument : 2
1>1.asm(48): error A2114: INVOKE argument type mismatch : argument : 1
1>1.asm(55): error A2026: constant expected
Explanation / Answer
INVOKE argument type mismatch : argument number
Here the type of the arguments passed using the INVOKE directive did not match the type of the parameters in the prototype of the procedure being invoked is causing the problem.
INCLUDE Irvine32.inc
.data
ccolor DWORD 13
bcolor DWORD 16
SetColor PROTO,cc:DWORD,bc:DWORD
prompt BYTE "Hi",0
.code
main PROC
INVOKE SetColor,ccolor,bcolor
mov edx,OFFSET prompt
call WriteString
exit
main ENDP
SetColor PROC,cc:DWORD,bc:DWORD
mov eax,cc
add eax,bc
call SetTextColor
ret
SetColor ENDP
END main
When i run this sample code, im not getting this error, try to change your code according to this structure.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.