Exercise 1

Assume the following register contents:
AX =

4A30H

BP =

0008H

CS =

8000H

BX =

0010H

SP =

0040H

DS =

8000H

CX =

1800H

DI =

0006H

SS =

8002H

DX =

1234H

SI =

0040H

ES =

9000H

Given the following program segment:
PUSH CX
PUSH BX
PUSH DX
Assume that each instruction is dependent on one another.
CX = 1800H
SS = 8002H

BX = 0010H
SP = 0040H

DX = 1234H

Bottom of the Stack

=
=
=

SS x 10H + FFFFH
80020H + FFFFH
9001FH

Stack Segment

=

80020H up to 9001FH

Top of the Stack

=
=
=

SS x 10H + SP
8002H + 0040H
8042H

PUSH CX;

8041H
8040H

NEW SP

=
=
=

New Top of Stack

CH

8041H----->

CL

8040H----->

(CH) = 18H
(CL) = 00H
SP – 2
0040H – 2H
003EH
=

8040H

<---- 8042H

TOS

<---- 8040H

New TOS

18H
00H

803EH TOS <---.803EH New TOS 00H 10H PUSH DX.PUSH BX.8040H TOS <---.803CH New TOS 12H 34H .8040H 00H 10H <---. 803FH 803EH NEW SP = = = New Top of Stack (BH) = 00H (BL) = 10H SP – 2 003EH – 2H 003CH = 803EH <---.8042H CH 8041H-----> CL 8040H-----> BH 803FH-----> BL 803EH-----> 18H 00H <---.8042H CH 8041H-----> CL 8040H-----> BH 803FH-----> BL 803EH-----> DH 803DH-----> DL 803CH-----> 18H 00H <---. 803DH 803CH NEW SP = = = New Top of Stack (DH) = 12H (DL) = 34H SP – 2 003CH – 2H 003AH = 803CH <---.

Assume the following register contents: AX = 4A30H BP = 0008H CS = 8000H BX = 0010H SP = 0040H DS = 8000H CX = 1800H DI = 0006H SS = 8002H DX = 1234H SI = 0040H ES = 9000H Given the following program segment: POP BX POP BP POP SI Assume that instructions are dependent on one another.80060H TOS 00H 10H .80062H New TOS <---.80064H 00H 08H <---. BL BH (80060H) (80061H) NEW SP = = = SP + 2 0040H + 2H 0042H New top of Stack = 80062H <---.80066H SI 80065H-----> SI 80064H-----> BP 80063H-----> BP 80062H-----> BH 80061H-----> BL 80060H-----> 00H 40H <---. BX = 0010H SS = 8002H BP = 0008H SP = 0040H SI = 0040H Bottom of the Stack = = = = SS x 10H + FFFFH 80020H + FFFFH FFFFH 9001F Stack Segment = 80020H up to 9001F Top of the Stack = = = SS x 10H + SP 80020H + 0040H 80060H POP BX.

80066H SI 80065H-----> SI 80064H-----> BP 80063H-----> BP 80062H-----> 00H 40H <---.POP BP.80062H TOS <---.80066H New TOS <---.80064H New TOS <---. SI SI (80062H) (80063H) NEW SP = = = SP + 2 0044H + 2H 0046H New top of Stack SI 80065H-----> SI 80064H-----> = 80066H 00H 40H . BP BP (80062H) (80063H) NEW SP = = = SP + 2 0042H + 2H 0044H New top of Stack = 80064H <---.80064H TOS 00H 08H POP SI.

FADEH 2) CMP FADE.Exercise 2 Identify the addressing mode of the following instructions: 1) ADD AX.Register Indirect Addressing <-----. BX 5) AND AGAIN [BP+SI].Direct Addressing <-----.Base-Plus-Index Addressing . [BP+SI] <-----.Base Addressing <-----.Immediate Addressing <-----. [DI] 7) ADC AX. DS 6) OR DX.Immediate Addressing <-----.Base-Plus-Index Addressing <-----. AX 3) INC DH 4) ADC [BP+1800H].