PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS...

55
PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES

Transcript of PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS...

Page 1: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 1© Jaime Alberto Parra Plaza

CLASE 11

INSTRUCCIONES DE SALTO

YSENTENCIAS

CONDICIONALES

Page 2: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 2© Jaime Alberto Parra Plaza

TEMA 1

INSTRUCCIONES DE SALTO

Page 3: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 3© Jaime Alberto Parra Plaza

Una instrucción de salto tiene por objetivo continuar la ejecución del programa en una instrucción diferente a la siguiente, alterando la secuencia normal del programa. Esto permite crear ciclos y condiciones.

Físicamente, una orden de salto realiza su labor cambiando el contenido del registro IP (y si se requiere también el de CS), el cual contiene el desplazamiento de la próxima instrucción a ejecutar.

Page 4: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 4© Jaime Alberto Parra Plaza

Se habla de dos clases de saltos, de acuerdo a su alcance:

a. Salto cercano (NEAR): Sólo se cambia el valor de IP, así que el salto es restringido al interior del segmento actual.

b. Salto lejano (FAR): Se cambian IP y CS, así que la nueva instrucción estará en un segmento diferente.

Page 5: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 5© Jaime Alberto Parra Plaza

50

2021

Saltar a 50

Segmento 1

Segmento 2

Segmento 2

100

700

MEMORIA

Salto NEAR:

La flecha indicala siguiente ordena ejecutar.

Page 6: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 6© Jaime Alberto Parra Plaza

20

21Saltar a 100:35

Segmento 1

Segmento 2Segmento 2

100

MEMORIA

35

700

Salto FAR:

La flecha indicala siguiente ordena ejecutar.

Page 7: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 7© Jaime Alberto Parra Plaza

Según su tipo, el salto puede ser:

a. Condicional: El salto se hace si se cumple una condición predeterminada, en caso contrario se continúa con la instrucción siguiente.

b. Incondicional: El salto se realiza sin más requisitos.

Page 8: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 8© Jaime Alberto Parra Plaza

INSTRUCCIÓN DE SALTO INCONDICIONAL (JMP):

Sintaxis:JMP etiqueta

Propósito:Salta a la instrucción cuya dirección esta dada por etiqueta.

Page 9: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 9© Jaime Alberto Parra Plaza

Ejemplo:

MOV AX, 5

MOV BL, 2

SEGUIR: DIV BL

INC AX

JMP SEGUIR

Page 10: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 10© Jaime Alberto Parra Plaza

INSTRUCCIONES DE SALTO CONDICIONAL

(Jx):Es un conjunto de instrucciones, cada una

de las cuales evalúa una condición que corresponde al último resultado dado por la ALU. La clasificación se hace según el tipo de operandos que se asociarán a la operación aritmética u operación lógica realizada:

Page 11: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 11© Jaime Alberto Parra Plaza

a. OPERANDOS SIN SIGNO:

JA = Salta si superior

JAE = Salta si superior o igual

JE = Salta si igual

JBE = Salta si inferior o igual

JB = Salta si inferior

JNE = Salta si diferente

Page 12: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 12© Jaime Alberto Parra Plaza

b. OPERANDOS CON SIGNO:

JG = Salta si mayor

JGE = Salta si mayor o igual

JE = Salta si igual

JLE = Salta si menor o igual

JL = Salta si menor

JNE = Salta si diferente

Page 13: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 13© Jaime Alberto Parra Plaza

c. OTROS:

JC = Salta si hay acarreo (flag carry = 1)

JNC = Salta si no hay acarreo (flag carry = 0)

JZ = Salta si cero (flag zero = 1)

JNZ = Salta si no cero (flag zero = 0)

Page 14: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 14© Jaime Alberto Parra Plaza

Al comparar dos cantidades pueden obtenerse resultados diferentes si se asumen con o sin signo:

Sean los números 0111 y 1010.

a. Tomándolos sin signo:

0111 = 7 y 1010 = 10

como 7 < 10 0111 < 1010 (Considerados sin signo)

Page 15: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 15© Jaime Alberto Parra Plaza

b. Tomándolos con signo:

0111 = +7 y 1010 = -6

como +7 > -6 0111 > 1010 ( Considerados con signo)

¡Las mismas dos cantidades dan comparaciones diferentes!

Page 16: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 16© Jaime Alberto Parra Plaza

Si se sabe que los operandos no son signados (por ejemplo, caracteres) se debe usar el grupo de saltos (a), pero si los operandos corresponden a valores númericos con signo, el grupo a usar es el (b). Es el programador quien decide qué tipos de operandos usa y qué comparación es la adecuada.

Page 17: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 17© Jaime Alberto Parra Plaza

TEMA 2

SENTENCIAS CONDICIONALES

Page 18: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 18© Jaime Alberto Parra Plaza

SENTENCIAS CONDICIONALES:

Todas las sentencias de control en un HLL pueden catalogarse como iterativas o condicionales. En principio, todas pueden transformarse en una operación if acompañada, en algunos casos, de órdenes de salto.

Page 19: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 19© Jaime Alberto Parra Plaza

SENTENCIAS CONDICIONALES IF:

La sentencia if tiene la sintaxis:

if (expr1 && expr 2 || expr3 ... exprn) { /* bloque para condición verdadera*/ } else { /*bloque para condición falsa */ }

Page 20: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 20© Jaime Alberto Parra Plaza

Las herramientas en ensamblador para construirla son:

• Instrucciones aritméticas y lógicas para crear las expresiones

• Instrucciones de comparación para implementar las condiciones

• Instrucciones de salto para seleccionar el código a ejecutar

Page 21: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 21© Jaime Alberto Parra Plaza

INSTRUCCIÓN DE COMPARACIÓN (CMP):

Sintaxis:CMP operando1, operando2

Propósito:Hace una resta de operando2 a operando1, pero no guarda el resultado.

Ejemplos: CMP AL, cte8CMP CX, 2500CMP var8[SI], BL

Page 22: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 22© Jaime Alberto Parra Plaza

La instrucción se ha diseñado para hacer una evaluacion lógica de una expresión (Verdadero, Falso) y poder implementar sentencias de decisión.

Usualmente, después de esta instrucción, vendrá inmediatamente una instrucción de salto.

Page 23: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 23© Jaime Alberto Parra Plaza

SENTENCIA IF SIMPLE:

Sintaxis:

if (condición)

instrucción;

La instrucción se ejecuta si la condición es VERDADERA (diferente de 0).

Ejemplo:

if (a > b)

c = 5;

Page 24: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 24© Jaime Alberto Parra Plaza

Implementación:

IF10:MOV AL, a ; AL = 1er. operandoCMP AL, b ; a > b?

JLE ENDIF10 ; no: salirTHEN10:

MOV c, 5 ; si: ejecutarENDIF10:

Page 25: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 25© Jaime Alberto Parra Plaza

Los nombres de las etiquetas no son palabras especiales, se usan éstas para que sea fácil seguir la lógica del salto.

Observe que se utiliza un salto que evalúa la condición contraria a la que aparece en el lenguaje de alto nivel, es decir, el salto indica cuándo salir de la sentencia.

Page 26: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 26© Jaime Alberto Parra Plaza

LISTADO DE CONDICIONES Y SUS CONTRARIOS:

(para operandos con signo)

Condición Salto Normal Salto Contrario

> JG JLE

> = JGE JL

= = JE JNE

< = JLE JG

< JL JGE

! = JNE JE

Page 27: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 27© Jaime Alberto Parra Plaza

SENTENCIA IF-ELSE SIMPLE:

Sintaxis:if (condición)

instrucción1;else

instrucción2;

Ejemplo:if (a > b)

c = 5;else

c++;

Page 28: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 28© Jaime Alberto Parra Plaza

Implementación: IF11:

MOV AL, a ; AL = 1er. operandoCMP AL, b ; a es mayor que b?JLE ELSE11

THEN11:MOV c, 5 ; ejecutar para siJMP ENDIF11

ELSE11:INC c ; ejecutar para no

ENDIF11:

Page 29: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 29© Jaime Alberto Parra Plaza

SENTENCIA IF CONDICIÓN AND:

La intrucción se ejecuta si todas las condiciones son VERDADERAS.

Sintaxis: if (condición1 and condición2)

instrucción;

Ejemplo: if (a > b && a != -7)

c = 5;

Page 30: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 30© Jaime Alberto Parra Plaza

Implementación:IF11:

MOV AL, a ; AL = 1er. operandoCMP AL, b ; a no mayor que b?JLE ENDIF11 ; no: salir

AND11:CMP a, -7 ; a es diferente a -7?JE ENDIF11

THEN11:MOV c, 5 ; ejecutar la orden

ENDIF11:

Page 31: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 31© Jaime Alberto Parra Plaza

SENTENCIA IF CONDICIÓN NOT:

La instrucción se ejecuta si la condición es FALSA.

Sintaxis:if (!condición)

instrucción;

Ejemplo:if ( !(a > b) )

c = 5;

Page 32: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 32© Jaime Alberto Parra Plaza

Implementación:

IF11:MOV AL, a ; AL = 1er. operandoCMP AL, b ; a es mayor que b?JG ENDIF11 ; si: salir ( es negada)

THEN11:MOV c, 5 ; ejecutar la orden

ENDIF11:

Page 33: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 33© Jaime Alberto Parra Plaza

SENTENCIA IF CONDICIÓN OR:

La instrucción se ejecuta si una o más de las condiciones son VERDADERAS.

Sintaxis:if ( condición1 or condición2)

instrucción;

Ejemplo:if ( a > b || a != -7)

c = 5;

Page 34: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 34© Jaime Alberto Parra Plaza

Implementación:

IF11:MOV AL, a ; AL = 1er. operandoCMP AL, b ; a es mayor que b?JG THEN11 ; si: ejecutar la orden

OR11:CMP a, -7 ; a es diferente a -7?JE ENDIF11 ; no: salir

THEN11:MOV c, 5 ; ejecutar la orden

ENDIF11:

Page 35: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 35© Jaime Alberto Parra Plaza

SENTENCIA IF GENÉRICA:

Los ejemplos anteriores han buscado resaltar la forma en que se implementa cada posibilidad básica. Ahora es posible unirlas todas, junto con la creación de expresiones, para formar sentencias condicionales de alta complejidad:

Page 36: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 36© Jaime Alberto Parra Plaza

if ( (a+b) > c*d && ( ! b || (a-5)<c/(3+a) ) ){

a = 3;b = c+2;

}else{

c--;d = a*b;

}

Page 37: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 37© Jaime Alberto Parra Plaza

IF11:MOV BL, aADD BL, b ; BL = 1er. operandoMOV AL, cIMUL d ; AL = 2do. operandoCMP BL, AL ; a+b > c*d?JLE ELSE11 ; no: ejecutar para no

AND11:CMP b, 0 ; b diferente a 0?JE THEN11 ; si: ejecutar para si

Page 38: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 38© Jaime Alberto Parra Plaza

• OR11:MOV BL, aSUB BL, 5 ; BL = 1er. operandoMOV CL, 3 ADD CL, aMOV AL, cCBWIDIV CL ; AL = 2do. operandoCMP BL, AL ; a - 5 < c/(3+a)?JGE ELSE11 ; no: ejecutar para no

Page 39: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 39© Jaime Alberto Parra Plaza

THEN11: MOV a, 3 ; a = 3MOV AL, c ADD AL, 2

MOV b, AL ; b = c + 2JMP ENDIF11

ELSE11:DEC c ; c--MOV AL, aIMUL bMOV d, AL ; d = a * b

ENDIF11:

Page 40: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 40© Jaime Alberto Parra Plaza

TEMA 3

SENTENCIAS IFANIDADAS

Y EN ESCALERA

Page 41: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 41© Jaime Alberto Parra Plaza

SENTENCIA IF ANIDADA:

Ocurre cuando el cuerpo de una instrucción if es, a su vez, otra sentencia if. Este esquema puede, eventualmante, repetirse en cuantos niveles de anidamiento se requiera:

Page 42: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 42© Jaime Alberto Parra Plaza

if ( a>b )if ( b>c ) if ( c>d )

a = 0; else

a = 1;else a = 2;

elsea = 3;

Page 43: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 43© Jaime Alberto Parra Plaza

IF11: MOV AL, aCMP AL, bJLE ELSE11

THEN11:IF12: MOV AL, b

CMP AL, cJLE ELSE12

THEN12:

...<sigue>...

Page 44: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 44© Jaime Alberto Parra Plaza

IF13: MOV AL, cCMP AL, dJLE ELSE13

THEN13: MOV a, 0JMP ENDIF13

ELSE13: MOV a, 1ENDIF13: JMP ENDIF12ELSE12: MOV a, 2ENDIF12: JMP ENDIF11ELSE11: MOV a, 3ENDIF11:

Page 45: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 45© Jaime Alberto Parra Plaza

SENTENCIA IF EN ESCALERA:

Se produce cuando después del else se sigue otro if el cual también posee su propio else con un if subsiguiente:

Page 46: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 46© Jaime Alberto Parra Plaza

if ( a>b )x = 0;

elseif ( a>c ) x = 1;else if ( a>d )

x = 2; else

x = 3;

Page 47: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 47© Jaime Alberto Parra Plaza

IF11: MOV AL, aCMP AL, bJLE ELSE11

THEN11: MOV x, 0JMP ENDIF11

ELSE11:IF12: MOV AL, a

CMP AL, cJLE ELSE12

THEN12: MOV x, 1JMP ENDIF12

...<sigue>...

Page 48: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 48© Jaime Alberto Parra Plaza

ELSE12:IF13: MOV AL, a

CMP AL, dJLE ENDIF13

THEN13: MOV x, 2JMP ENDIF13

ELSE13: MOV x, 3ENDIF13:ENDIF12:ENDIF11:

Page 49: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 49© Jaime Alberto Parra Plaza

SENTENCIA SWITCH:

Una sentencia switch es muy similar a una escalera if-else. La diferencia radica en que, en el switch, se compara la expresión condicional contra un conjunto de constantes, en tanto que en la escalera se puede comparar contra otras expresiones:

Page 50: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 50© Jaime Alberto Parra Plaza

switch ( a+b ) {case 7: x = 0;

break;case 1: x++;

break;case -8: x--;

break;case 6:case 4: x = 1;

break;default: x = -1; }

Page 51: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 51© Jaime Alberto Parra Plaza

SWITCH11: MOV AL, aADD AL, b

; AL guarda la expresiónCASE11: CMP AL, 7

JNE CASE12MOV x, 0JMP ENDSWITCH11

CASE12: CMP AL, 1JNE CASE13INC xJMP ENDSWITCH11

Page 52: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 52© Jaime Alberto Parra Plaza

CASE13: CMP AL, -8JNE CASE14DEC xJMP ENDSWITCH11

CASE14: CMP AL, 6JNE CASE15JMP DOCASE15

Page 53: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 53© Jaime Alberto Parra Plaza

CASE15: CMP AL, 4JNE DEFAULT11

DOCASE15: MOV x, 1JMP ENDSWITCH11

DEFAULT11: MOV x, -1ENDSWITCH11:

Page 54: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 54© Jaime Alberto Parra Plaza

PREGUNTA 11:

• ¿Por qué los saltos condicionales están restringidos a sólo 128 bytes de distancia máxima desde el punto de origen (explicaciones software y hardware)?

• ¿Qué efectos tiene el qualificador short cuando se aplica a una orden de salto incondicional. Cuándo se recomienda usarlo?

Page 55: PBN - 11 - 1 © Jaime Alberto Parra Plaza CLASE 11 INSTRUCCIONES DE SALTO Y SENTENCIAS CONDICIONALES.

PBN - 11 - 55© Jaime Alberto Parra Plaza

< FIN DE LA CLASE 11 >