QUESTIONS AND PROBLEMS
1. The first byte of an instruction is the , unless it contains one of the override prefixes.
2. Describe the purpose of the D- and W-bits found in some machine language instructions.
3. In a machine language instruction, what information is specified by the MOD field?
4. If the register field (REG) of an instruction contains 010 and W = 0, what register is selected, assuming that the instruction is a 16-bit mode instruction?
5. How are the 32-bit registers selected for the Pentium 4 microprocessor?
6. What memory-addressing mode is specified by R>M = 001 with MOD = 00 for a 16-bit instruction?
7. Identify the default segment registers assigned to the following:
(a) SP
(b) EBX
(c) DI
(d) EBP
(e) SI
8. Convert an 8B07H from machine language to assembly language.
9. Convert an 8B9E004CH from machine language to assembly language.
10. If a MOV SI,[BX+2] instruction appears in a program, what is its machine language equivalent?
11. If a MOV ESI,[EAX] instruction appears in a program for the Core2 microprocessor operating in the 16-bit instruction mode, what is its machine language equivalent?
12. What is the purpose of REX?
13. What is wrong with a MOV CS,AX instruction?
14. Form a short sequence of instructions that load the data segment register with a 1000H.
15. The PUSH and POP instructions always transfer a(n) -bit number between the stack and a register or memory location in the 80386–Core2 microprocessors when oper- ated in the 32-bit mode.
16. Create an instruction that places RAX onto the stack in the 64-bit mode for the Pentium 4.
17. What segment register may not be popped from the stack?
18. Which registers move onto the stack with the PUSHA instruction?
19. Which registers move onto the stack for a PUSHAD instruction?
20. Describe the operation of each of the following instructions:
(a) PUSH AX
(b) POP ESI
(c) PUSH [BX]
(d) PUSHFD
(e) POP DS
(f) PUSHD 4
21. Explain what happens when the PUSH BX instruction executes. Make sure to show where BH and BL are stored. (Assume that SP = 0100H and SS = 0200H.)
22. Repeat question 21 for the PUSH EAX instruction.
23. The 16-bit POP instruction (except for POPA) increments SP by .
24. What values appear in SP and SS if the stack is addressed at memory location 02200H?
25. Compare the operation of a MOV DI,NUMB instruction with an LEA DI,NUMB instruction.
26. What is the difference between an LEA SI,NUMB instruction and a MOV SI,OFFSET NUMB instruction?
27. Which is more efficient, a MOV with an OFFSET or an LEA instruction?
28. Describe how the LDS BX,NUMB instruction operates.
29. What is the difference between the LDS and LSS instructions?
30. Develop a sequence of instructions that moves the contents of data segment memory loca- tions NUMB and NUMB + 1 into BX, DX, and SI.
31. What is the purpose of the direction flag?
32. Which instructions set and clear the direction flag?
33. Which string instruction(s) use both DI and SI to address memory data?
34. Explain the operation of the LODSB instruction.
35. Explain the operation of the LODSQ instruction for the 64-bit mode of the Pentium 4 or Core2.
36. Explain the operation of the OUTSB instruction.
37. Explain the operation of the STOSW instruction.
38. Develop a sequence of instructions that copy 12 bytes of data from an area of memory addressed by SOURCE into an area of memory addressed by DEST.
39. What does the REP prefix accomplish and what type of instruction is it used with?
40. Select an assembly language instruction that exchanges the contents of the EBX register with the ESI register.
41. Where is the I/O address (port number) stored for an INSB instruction?
42. Would the LAHF and SAHF instructions normally appear in software?
43. Write a short program that uses the XLAT instruction to convert the BCD numbers 0–9 into ASCII-coded numbers 30H–39H. Store the ASCII-coded data in a TABLE located within the data segment.
44. Explain how the XLAT instruction transforms the contents of the AL register.
45. Explain what the IN AL,12H instruction accomplishes.
46. Explain how the OUT DX,AX instruction operates.
47. What is a segment override prefix?
48. Select an instruction that moves a byte of data from the memory location addressed by the BX register in the extra segment into the AH register.
49. Develop a sequence of instructions that exchanges the contents of AX with BX, ECX with EDX, and SI with DI.
50. What is an assembly language directive?
51. What is accomplished by the CMOVNE CX,DX instruction in the Pentium 4 microprocessor?
52. Describe the purpose of the following assembly language directives: DB, DW, and DD.
53. Select an assembly language directive that reserves 30 bytes of memory for array LIST1.
54. Describe the purpose of the EQU directive.
55. What is the purpose of the .686 directive?
56. What is the purpose of the .MODEL directive?
57. If the start of a segment is identified with .DATA, what type of memory organization is in effect?
58. If the SEGMENT directive identifies the start of a segment, what type of memory organization is in effect?
59. What does the INT 21H accomplish if AH contains a 4CH?
60. What directives indicate the start and end of a procedure?
61. Explain the purpose of the USES statement as it applies to a procedure with version 6.x of MASM.
62. Develop a near procedure that stores AL in four consecutive memory locations within the data segment, as addressed by the DI register.
63. How is the Pentium 4 microprocessor instructed to use the 16-bit instruction mode?
64. Develop a far procedure that copies contents of the word-sized memory location CS:DATA4 into AX, BX, CX, DX, and SI.