Question: I have issue when I run the program on MASM 3 2 I got the error: C: Users win 1 1 Desktop

I have issue when I run the program on MASM32 I got the error:
C:\Users\win11\Desktop\lab5.asm(52) : error A2070: invalid instruction operands NUM(18): Macro Called From
C:\Users\win11\Desktop\lab5.asm(52): Main Line Code
C:\Users\win11\Desktop\lab5.asm(53) : error A2008: syntax error: eax
Assembly Error
Press any key to continue.
I will provide you the program to double-check what is issue and please test it from your end and provide me the right answer as I already asked previous experts and their answers were not helpful.
Here is the program:
.486
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc ; For Windows API types and definitions
include \masm32\include\user32.inc ; For using MessageBox
include \masm32\include\kernel32.inc ; For using ExitProcess
include \masm32\include\masm32.inc ; For using FloatToStr and other utilities
includelib \masm32\lib\user32.lib ; Library for MessageBox
includelib \masm32\lib\kernel32.lib ; Library for ExitProcess
NUM macro Q, M, N, O
MOV AL, O ; Copy number O to register AL
CBW ; Sign-extend AL to AX
INC AL ; Increment AL by 1
MOV BL, N ; Copy number N to register BL
IMUL BL ; Multiply AL by BL (c*b)
MOV CL, M ; Copy number M to register CL
SAR CL,2 ; Right-shift CL by 2 bits (a/4)
SUB AL, CL ; Subtract CL from AL
MOV Q, AL ; Store the result in Q
endm
.data
msg_title db "Lab 5",0
buffer db 256 dup(?)
format db "A =%d",10,"B =%d",10,"C =%d",10,"(b + c*b - a/4)/(a*b -1)=%d",0
A db -4,8,4,12,-8
B db -3,2,-2,2,3
C0 db -8,15,12,35,-10
D dd 0
E dd 0
F dd 0
.code
start:
MOV EDI, 0 ; Initialize EDI to 0
CYCLE:
CMP EDI, 5
jz CONT1
NUM BX, A[EDI], B[EDI], C0[EDI] ; Invoke NUM macro with correct arguments
DEN EAX, A[EDI], B[EDI] ; Change AX to EAX
TEST EAX, 1
JNZ OD
SAR EAX, 1 ; Change AX to EAX
JMP CONT
OD:
MOV EAX, 5
IMUL EBX, 5 ; Change BL to EBX
CONT:
mov ESI, OFFSET A ; Get the address of the first element in A
add ESI, EDI ; Add EDI to this address to access A[EDI]
movsx EAX, byte ptr [ESI] ; Load the value at the calculated address
mov D, EAX ; Store the result in D
mov ESI, OFFSET B ; Get the address of the first element in B
add ESI, EDI ; Add EDI to this address to access B[EDI]
movsx EAX, byte ptr [ESI] ; Load the value at the calculated address
mov E, EAX ; Store the result in E
mov ESI, OFFSET C0 ; Get the address of the first element in C0
add ESI, EDI ; Add EDI to this address to access C0[EDI]
movsx EAX, byte ptr [ESI] ; Load the value at the calculated address
mov F, EAX ; Store the result in F
invoke wsprintf, addr buffer, addr format, D, E, F, EBX ; Change eax to EBX
invoke MessageBox, 0, addr buffer, addr msg_title, MB_OK
INC EDI
JMP CYCLE
CONT1:
invoke ExitProcess, 0
end start

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!