You are on page 1of 4

TALLER # 4 MICROPROCESADORES

ADDRESSING MODES
PAOLA CAROLINA NIETO ULLOQUE (T00022056)
PhD. JUAN CARLOS MARTÍNEZ SANTOS

1. Describe the diferences between a branch operation, a procedure call and a


program interrupt.

Rta/
 La diferencia esta en que mientras en las Branch instruction ejecutan una
función con una sola instrucción, las procedures call la ejecutan un conjunto
de instrucciones, es decir necesita varias instrucciones para llevar a cabo una
función.

 Otra diferencia esta en que las procedures call necesitan reunir algunas
condiciones para que se produzcan ramificaciones, mientras que las
interrupciones no necesitan una condición para que se produzca interrupción
en el programa o llamar un procedimiento.
 Las interrupciones pueden o no ocurrir durante la ejecución de una programa
mientras que las procedure call ocurren voluntariamente y teniendo en
cuenta unas instrucciones.
 La direccione del programa que procesa la interrupción es determinado por
el hardware del procedimiento y no por el campo de direcciones de la
instrucción.

2. A program that evaluates X=(A‐B)x(C+D) using three address instructions is


as follows:
ADD R1, A, B R1 <‐‐ M[A]‐M[B]
ADD R2, C, D R2<‐‐ M[C]+M[D]
MUL X, R1, R2 M[X] <‐‐ R1 x R2
Write a program to evaluate Y=(A+B)‐C/(D‐E). All operands are initially in
memory and DIV represents divide.

Rta/

ADD R1, A,B R1  M[A] + M[B]


SUB R2 D,E R2  M[D] – M[E]
DIV R3 C, R2 R3  M[C] M[R2]
SUB R4, R1,R3 R4  M[R1] – M[R3]
3. Assume a stack oriented microprocessor. Arithmetic operations automatically
involve the top one or two stack elements. Begin with an empty stack.
a) Write a program to evaluate X=(A‐B)x(A+C) using only the following
instructions: PUSH, POP, ADD, MUL, SUB
b) Show the contents of the stack after the execution of each instruction.

Rta/

PUSH A TOS  M[A] A

PUSH B TOS  M[B] A


B

SUB TOS  TOS – TOS-1


A-B

PUSH A TOS  M[A] A


A-B

PUSH C TOS  M[C] C


A
A-B

ADD TOS  TOS + TOS-1 A+C


A-B

MUL TOS  TOS x TOS-1 (A-B)x (A+C)

4. Consider a 16‐bit processor in which the following appears in main memory


Register R1 has a value of 400. Base register BX has a value of 100.
Determine the effective address and the operand to be loaded for the following
address modes:
a) Direct
b) Immediate
c) Indirect
d) PC relative
e) Register
f) Register indirect

Rta/

ISA Load to AC Mode

201 500
202 NEXT INSTRUCTION
203

399 999
400 1000
401 1001

500 1100
501 1101
502 1102

600 1200
601 1201
602 1202

700 1300
701 1301
702 1302

1000 1600
1001 1601
1002 1602

1100 1700
1101 1701
1102 1702
Teniendo en cuenta que:

A = 500
R1 = 400
R base = 100

a. Directo:

EA= A = 500
Operando= [500] = 1100

b. Inmediato:

EA= 201
Operando= 500

c. Indirecto

EA= (A) = [500] = 1100


Operando = [1100] = 1700

d. PC relative:

Para el direccionamiento relativo, se suma el contenido de la dirección mas la


instrucción de la instrucción siguiente para producir la EA.

EA= A + (PC) = 500 + 202 = 702


Operando= [702] = 1302

e. Registro

EA= R1= 400


Operando=R1=400

f. Registro indirecto

EA= (R1) = 400


Operando= [400] = 1000

You might also like