Question: I have this assembler program in MASM i need to do: . 4 8 6 . model flat, stdcall option casemap: none include masm
I have this assembler program in MASM i need to do:
model flat, stdcall
option casemap: none
include masmincludewindowsinc ; For a management by the modes of Window
include masmincludeuserinc ; For using MessageBox
include masmincludekernelinc ; For using ExitProcess
include masmincludemasminc ; For using FloatToStr
includelib masmlibuserlib ; For using MessageBox
includelib masmlibkernellib ; For using ExitProcess
NUM macro Q M N O
MOV AL O ; Copy number C to register AL
CBW ; Signextend AL to AX
INC AL ; Increment AL by
MOV BL N ; Copy number B to register BL
IMUL BL ; Multiply AL by BL cb
MOV CL M ; Copy number A to register CL
SAR CL ; Rightshift CL by bits a
SUB AL CL ; Subtract CL from AL cb a
CBW ; Signextend AL to AX
ADD AX AL ; Add AL to AX b cb a
MOV Q AX ; Move the result to the provided register Q
endm
DEN macro R S T
MOV AL S ; Copy number A to register AL
MOV BL T ; Copy number B to register BL
IMUL BL ; Multiply AL by BL ab
DEC AL ; Decrement AL by ab
MOV R AL ; Move the result to the provided register R
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, ; Pointer to set, changed from to
;b cb aab
CYCLE:
CMP EDI,
jz CONT
NUM BX BEDI CEDI AEDI
DEN AX AEDI BEDI
TEST AX ;Tests the parity of a number, and if the result is it is odd.
JNZ OD ;If the result is not jump to the OD branch.
SAR AX ;Rightshift the value in register AX by bit
JMP CONT
OD:
MOV BX ; Copy constant to register BX
IMUL AX ; Multiplication register AX and result in AX register.
CONT:
mov ESI, OFFSET AEDI ; Load the memory address of AEDI into ESI
movsx EAX, byte ptr ESI ; Load the value at memory address stored in ESI into EAX with sign extension
mov D EAX
mov ESI, OFFSET BEDI ; Load the memory address of BEDI into ESI
movsx EAX, byte ptr ESI ; Load the value at memory address stored in ESI into EAX with sign extension
mov E EAX
mov ESI, OFFSET CEDI ; Load the memory address of CEDI into ESI
movsx EAX, byte ptr ESI ; Load the value at memory address stored in ESI into EAX with sign extension
mov F EAX
invoke wsprintf, addr buffer, addr format, D E F eax
invoke MessageBox, addr buffer, addr msgtitle, MBOK
INC EDI
JMP CYCLE
CONT:
invoke ExitProcess,
end start
But I get this error:
ASCII build
NUM: Macro Called From
DEN: Macro Called From
Assembly Error
Can you rewrite the whole program again in the right way to compare it with mine to distinguish between both not just the corrected items please?
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
