Please do it in assembly language. This is a practice with symbolic constant def
ID: 3883574 • Letter: P
Question
Please do it in assembly language. This is a practice with symbolic constant definitions either using integers or strings. The requirement is as follows: Write a program that defines symbolic constants for all seven days of the week Define each integer value for symbol Monday, , Sunday to simulate C++ enumeration type In the data segment, create an array to uses these symbols as initializers Use $ operator to calculate the number of elements in the array In the code segment, watch the array count with a register Write a program that defines symbolic names for several siring literals Define throe strings for symbol named like Message 1 Message2, etc. In the data segment, use each symbolic name lo initialize the string variables Try to use 0D and 0A, as well as a zero terminator in your definitions In the code segment, set a break point and when running in debug, you can watch your string memoryExplanation / Answer
I am giving the solution for 486 architechture.
The program is:
INCLUDE masm32includemasm32rt.inc
INCLUDE masm32includeIrvine32.inc
INCLUDELIB masm32libIrvine32.lib
INCLUDE masm32includedebug.inc
INCLUDELIB masm32libdebug.lib
.486
; 486 Architechture
;.model flat, stdcall
.stack 1000h
ExitProcess PROTO, DwErrorCode:DWORD
WriteHex PROTO
Crlf PROTO
;The program that creates symbolic constants for the seven days of the week.
;An array variable is created that uses the symbols as initializers.
SUN = 0
MON = 1
TUE = 2
WED = 3
THU = 4
FRI = 5
SAT = 6
.data
daysArray BYTE SUN,MON,TUE,WED,THU,FRI,SAT
.code
Call WriteHex
main PROC
inkey
; next console build must be done
INVOKE ExitProcess, 0
main ENDP
END main
;.....................................................................................................
Write the program in a file
day.asm
and the do
masn day.asm