Reference no: EM132577500 , Length: 3 pages
Question 1. Provide brief descriptions of the following directives.
(a) .586
(b) .MODEL FLAT
(c) .DATA
(d) .CODE
Question 2. Briefly describe a macro.
Question 3. For each of the four operands below, identify its mode as the correct choice of immediate, register, direct, or register indirect. Assume that the program contains the directive result DWORD ?
(a) mov DWORD Ptr [ebx], 100
(b) mov result, ebx
Question 4. Find the initial values that the assembler will generate for each directive below. Write your answers using two hex digits for each byte generated.
(a) byteA BYTE 0ah
(b) byteBBYTE "xyz", 0
(c) dwordC DWORD 101011h, 101011b
(d) dwordD DWORD3 DUP (101011)
(e) quadEQWORD -1
Question 5. Suppose that the EDX register contains FF FF F6 E5 and that the data segment of a windows32program contains
areaLbl BYTE "Area ="
area BYTE 11 DUP (?), 0dh, 0ah, 0
(a) Assuming that the statement dtoa area, edx is executed, show (in hex) what will be in the 20memory bytes starting at areaLbl.
(b) Assuming that the dtoa statement in part (a) is followed by the statement
output areaLbl
show what will be displayed. Show white space (spaces and newlines) clearly.
Question 6. Below is a listing file from which some items (marked a, b and c) have been edited out. Add the missing items, and answer the questions following the listing file.
; Program to add three numbers
.586
.MODEL FLAT
.STACK 4096 ; reserve 4096-byte stack
00000000 .DATA ; reserve storage for data
00000000 00000055 number1 DWORD 85
00000004 FFFFFFD1 number2 DWORD -47
00000008 ________ number3 DWORD 91
________ 00000000 sum DWORD ?
00000000 .CODE ; start of main pgm code
00000000 main PROC
00000000 A1 00000000 R mov eax, number1 ; first number to EAX
¬¬¬¬¬¬¬¬________ 03 05 00000004 R add eax, number2 ; add second number
0000000B 03 05 00000008 R add eax, number3 ; add third number
00000011 A3 0000000C R mov sum, eax ; sum to memory
00000016 B8 00000000 mov eax, 0 ; exit w/ return code 0
0000001B C3 ret
0000001C main ENDP
END ; end of source code
(d) What is the opcode for the instructionadd eax, number3?
(e) What is the object code for the instructionadd eax, number3?
(f) "R" in the listing file stands for "relocatable." Explain what this means.
(g) Identify three directives in the program.
(h) How many bytes of object code are used by the entire program? (answer in decimal)
Question 7. Starting with the window32 project, modify the example program given in section 3.5 of our text (Detmer) to prompt for 3 numbers, calculate the sum, and output the result. Include your entire source code. If possible show a screen shot of your output.
Attachment:- Problem Set.rar