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 MASM I got the error:
C:UserswinDesktoplabasm : error A: invalid instruction operands NUM: Macro Called From
C:UserswinDesktoplabasm: Main Line Code
C:UserswinDesktoplabasm : error A: syntax error: eax
Assembly Error
Press any key to continue.
I will provide you the program to doublecheck 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:
model flat, stdcall
option casemap:none
include masmincludewindowsinc ; For Windows API types and definitions
include masmincludeuserinc ; For using MessageBox
include masmincludekernelinc ; For using ExitProcess
include masmincludemasminc ; For using FloatToStr and other utilities
includelib masmlibuserlib ; Library for MessageBox
includelib masmlibkernellib ; Library for ExitProcess
NUM macro Q M N O
MOV AL O ; Copy number O to register AL
CBW ; Signextend AL to AX
INC AL ; Increment AL by
MOV BL N ; Copy number N to register BL
IMUL BL ; Multiply AL by BL cb
MOV CL M ; Copy number M to register CL
SAR CL ; Rightshift CL by bits a
SUB AL CL ; Subtract CL from AL
MOV Q AL ; Store the result in Q
endm
data
msgtitle db "Lab
buffer db dup
format db A dB dC db cb aab d
A db
B db
C db
D dd
E dd
F dd
code
start:
MOV EDI, ; Initialize EDI to
CYCLE:
CMP EDI,
jz CONT
NUM BX AEDI BEDI CEDI ; Invoke NUM macro with correct arguments
DEN EAX, AEDI BEDI ; Change AX to EAX
TEST EAX,
JNZ OD
SAR EAX, ; Change AX to EAX
JMP CONT
OD:
MOV EAX,
IMUL EBX, ; 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 AEDI
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 BEDI
movsx EAX, byte ptr ESI ; Load the value at the calculated address
mov E EAX ; Store the result in E
mov ESI, OFFSET C ; Get the address of the first element in C
add ESI, EDI ; Add EDI to this address to access CEDI
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, addr buffer, addr msgtitle, MBOK
INC EDI
JMP CYCLE
CONT:
invoke ExitProcess,
end start
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
