Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 [10pt] Answer the following questions for the program shown below TIT

ID: 3904879 • Letter: Q

Question

Question 1 [10pt] Answer the following questions for the program shown below TITLE Add and Subtract (AddSub.asm) INCLUDE Irvine32.inc .code main PROC mov eax,10000h ;EAX 10000h add eax,40000h ;EAX 50000h sub eax,20000h EAX 30000h call DumpRegs ;display registers exit main ENDP END main a) [2pt] What does the CODE directive identify? b) [2pt] How are the CPU registers displayed? c) [2pt] Which statement halts the program? d) [2pt] Which directive begins a procedure? e) [2pt] Which directive ends a procedure?

Explanation / Answer

(a). The .CODE directive identifies the beginning of the code segment which consists of all the executable statements in a program location.So basically it attempts to find the area of program containing instructions. THE .CODE directive in the program instructs the assembler to fetch and begin code segment.

(b). The CALL statement calls a procedure which helps in displaying the current values of CPU register. In the above code snippet, call DumpRegs displays CPU register values. So call statement calls near procedure using a full pointer. When the called procedure ends, execution flow will resume at the instruction followed by call instruction.

(c). The exit statement halts the program by indirectly calling a predefined MS-Windows function. There are two types of ending a program: the physical and logical end. Physical end is the the last statement of the program. Logical end is actually where the program ends. The exit is used for abnormal termination.

(d). The PROC directive present in the program identifies the beginning of a procedure. In the above code snippet, main PROC is the directive which beginnings a procedure associated. The PROC marks the start of a function.

(e). The ENDP directive present in the program marks the end of main procedure associated. In the above code snippet, main ENDP ends the procedure associated. The ENDp directive and name of the procedure(main) is used together to notify the assembler of end of a procedure.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote