Thanks to visit codestin.com
Credit goes to www.scribd.com

67% found this document useful (3 votes)
2K views5 pages

Assembly Language - Pop-Push Topic 4 Excercise

This document describes the step-by-step process of pushing values onto the stack and then popping them off according to a given program segment. It shows the register contents before and after each PUSH and POP instruction is executed, including updating the stack pointer and tracking the new top of stack value. It also identifies the addressing modes of several sample instructions, such as immediate, direct, base, base-plus-index, and register indirect addressing.

Uploaded by

Ray Link
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
2K views5 pages

Assembly Language - Pop-Push Topic 4 Excercise

This document describes the step-by-step process of pushing values onto the stack and then popping them off according to a given program segment. It shows the register contents before and after each PUSH and POP instruction is executed, including updating the stack pointer and tracking the new top of stack value. It also identifies the addressing modes of several sample instructions, such as immediate, direct, base, base-plus-index, and register indirect addressing.

Uploaded by

Ray Link
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

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

PUSH BX;

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

<---- 8040H

TOS

<---- 803EH

New TOS

00H
10H

PUSH DX;

803DH
803CH

NEW SP

=
=
=

New Top of Stack

(DH) = 12H
(DL) = 34H
SP 2
003CH 2H
003AH
=

803CH

<---- 8042H
CH

8041H----->

CL

8040H----->

BH

803FH----->

BL

803EH----->

DH

803DH----->

DL

803CH----->

18H
00H

<---- 8040H

00H
10H
<---- 803EH

TOS

<---- 803CH

New TOS

12H
34H

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.
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;

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

<---- 80064H

00H
08H
<---- 80062H

New TOS

<---- 80060H

TOS

00H
10H

POP BP;

BP
BP

(80062H)
(80063H)

NEW SP

=
=
=

SP + 2
0042H + 2H
0044H

New top of Stack

80064H

<---- 80066H
SI

80065H----->

SI

80064H----->

BP

80063H----->

BP

80062H----->

00H
40H

<---- 80064H

New TOS

<---- 80062H

TOS

<---- 80066H

New TOS

<---- 80064H

TOS

00H
08H

POP SI;

SI
SI

(80062H)
(80063H)

NEW SP

=
=
=

SP + 2
0044H + 2H
0046H

New top of Stack

SI

80065H----->

SI

80064H----->

80066H

00H
40H

Exercise 2
Identify the addressing mode of the following instructions:
1) ADD AX, FADEH
2) CMP FADE, AX
3) INC DH
4) ADC [BP+1800H], BX
5) AND AGAIN [BP+SI], DS
6) OR DX, [DI]
7) ADC AX, [BP+SI]

<------ Immediate Addressing


<------ Direct Addressing
<------ Immediate Addressing
<------ Base Addressing
<------ Base-Plus-Index Addressing
<------ Register Indirect Addressing
<------ Base-Plus-Index Addressing

You might also like