Question
Write an assembly program that contain the following: Using the AddTwo program from Section 3.2 as a reference, write code to calculate the following expression,
Write an assembly program that contain the following:
- Using the AddTwo program from Section 3.2 as a reference, write code to calculate the following expression, using registers: A = (A+B)-(C+D). Assign integer values to the EAX, EBX, ECX, and EDX registers
- Write code that defines symbolic constants for all seven days of the week. Create an array variable that uses the symbols as initializers
- The program must contain a definition of each data type listed in Table 2 in Section 3.4 of the textbook. Initialize each variable to a value that is consistent with its data type
- Write code defines symbolic names for several string literals. Use each symbolic name in a variable definition
Basically, these are Programming Exercises 1-4 on page 94 of the textbook. Instead of writing four separated program, you just write one program to contain all features listed above.
I already figured out the codes for each but the textbook doesn't really explain how to combine them properly. I also don't know how to output the values. Can you combine all four into one .asm file and also share a screenshot of the output??
1)
.386 .model flat,stdcall .stack 4096 ExitProcess PROTO, dwExitCode:DWORD .code main PROC mov eax, 3h mov ebx, 8h mov ecx, 1h mov edx, 8h add eax, ebx add ecx, edx sub eax, ecx INVOKE ExitProcess,0 main ENDP END main
2)
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 main PROC INVOKE ExitProcess,0 main ENDP
3)
.386 .model flat,stdcall .stack 4096 ExitProcess PROTO, dwExitCode:DWORD .data valByte BYTE 255 valSbyte SBYTE -128 valWord WORD 65535 valSWord SWORD -32768 valDWord DWORD 4294967295 valSDWord SDWORD -2147483648 valFWord FWORD 281474976710,655 valQWord QWORD 18446744073709551615 valTByte TBYTE 1000000000123456789Ah valReal4 REAL4 -1.2 valReal8 REAL8 1.0E-260 valReal10 REAL10 1.0E+4000 .code main PROC INVOKE ExitProcess,0 main ENDP END main
4)
.386 .model flat,stdcall .stack 4096 ExitProcess PROTO, dwExitCode:DWORD str1 EQU <"Hadiqa",0> str2 EQU <"Iqra",0> str3 EQU <"Aqsa",0> .data first BYTE str1 second BYTE str2 third BYTE str3 .code main PROC INVOKE ExitProcess,0 main ENDP END main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started