You are on page 1of 4

Assignment 2 and 3

Microprocessor System & Interfacing

Assignment Submission Last Date: Friday, April 20, 2012 (before 3PM)

Department of Electrical Engineering COMSATS Institute of Information Technology

Assignment 2 and 3


1. Assume DS = 1200H, AX= 1100H, BX = 11AAH, CX = F000H, SI = 00ABH and the contents at memory locations 13231, 13232, 13233, 13234 and 13235 are CCH, DDH, EEH, FFH and 00H respectively. What is the result of executing the following instructions?

XCHG [1234H] , BX LDS SI , [1232H] ADD AX , BX ADC CX , AX


DS: ______________ 11AAH AX: 9C09H ______________

8B09H BX: ______________

8C09H CX: ______________


7558H SI: _______________
CF: ______________

2. Assuming that register BX contains 003AH. What is the result of executing the following instruction?

NEG BX MOV AL , A1H CBW CWD


FFA1H AX: _______________

FFC6H BX: _______________ FFFFH DX:_______________


3. Describe the result of executing the following sequence of instructions:

MOV AL , 01010101 AND AL , 00011111 OR AL , 11000000 XOR AL , 00001111 NOT AL


AL: ________________ 00100101

4. Assume that CL contains 02H and AX contains 091AH. Determine the new contents of AX and the CF after the following instruction is executed.

SAR AX , CL
0246H AX: _________________
CF: _________________

5. What is the result in BX and CF after execution of the following instruction?

RCR BX , CL
Assume that, prior to execution of the instruction, CL = 04H, BX = 1234H and CF =0. BX: 1234H _________________ CF: _________________

6. Write an instruction sequence to save the current contents of the flag register in memory location at an offset 1234H of the current data segment and then reload the flags with the contents of the storage location at an offset 4321H.

7. Describe what happens to the status flags as the sequence of instructions that follows is executed.

MOV AX , 1234H MOV BX, ABCDH CMP AX , BX


Assume that flags ZF, SF, CF, AF, OF and PF are all initially reset.

CF
ZF = 0;

PF

AF

ZF

SF

OF

8. Explain what happens as the following sequence of instructions is executed. MOV DL , 05H MOV AX , 0A00H MOV DS , AX MOV SI, 0000H MOV CX , 000FH AGAIN: INC SI , CMP [SI] , DL LOOPNE AGAIN
Compare the memory location that is data segment offset address indexed by SI index Register with DL Reg.
_____________________________________________________________________________________ _____________________________________________________________________________________

having value of 05H if both data segment location and register have same value then compare instruction
affect the Z flag and set it to value 0 . If values are different then Z=1 As Cx is set to 000FH LOOPNE Ins. _____________________________________________________________________________________ Dec CX, ______________________________________________________________________________ move to label if CX is not zero and not equal (Z=0) and SI is Inc.Consecutive locations are compared
After Execution :

AX=4C0DH; SI=000FH;

BX=FFD0H; DS=0A00H;

CX=0000H;

DX=0095H;

You might also like