AIET (Examples+Solution) 7!12!2019-2020
AIET (Examples+Solution) 7!12!2019-2020
LOWER HIGHR
SP 7F31CH 7F31DH
PUSH AX 7F31AH 07H 7F31BH ADH
PUSH DX 7F318H 00H 7F319H 02H
PUSH CX 7F316H A0H 7F317H 00H
PUSH BX 7F314H 8AH 7F315H 29H
EVEN ODD
c - Suppose that the content of 80386 µP registers as the following:
DS = A200H, BX = 020BH, SS=1400H, BP=1500H,
SI=05D0H, DI= 8B2CH and LIST = 02C0H,
Determine:
(1) The physical address accessed by each of the following
instructions, assuming real mode operation?
(2) State the addressing mode for each of the following
instructions?
(3) State the number of memory locations will be copied in each
instruction?
the number of
The physical address addressing memory
mode locations
Base
(a) MOV LIST[BP+DI], CX SS*10+LIST+BP+DI= relative- 2 memory
14000H+02C0H+1500H+8B2CH=1E2ECH plus- index locations
addressing
Scaled-
DS*10+ EBX+2*ESI= 2 memory
(b) MOV [EBX+2*ESI],AX index
A2000H+0000020BH+2*000005D0H=A2DABH locations
addressing
Register
DS*10+BX+4H= 1 memory
(c) MOV CL,[BX+4H] relative
A2000H+020BH+4H=A220FH location
addressing
10-12-2019
09233H
09232H 10 H
09231H 00 H
09230H 4C H
SUB AX, DI
SBB AX, SI
SBB AX, BP
MOV CX, AX
F - Write a short sequence of instructions that: save data 1234H in AX
register, the data CDEFH in DX register, then add the stored data in
DX register, and in AX register make sure that the result saved in AX
register, then for the data stored in DX register, resets the right least
three bits, set the leftmost five bits, and invert the bits numbers
(6, 8, 9, 15) without changing the remaining bits of DX register.
Finally store, and show the final value of the data in DX register in
the data segment memory location addressed by data stored in AX
register, for the used data segment 0808H
160A5H
160A4H 7EH
160A3H A8H
160A2H
G -If the initial values of 80486 µP registers are EAX =FDEC8765H,
EBX = 4321ABCDH, EDX = 9876FEDCH and, ECX = 76598877H,
DS=8808H, CS=0800H, SS=543FH, SP=786CH, BP = 4567H,
SI = 5678H, DI = 456BH. Show the stack memory contents after this
short sequence of instructions executes?
1( PUSH EAX
2( PUSH DX
3( PUSH ECX
4) PUSH BX
Lower Higher
SP 5BC5CH
5BC5AH ECH 5BC5BH FDH
5BC58H 65H 5BC59H 87H
5BC56H DCH 5BC57H FEH
5BC54H 59H 5BC55H 76H
5BC52H 77H 5BC53H 88H
5BC50H CDH 5BC51H ABH
EVEN ODD
f- Describe the operation of each of the following instructions:
(2) PUSH ESI : Pushes the contents of ESI onto the stack.
(3) PUSH WORD PTR [SI]: copies the (Word) 16-bit contents
of the data segment memory location addressed by
SI onto the stack.
(4) PUSH A : (push all) copies the 16-bit registers to the stack in
the following order: AX, CX, DX, BX, SP, BP, DI,
and SI.
DI
SI
H – In 8086 microprocessor, if the multipurpose registers AX, and
DX has values of 1001H and 20FFH respectively, and CF=1.
Find the sum (ADC AX, DX) and the contents of each flag
register bit (C, A, S, Z, and O) after the instruction is executed
AX 1001 H 0001000000000001
+ DX 20FF H 0010000011111111
+ CF 1H 0000000000000001
The result 3101 H 0011000100000001
C= 0 H, A= 1 H, S = 0 H, Z= 0 H, O = 0 H
(1) Shift AX right five places, with zeros moved into the
leftmost bit: SHR AX, 5
(2) Move all bits in AX left three places, making sure that a 0
move into the rightmost bit position
SHL AX, 3
(5) Shift the BX register right seven place, making sure that the
sign of the result is the same as the sign of the original
number:
SAR BX, 7