Content text CSE341 Microprocessor Practice Sheet V2
Intro to Microprocessors 1. What are the differences between microprocessors and microcontrollers? 2. Explain the major components of a CPU and their functions. 3. For each of the following devices, would you use a microcontroller or a microprocessor? a. Keyboard b. Mouse c. Headphone d. Computer e. TV Remote f. Smart TV g. Regular fridge h. Mobile phone 4. Imagine you are designing a smart home system. Would you use a microprocessor or a microcontroller? Justify your choice. 5. Your friend claims that an 8-bit microprocessor is always faster than a 4-bit microprocessor. How would you explain the factors that influence processor performance? 6. Suppose you are designing an embedded system for a washing machine. What features of a microcontroller make it a better choice than a microprocessor? 7. A company wants to build a high-performance computing system. What type of processor architecture (RISC or CISC) would you recommend and why? 8. A device needs high processing power for graphics, support for input devices, and the ability to update games. Power consumption should be balanced for longer use. As a consultant, help them choose whether to use a μP or a μC and give reason. 9. Write an assembly program to perform the following operations: ● Store the value 7 in a register. ● Add 3 to it. ● Subtract 5 from the result. Overview of Microcomputer (Structure and Operation) 1. Draw the block diagram of a Microcomputer 2. Differentiate between RAM and ROM in terms of functionality and volatility. 3. Define the three types of system buses and their roles. 4. Which part of the CPU would most likely handle calculation? 5. What is the primary role of the address bus in a CPU? 6. Which CPU component holds temporary data that is frequently accessed? 7. Describe the primary functions of the CPU and briefly explain them. 8. Why is the address bus unidirectional while the data bus is bidirectional? 9. If a computer system needs to store startup instructions permanently, should it use RAM or ROM? Explain. 10. What is the role of the program counter in instruction fetching? 11. Differentiate between the Memory Address Register (MAR) and the Memory Data Register (MDR). 12. Suppose a microprocessor has a 16-bit address bus. How many memory locations can it address? 13. A CPU is executing a program, but you notice that some instructions take longer to execute than others. Which part of the fetch-decode-execute cycle could be causing this delay? 14. Imagine a data-intensive application that frequently transfers large amounts of data. Would increasing the size of the data bus improve performance? Why or why not? 15. If a microprocessor system frequently communicates with external hardware devices, what role does the control bus play in ensuring smooth operation? 8086 Memory Address Space Partition 1. Deduce the size of the address bus if the total size of the memory is 4 MB 2. Determine the total memory size if the address bus size is 21 bits. 3. Explain the difference between logical and physical addresses. 4. What are segment registers, and what role do they play in memory addressing? 5. Define overlapping and non-overlapping segments with examples. 6. What are the advantages of memory segmentation in 8086? 7. Describe the purpose and operation of the segment registers in the 8086 architecture. How are they different from general-purpose registers? 8. A system using the 8086 microprocessor has a program loaded into memory at segment address A4FB. If an instruction references an offset 4872H, what is the physical address? 9. If a segment starts at address 20000H and another starts at 20100H, are they overlapping? Justify your answer. 10. Given Segment number = 1111H and Offset = 1332H, calculate the physical address. 11. If the physical address is 33330H and the offset is 0020H, determine the segment number. 12. Convert the following physical addresses to their equivalent logical address (segment:offset) representation: ● A9822H ● 38A41H 13. How many segments of 64KB can be allocated in the 1MB memory space of the 8086? 14. If the instruction pointer (IP) is 1234H and the code segment (CS) is 4321H, what is the resulting physical address? 15. Deduce the 5th largest and the 5th smallest possible segment numbers and logical addresses (segment: offset pair) for the given physical address: 32556h.
11. Suppose two hexadecimal numbers (i) FFCD and (ii) FFXY are to be added by an Intel 8086 microprocessor. Given PF = 0 & AF = 1 , Find Maximum value for XY Given PF = 0 & AF = 0 , Find Maximum value for XY Given PF = 1 & AF = 0 , Find Maximum value for XY Given PF = 1 & AF = 1 , Find Maximum value for XY a. Find the minimum value for XY for same values of PF and AF given in i) 12. MOV AX, 2FXYh MOV BX. FCDFh ADD AX, BX a. Deduce the minimum value for X and maximum value for Y such that PF = 1. b. Using the values obtained from (A), deduce the values of OF, AF, and SF, after the execution of the given instructions. Explain the reasonings behind the deduced values. 13. Consider two instruction: i. MOV AX, DCBAh ii. MOV BX, 4567h Perform ADD AX, BX and deduce the values of OF, PF, AF, SF, ZF, and CF. Explain the reasonings behind the deduced values. 14. Suppose two hexadecimal numbers, (i) C5YX and (ii) 5B6A are to be added by an Intel 8086. Here X and Y represent two unknown hexadecimal digits. a. After the 8086 adds the numbers (i) and (ii), deduce the minimum values of X and Y needed to get the value of PF = 1. b. For X and Y values obtained from (A), add (i) and (ii), and deduce the values of SF, OF, AF, and ZF. Explain the reasonings behind the deduced values. 15. Consider three instructions: i. MOV AX, AFCFh ii. MOV BX, FFXYh iii. ADD AX, BX a. Determine the value of X and Y such that both PF and AF are 1 and FFXY will be maximum after satisfying the given constraint. b. Now calculate the values of the OF, ZF, SF, and CF. You have to explain your answers with proper reasoning. 16. Suppose two hexadecimal numbers (i) 96C9 and (ii) 99XY are to be added by an Intel 8086 microprocessor. Here X and Y represent two unknown hexadecimal digits. a. After the 8086 adds the numbers (i) and (ii), deduce the minimum values of X and Y needed to get the value of AF = 1 b. Using the deduced values of X and Y obtained from (a), find the values of PF, SF, OF and CF for the given addition operation. Addressing Modes and Machine Codes 1. Explain with reasoning which category of addressing modes the above-given instructions fall into. a. MOV CL, [BX] b. MOV CL, [BX+SI] c. RET [1234h] d. MOV AX, [BP] e. IN 05h, DX f. OUT DX, 05h g. MOV CL, [BX+SI+4592H] h. MOV BL, [2000H] i. MOV 34H, CL j. MOV AH, [BP] k. HLT AX l. MOV [BX], [BP + SI+23FFh] 2. How many combinations of mod values exist in 8086 machine code, and what does each value represent? 3. Convert the following assembly language instructions into their corresponding machine codes. Your final answer should be in hex. Also estimate what will be the machine code length (in bytes). a. MOV AX, [1234H] b. MOV 5678H[DI], CL c. MOV [BX + SI + 5312h], AX. d. MOV BX, [BP + SI+23FFh] e. MOV [BX], [BP + SI+23FFh] f. MOV AX, [BX] g. MOV 1234h[SI], AX h. MOV DI, [BP+42h] i. MOV C5A4h, CX j. MOV [BX + SI +56H], [1234H] 2. Convert the following machine codes from machine language to its corresponding assembly language instruction. a. 8B5475h b. 88160080h c. 8BD0 d. 8BDA e. 8816FF96h