THE UNIVERSITY OF TRINIDAD & TOBAGO FINAL ASSESSMENT/EXAMINATIONS DECEMBER 2012 Course Code and Title: Microprocessor Architecture & Interfacing Programme: Computer Engineering Technician Date and Time: [Please insert in accordance to the timetable] Duration: 3hrs PLEASE READ ALL INSTRUCTIONS CAREFULLY BEFORE YOU BEGIN THIS EXAMINATION Instructions to Candidates 1. This paper has 10 pages and 5 sections. 2. You are required to answer all questions. 3. All questions must be answered on the answer booklet and numbered correctly. 4. The use of scientific calculators are Allowed. 5. You must return the question paper along with your answer booklet and other writing paper to the Invigilator at the end of the examination. Key Examination Protocol 1. Students please note that academic dishonesty (or cheating) includes but is not limited to plagiarism, collusion, falsification, replication, taking unauthorised notes or devices into an examination, obtaining an unauthorised copy of the examination paper, communicating or trying to communicate with another candidate during the examination, and being a party to impersonation in relation to an examination. 2. The above mentioned and any other actions which compromise the integrity of the academic evaluation process will be fully investigated and addressed in accordance with UTT s academic regulations. 3. Please be reminded that speaking without the Invigilator s permission is NOT allowed. The University of Trinidad & Tobago Page 1 of 10
SECTION A- [25mks] 1. State TRUE or FALSE for the following statements: a) Values cannot be loaded directly into any segment register (CS, DS, ES, or SS). (1mk) b) The ADD instruction has the following format. ADD source,destination (1mk) c) In Register addressing mode the source and destination registers must match in size. (1mk) d) The 20 bit address that is placed on the address pins of the 8086 microprocessor is called the physical address. (1mk) e) The offset address is a location within a 64K-byte segment range. (1mk) f) The ADD and the MOV instructions do not affect the source operand. (1mk) g) The general purpose registers of the 8088 are usually referred to as the workhorses. (1mk) h) The 8088 CPU is capable of only operating on operands this is 16 bits in size. (1mk) i) When data is pushed onto the stack, the stack pointer is incremented, but when data is popped off the stack, the stack pointer is decremented. (1mk) j) In the CPU registers are used to store information permanently. (1mk) The University of Trinidad & Tobago Page 2 of 10
2. Which of the following instructions cannot be coded in 8088/8086 Assembly language? Give the reason why not, if any. Assume all numbers are in hex. a) MOV AX,27 b) MOV AL,97F c) MOV AX,27 d) MOV DS,9BF2 e) MOV CX,397 f) MOV SI, 9516 g) MOV AX,27 h) MOV CS, 3490 i) MOV DS,BX j) MOV BX,CS k) MOV CH, AX l) MOV AX, 23FB9 m) MOV CS, BH n) MOV AX, DL o) MOV AABC,CX The University of Trinidad & Tobago Page 3 of 10
SECTION B-[25 mks] 1. Assume that SP = FFFEH,AX = 3291 H, BX = F43CH AND CX =09. Find the content of the stack and the stack pointer after the execution of each of the following instructions. PUSH AX PUSH BX PUSH CX (3 Marks) 2. In order for each register to get back their original values in part (a), show the sequence of instructions that needs to be executed. Show the content of SP at each point. (3 Marks) 3. How many external data leads does the 8088 have? 4. The 8088 CPU is capable of operating on size or size operands. (1 Mark) (2 Marks) 5. Assume that the registers have the following values (all in hex ) and CS = 1000, DS=2000, SS=3000,SI=4000,DI = 5000, BX = 6080, BP = 7000,AX =25FF, CX=8791, and DX = 1299. Calculate the physical address of the memory where the operand is stored and the contents of the memory locations in each of the following addressing examples. (a) MOV [SI], AL (b) MOV [3600], AX (c) MOV [BX], CX (6 Marks) 6) When data is pushed onto the stack, the stack pointer is by 2, but when data is popped off the stack, the stack pointer is by 2. (2 Marks) 7) How is the little endian convention utilized by Intel microprocessors? (2 Marks) 8) A segment is an area of memory that includes up to bytes. (1 Mark) 9) Which resgister is used as the offset register with segment register CS? (1 Mark) The University of Trinidad & Tobago Page 4 of 10
10) (i) If BX=1234H and the instruction MOV [2400],BX were executed, what would be the contents of memory locations at offsets 2400 and 2401? (2 Marks) (ii) Also state how many and what type of bus cycles would be required to perform this instruction. (2 Marks) The University of Trinidad & Tobago Page 5 of 10
Section C- [15 Mks] 1. What are the final values in the AX and BX registers for the following program? MOV AX,1234 MOV BL,AL MOV BH,AH ADD BX,03C6 INT 20 (3 marks) 2. What are the final values stored in memory locations 0200 and 0201 for the following program? MOV AL,13 MOV [ 0200],AL MOV BL,12 MOV [ 0201],BL MOV SI,0200 MOV AX,1213 ADD [SI],AX INT 20 (6 marks) The University of Trinidad & Tobago Page 6 of 10
3. What will AX equal after the following instructions have executed? 107C:0200 1A 2D 107C:0300 3B 4C MOV AX, [200] INC AX ADD AH,1 SUB AX, [200] INT 20 (6 marks) The University of Trinidad & Tobago Page 7 of 10
Section D -[20 Mks] 1. For each of the subsequent 8088 instructions, write down the following information: (i) How long (how many bytes) is the machine code (object code)? (ii) How many operands (0, 1 or 2)? (4 Marks) (4 Marks) (iii) Which is the source operand? Destination operand? If operand is in memory, where? (4 Marks) (iv) Name the addressing mode used for each instruction. (4 Marks) (v) Is the operation being performed on BYTE -sized or WORD-sized operands? (4 Marks) -u 100 128 0E97:0100 89D8 MOV AX, BX 0E97:0102 88CC MOV AH, CL 0E97:0104 01CA ADD DX, CX 0E97:0106 46 INC SI 0E97:0107 343E XOR AL, 3E 0E97:0109 B83412 MOV AX, 1234 0E97:010C 223C AND BH, [SI] 0E97:010E 0B05 OR AX, [DI] 0E97:0110 F8 CLC 0E97:0111 8A260002 MOV AH, [0200] The University of Trinidad & Tobago Page 8 of 10
Section E [15 Mks] 1. After the following instructions are executed, what will be the values of AL and BL? Add appropriate comments. dseg SEGMENT val1 DB 80H val2 DB 99H dseg ENDS cseg SEGMENT ASSUME ss:sseg,ds:dseg,cs:cseg mov al,val1 mov bl, val2 cmp al,bl ja label1 mov al,bl jmp exit label1: mov bl, al exit: cseg mov ax,4c00h ;return to DOS! (bye-bye) int 21h ENDS END start AL= BL= (9 marks) The University of Trinidad & Tobago Page 9 of 10
2. Write 8086 assembly language code to implement the following high-level construct. Assume all comparisons are made on signed numbers. Val1 db 40h Val2 db 10h Val3 db 8h IF (VAL1 < VAL2) CX = 1 ELSE CX = 0 ENDIF (6 marks) The University of Trinidad & Tobago Page 10 of 10