Вы находитесь на странице: 1из 3

1.

Which two 32-bit registers are known as extended index registers?


c. ESI, EDI
1.
What is the name of the lowest 8 bits of the EDX register?
a. DL
2.
How much memory can be addressed in Real-address mode?
b. 1 MB
3.
Which of the following linear addresses matches the segment-offset address 08F0:0200?
a. 09100h
4.
Which register is known as a loop counter?
c. ECX
Fill in the Blanks and Short Answer
1.
Which internal bus uses binary signals to synchronize actions of all devices attached to the system bus? control bus
2.
Which unit in the X86 instruction cycle receives machine instructions from the Bus Interface Unit and inserts them into the instruction
queue?
code prefetch unit
3.
Which unit in the X86 instruction cycle performs page protection checks?
paging
4.
Which component of an operating system is responsible for switching control between tasks? scheduler
5.
Identify three types of segments that would be referenced by segment registers.
code, data, stack
2.
Which directive(s) are used when defining both signed and unsigned 64-bit integers?
c. QWORD
1. Which of the following are valid data definition statements that create an array of unsigned bytes containing decimal 10, 20, and 30, named
myArray.
a. myArray BYTE 10, 20, 30
2. In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)?
st2 WORD 3,4,5,6,7
d. 2004h
3. Which letter choice shows the memory byte order, from low to high address, of the following data definition?
BigVal DWORD 12345678h
c. 78h,56h,34h,12h
4. Given the following array definition, which letter choice contains a valid constant declaration named ArrayCount that automatically calculates the
number of elements in the array?
newArray DWORD 10,20,30,40,50
b. ArrayCount = ($ newArray) / 4
5. Select a data definition statement that creates an array of 500 signed doublewords named myList and initializes each array element to the value 1.
d. myList SDWORD 500 DUP (1)
6. Which of the following defines a text macro named MESSAGE that contains this string data?
"I'm good at this!",0
a MESSAGE TEXTEQU <"I'm good at this!",0>
7. The following is a valid data definition statement:
str1 \
BYTE "This string is quite long!",0 a. True
8. The following are both valid data definition statements:
List1 BYTE 10,20
BYTE 30,40 a. True
3.
Declare a symbolic constant named COUNT that equals 25. COUNT = 25 (or COUNT EQU 25)
4.
Use COUNT from the previous question in a data definition statement that creates an uninitialized array of 32-bit unsigned integers named
myArray.
MyArray DWORD COUNT DUP(?)
5.
Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in bytes, of the
array:
ArraySize = ($ - newArray)
; parentheses optional newArray DWORD 10,20,30,40,50

6.

The MOV instruction does not permit an immediate value to be moved to a segment register.
a. true
6.
The MOVSX instruction sign-extends an integer into a larger operand.
a. true
7.
The DS register can be the destination operand of a MOV instruction.
b. false
8.
The ES register can the source operand of a MOV instruction.
a. true
9.
Adding 7Fh and 05h in an 8-bit register sets the Overflow flag.]
a. true
10. Adding 0FFh and 05h in an 8-bit register sets the Overflow flag. b. false
11. The following instructions will set the Carry flag:
mov al,0FEh
sub al,2 b. false
12. The following instructions will set the Sign flag:
mov al,0FEh
sub al,2 a. true
13. Where marked by a letter (a, b, c, d), indicate the hexadecimal value of the destination operand:

1.
2.
3.

4.

7.

mov ax,word1
inc ax
a. AX = 0000h
dec ax
b. AX = FFFFh
mov ax,word3
neg ax
c. AX = 8001h
add ax,0C2A5h
d. AX = 42A6h
14. Where marked by a letter (a, b, c, d), indicate the hexadecimal value of the destination operand:
mov al,7Fh
add al,2
a: ZF,CF,SF,OF= 0,0,1,1
sub al,5
b: ZF,CF,SF,OF= 0,0,0,1
mov al,80h
add al,80h
c: ZF,CF,SF,OF= 1,1,0,1
neg al
d: ZF,CF,SF,OF= 1,0,0,0
Write an instruction that moves the lower 16 bits of dword1 into the BX register (hint: use PTR).
mov bx,WORD PTR dword1
Write an instruction that moves the lower 8 bits of word2 into the AL register.
mov al,BYTE PTR word2
Write an instruction that moves EBX to location word1:
mov DWORD PTR word1, ebx
15. Implement the following expression in assembly language, using 32-bit integers (you may modify any registers you wish):
eax = dword1 + ebx - ecx
mov eax,dword1
add eax,ebx
sub eax,ecx
16. Implement the following expression in assembly language, using 32-bit integers (you may modify any registers you wish):
eax = -dword1 + (edx - ecx) + 1
sub edx,ecx
mov eax,dword1
neg eax
; eax = -dword1
add eax,edx
inc eax
Use the following data declarations to write an assembly language loop that copies the string from source to target. Use indexed addresing
with EDI, and use the LOOP instruction.
source BYTE "String to be copied",0
target BYTE SIZEOF source DUP(0),0
mov edi,0
mov ecx,SIZEOF source
L1:
mov al,source[edi]
mov target[edi],al
inc edi
loop L1
17. Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?
d. call WriteInt
18. Which library procedure reads a string from standard input? ReadString
19. Write code that causes a 500 millisecond delay, using a library procedure.
mov eax,500 call Delay
20. Given the following data definition, write a sequence of statements that display a dump of the data in 32-bit hexadecimal, using the
DumpMem procedure from the link library.
array DWORD 10h,20h,30h,40h
mov esi,OFFSET array
mov ecx,LENGTHOF array
mov ebx,TYPE array
call DumpMem
21. Write a procedure named ShowBinary that displays the following array as a sequence of binary bits, starting with the low-order value
(00000010h). Include the use of the LENGTHOF, OFFSET, and TYPE operators, and call the WriteBin procedure.
array DWORD 10h,20h,30h,40h
ShowBinary PROC
mov ecx,LENGTHOF array
mov esi,OFFSET array
L1: mov eax,[esi]
; any 32-bit indirect register
call WriteBin
add esi,TYPE array
; 4 is ok also
loop L1
ret
ShowBinary ENDP
Write a procedure named Read10 that reads exactly ten characters from standard input into an array of BYTE named myString. Use the
LOOP instruction with indirect addressing, and call the ReadChar procedure from the book's link library. (ReadChar returns its value in AL.)
1 Read10 PROC
2 mov ecx,SIZEOF myString

3 mov esi,OFFSET myString


4 L1: call ReadChar
5 mov [esi],al
6 inc esi
7 loop L1
8 ret
9 Read10 ENDP

24. What will be the hexadecimal value of AL after these instructions execute?
mov al,0CFh
and al,2Bh
a. 0Bh
25. What will be the hexadecimal value of AL after these instructions execute?
mov al,3Ch
or al,82h
c. BEh
26. What will be the hexadecimal value of AL after these instructions execute?
mov al,94h
xor al,37h
b. A3h
27. A WHILE loop can be constructed with a CMP instruction at the bottom of the loop, followed by a conditional jump instruction.
F
28. In a finite-state machine, transitions between states usually occur when a new value has been read from input.
T
1.
Code instructions that implement the following pseudocode using conditional jump instructions. Do not use the .IF directive. Assume that
integers are unsigned:
if( eax > ebx )
mov dl,5;
else
mov dl,6;
cmp eax,ebx
also:
cmp eax,ebx
jna L1
ja L1
mov dl,5 mov dl,6
jmp L2
jmp L2
L1:mov dl,6
L1: mov dl,5
L2:
L2:

Вам также может понравиться