Computer Science: Assembly Language for x86 Processors VS 2017 [C++] Symbolic In
ID: 3885956 • Letter: C
Question
Computer Science: Assembly Language for x86 Processors
VS 2017 [C++]
Symbolic Integer and Text Constants
This is a practice with symbolic constant definitions either using integers or strings. The requirement is as follows:
1. 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
2. Write a program that defines symbolic names for several string literals
- Define three strings for symbol named like Message1, Message2, etc.
- In the data segment, use each symbolic name to 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 memory
Explanation / Answer
MULTIPLE QUESTIONS ARE POSTED. SO I am answering ONLY FIRST Question.
The Required 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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.