La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Modos de Direccionamiento y Set de instrucciones Microcontroladores Freescale Familia HC(S)08.

Presentaciones similares


Presentación del tema: "Modos de Direccionamiento y Set de instrucciones Microcontroladores Freescale Familia HC(S)08."— Transcripción de la presentación:

1 Modos de Direccionamiento y Set de instrucciones Microcontroladores Freescale Familia HC(S)08

2 0. Modos de direccionamiento Direccionamiento Inherente (INH) La instrucción no especifica un operando (“la CPU lo conoce”), de esta manera no se necesitan datos adicionales para la ejecución de la instrucción. En general, son operaciones sobre los registros de la CPU o sobre bits. Ejemplo: CLRA Direccionamiento Inmediato (IMM) Especifica el valor de una constante directamente, no la dirección del valor. Indicado por el simbolo # Ejemplo: LDA #0FFH Direccionamiento Directo (DIR) Se especifican 8 bits con la dirección del operando. El byte superior de los 16 bits de dirección se asume que es 00H. Utilizado para acceder a los primeros 256 bytes del mapa de memoria Ejemplo: LDA 50H

3 Direccionamiento Extendido (EXT) Se especifican 16 bits con la direcccción del operando. Usado para acceder a posiciones de memoria mayores a 00FFH. Ejemplo: LDA 1210H Direccionamiento Indexado sin Offset (IX) Se especifica el contenido del Registro Indice H:X como dirección del operando Ejemplo: CLR,X Direccionamiento Indexado con Offset de 8 bits (IX1) Offset de 8 bits sin signo + registro H:X sin signo = posición de memoria Registro H:X no es modificado Ejemplo: CLR 43H,X Direccionamiento Indexado con Offset de 16 bits (IX16) Offset de 16 bits sin signo + Registro H:X sin signo = posición de memoria Registro H:X no es modificado Ejemplo: CLR 0230H,X Direccionamiento Indexado con el SP y Offset de 8 bits (SP1) Offset de 8 bits sin signo + Registro SP sin signo = posición memoria Registro SP no es modificado Ejemplo: LDA 5,SP

4 Direccionamiento Indexado con el SP y Offset de 16 bits (SP2) Offset de 16 bits sin signo + Registro SP sin signo = posición memoria Registro SP no es modificado Ejemplo: LDA 0500H,SP Direccionamiento Relativo (REL) Usado en todas las instrucciones de bifurcación condicionales Si la condición es: VERDADERA PC = PC + offset de 8 bits con signo SINO PC no es afectado Ejemplo: BEQ 1355H Direccionamiento Indexado sin Offset y PostIncremento (IX+) El Registro indice H:X contiene la dirección del operando. Despues que la dirección del operando es hallada, H:X es incrementado en 1 Ejemplo: CBEQ X+,2480H Direccionamiento Indexado con Offset de 16 bits y PostIncremento (IX1+) Igual al direccionamiento indexado con offset de 8 bits, pero después que la dirección del operando es calculada, H:X es incrementado en 1 Ejemplo: CBEQ 50H,X+,2480H

5 Direccionamiento Memoria a memoria Usado para mover información desde una posición de memoria a otra No usa ni afecta registros de la CPU (excepto cuando se usa direccionamiento indexado con post incremento) Cuatro variantes: Inmediato a Directo Directo a Directo Indexado a Directo con Post Incremento Directo a Indexado con Post Incremento Direccionamiento Memoria a memoria Inmediato a Directo (IMD) La Fuente es un byte valor inmediato El Destino debe estar en las primeras 256 posiciones del mapa de memoria Ejemplo: MOV #45H,67H Direccionamiento Memoria a memoria Directo a Directo (DD) La Fuente debe estar en las primeras 256 posiciones del mapa de memoria El Destino debe estar en las primeras 256 posiciones del mapa de memoria Ejemplo: MOV 60H,80H

6 Direccionamiento Memoria a memoria Indexado con PostIncremento a Directo (IX+D) La Fuente puede ser cualquier lugar en el mapa de memoria El Destino debe estar en las primeras 256 posiciones del mapa de memoria Despues que la dirección del operando es hallada, H:X es incrementado en 1 Ejemplo: MOV X+,25H Direccionamiento Memoria a memoria Directo a Indexado con PostIncremento (DIX+) La Fuente debe estar en las primeras 256 posiciones del mapa de memoria El Destino puede ser cualquier lugar en el mapa de memoria Despues que la dirección del operando es hallada, H:X es incrementado en 1 Ejemplo: MOV 75H,X+

7 1. Instrucciones Aritméticas ADC #opr8 ADC opr8 ADC opr16 ADC,X ADC opr8,X ADC opr16,X ADC opr8,SP ADC opr16,SP Suma con acarreo A = A + C + opr8 A = A + C + (opr8) A = A + C + (opr16) A = A + C + (HX) A = A + C + (opr8 + HX) A = A + C + (opr16 + HX) A = A + C + (opr8 + SP) A = A + C + (opr16 + SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed, no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with bit offset (SP2) SP with bit offset ADD #opr8 ADD opr8 ADD opr16 ADD,X ADD opr8,X ADD opr16,X ADD opr8,SP ADD opr16,SP Suma sin acarreo A = A + opr8 A = A + (opr8) A = A + (opr16) A = A + (HX) A = A + (opr8 + HX) A = A + (opr16 + HX) A = A + (opr8 + SP) A = A + (opr16 + SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed, no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with bit offset (SP2) SP with bit offset AIS #opr8 Suma entre valor Inmediato con signo y SP SPH:SPL = SPH:SPL + opr8 (IMM) 8 bit immediate AIX #opr8 Suma entre valor Inmediato con signo y H:X H:X = H:X + opr8(IMM) 8 bit immediate

8 ASL opr8 ASL,X ASL opr8,X ASL opr8,SP Corrimiento Aritmético a la izquierda C  (opr8)  0 C  (HX)  0 C  (opr8 + HX)  0 C  (opr8 + SP)  0 (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed, 8 bit offset (SP1) SP with 8 bit offset ASLA Corrimiento Aritmético a la izquierda de A C  A  0 (INH) inherent mode ASLX Corrimiento Aritmético a la izquierda de X C  X  0 (INH) inherent mode ASR opr8 ASR,X ASR opr8,X ASR opr8,SP Corrimiento Aritmético a la derecha M7  (opr8)  C M7  (HX)  C M7  (opr8 + HX)  C M7  (opr8 + SP)  C (DIR) 8 bit direct (IX) indexed, no offset (IX1) indexed, 8 bit offset (SP1) SP with 8 bit offset ASRA Corrimiento Aritmético a la derecha de A A7  A  C (INH) inherent mode ASRX Corrimiento Aritmético a la derecha de X X7  X  C (INH) inherent mode CMP #opr8 CMP opr8 CMP opr16 CMP,X CMP opr8,X CMP opr16,X CMP opr8,SP CMP opr16,SP Comparar el Acumulador con Memoria A - opr8 A - (opr8) A - (opr16) A - (HX) A - (opr8 + HX) A - (opr16 + HX) A - (opr8 + SP) A - (opr16 + SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP, 8 bit offset (SP2) SP, 16 bit offset

9 CPHX #opr16 CPHX opr16 Comparar H:X con Memoria HX - opr16 HX - (opr16) (IMM) 16 bit immediate (DIR) direct, 16 bit data CPX #opr8 CPX opr8 CPX opr16 CPX,X CPX opr8,X CPX opr16,X CPX opr8,SP CPX opr16,SP Comparar Registro X con Memoria X - opr8 X - (opr8) X - (opr16) X - (HX) X - (opr8+HX) X - (opr16+HX) X - (opr8+SP) X - (opr16+SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP, 8 bit offset (SP2) SP, 16 bit offset DAA Ajuste Decimal de Acumulador A 10 (INH) inherent addressing DEC opr8 DEC,X DEC opr8,X DEC opr8,SP Decrementar (opr8) = (opr8) – 1 (HX) = (HX) – 1 (opr8+HX)=(opr8+HX)–1 (opr8+SP)=(opr8+SP) – 1 (DIR) 8 bit direct (IX) indexed,no offset (IX1) indexed,8 bit offset (SP1) SP with 8 bit offset DECADecrementar AA = A - 1(INH) inherent mode DECXDecrementar XX = X - 1(INH) inherent mode DIVDivisión A = H:A H = Residuo X (INH) inherent addressing INC opr8 INC,X INC opr8,X INC opr8,SP Incrementar (opr8) = (opr8)+ 1 (HX) = (HX) + 1 (opr8+HX)=(opr8+HX)+1 (opr8+SP) = (opr8+SP)+ 1 (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed,8 bit offset (SP1) SP with 8 bit offset

10 INCAIncrementar AA = A + 1(INH) inherent mode INCXIncrementar XX = X + 1(INH) inherent mode MULMultiplicaciónX:A = A * X(INH) inherent addressing NSA Nibble Swap Accumulator A = A[3:0]:A[7:4](INH) inherent addressing SBC #opr8 SBC opr8 SBC opr16 SBC,X SBC opr8,X SBC opr16,X SBC opr8,SP SBC opr16,SP Resta con Préstamo A = A - C - opr8 A = A - C - (opr8) A = A - C - (opr16) A = A - C - (HX) A = A - C - (opr8+HX) A = A - C - (opr16+HX) A = A - C - (opr8+SP) A = A - C - (opr16+SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed 8 bit offset (IX2) indexed 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset SUB #opr8 SUB opr8 SUB opr16 SUB,X SUB opr8,X SUB opr16,X SUB opr8,SP SUB opr16,SP Resta A = A - opr8 A = A - (opr8) A = A - (opr16) A = A - (HX) A = A - (opr8+ HX) A = A - (opr16+ HX) A = A - (opr8+ SP) A = A - (opr16+ SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset TST opr8 TST,X TST opr8,X TST opr8,SP Test for Negative or Zero (opr8) - $00 (HX) - $00 (opr8+HX) - $00 (opr8+SP) - $00 (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed 8 bit offset (SP1) SP with 8 bit offset

11 2. Instrucciones Lógicas AND #opr8 AND opr8 AND opr16 AND,X AND opr8,X AND opr16,X AND opr8,SP AND opr16,SP Función Lógica AND A = A & opr8 A = A & (opr8) A = A & (opr16) A = A & (HX) A = A & (opr8 + HX) A = A & (opr16 + HX) A = A & (opr8 + SP) A = A & (opr16 + SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed, no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with8 bit offset (SP2) SP with 16 bit offset BIT #opr8 BIT opr8 BIT opr16 BIT,X BIT opr8,X BIT opr16,X BIT opr8,SP BIT opr16,SP Bit Test A & opr8 A & (opr8) A & (opr16) A & (HX) A & (opr8 + HX) A & (opr16 + HX) A & (opr8 + SP) A & (opr16 + SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset COM opr8 COM,X COM opr8,X COM opr8,SP Complemento a uno (opr8) = $FF - (opr8) (HX) = $FF - (HX) (opr8+HX)=$FF-(opr8+HX) (opr8+SP)=$FF-(opr8+SP) (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed,8 bit offset (SP1) SP, 8 bit offset COMA Complemento a uno de A A = $FF - A(INH) inherent addressing

12 COMX Complemento a uno de X X = $FF - X(INH) inherent addressing EOR #opr8 EOR opr8 EOR opr16 EOR,X EOR opr8,X EOR opr16,X EOR opr8,SP EOR opr16,SP OR Exclusiva entre Acumulador y Memoria A = A  opr8 A = A  (opr8) A = A  (opr16) A = A  (HX) A = A  (opr8+ HX) A = A  (opr16+ HX) A = A  (opr8+ SP) A = A  (opr16+ SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset LSL opr8 LSL,X LSL opr8,X LSL opr8,SP Corrimiento Lógico a la Izquierda C  (opr8)  0 C  (HX)  0 C  (opr8+ HX)  0 C  (opr8+ SP)  0 (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed, 8 bit offset (SP1) SP with 8 bit offset LSLA Corrimiento Lógico a la Izquierda de A C  A  0 (INH) inherent addressing LSLX Corrimiento Lógico a la Izquierda de X C  X  0 (INH) inherent addressing LSR opr8 LSR,X LSR opr8,X LSR opr8,SP Corrimiento Lógico a la Derecha 0  (opr8)  C 0  (HX)  C 0  (opr8+HX)  C 0  (opr8+SP)  C (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed, 8 bit offset (SP1) SP with 8 bit offset LSRA Corrimiento Lógico a la Derecha de A 0  A  C (INH) inherent addressing LSRX Corrimiento Lógico a la Derecha de X 0  X  C (INH) inherent addressing

13 NEG opr8 NEG,X NEG opr8,X NEG opr8,SP Complemento a Dos (opr8) = $00 - (opr8) (HX) = $00 - (HX) (opr8+HX) = $00- (opr8+HX) (opr8+SP)=$00-(opr8+SP) (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed,8 bit offset (SP1) SP with 8 bit offset NEGA Complemento a Dos de A A = $00 – A(INH) inherent addressing NEGX Complemento a Dos de X X = $00 – X(INH) inherent addressing ORA #opr8 ORA opr8 ORA opr16 ORA,X ORA opr8,X ORA opr16,X ORA opr8,SP ORA opr16,SP OR entre Acumulador y Memoria A = A or opr8 A = A or (opr8) A = A or (opr16) A = A or (HX) A = A or (opr8+HX) A = A or (opr16+HX) A = A or (opr8+SP) A = A or (opr16+SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed/8 bit offset (IX2) indexed/16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset ROL opr8 ROL,X ROL opr8,X ROL opr8,SP Rotación a la izquierda a través del Acarreo C  (opr8)  C C  (HX)  C C  (opr8+ HX)  C C  (opr8+ SP)  C (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed 8 bit offset (SP1) SP with 8 bit offset ROLA Rotación a la izquierda del Acumulador a través del Acarreo C  A  C (INH) inherent addressing ROLX Rotación a la izquierda de X a través del Acarreo C  X  C (INH) inherent addressing

14 ROR opr8 ROR,X ROR opr8,X ROR opr8,SP Rotación a la derecha a través del Acarreo C  (opr8)  C C  (HX)  C C  (opr8+ HX)  C C  (opr8+ SP)  C (DIR) 8 bit direct (IX) indexed no offset (IX1) indexed 8 bit offset (SP1) SP with 8 bit offset RORA Rotación a la derecha del Acumulador a través del Acarreo C  A  C (INH) inherent addressing RORX Rotación a la derecha de X a través del Acarreo C  X  C (INH) inherent addressing

15 3. Instrucciones de transferencia de datos CLR opr8 CLR,X CLR opr8,X CLR opr8,SP Borrar (opr8) = 0 (HX) = 0 (opr8 + HX) = 0 (opr8 + SP) = 0 (DIR) 8 Bit Direct (IX) indexed, no offset (IX1) indexed, 8 bit offset (SP1) SP, 8 bit offset CLRABorrar Acumulador A = 0 (INH) inherent addressing CLRH Borrar Registro Indice H H = 0 (INH) inherent addressing CLRX Borrar Registro Indice X X = 0 (INH) inherent addressing LDA #opr8 LDA opr8 LDA opr16 LDA,X LDA opr8,X LDA opr16,X LDA opr8,SP LDA opr16,SP Cargar el Acumulador A = opr8 A = (opr8) A = (opr16) A = (HX) A = (opr8+ HX) A = (opr16+ HX) A = (opr8+ SP) A = (opr16+ SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset LDHX #opr16 LDHX opr16 Cargar H:X HX = opr16 HX = (opr16: opr16+1) (IMM) 16 bit immediate (DIR) direct 16 bit data

16 LDX #opr8 LDX opr8 LDX opr16 LDX,X LDX opr8,X LDX opr16,X LDX opr8,SP LDX opr16,SP Cargar X X = opr8 X = (opr8) X = (opr16) X = (HX) X = (opr8+ HX) X = (opr16+ HX) X = (opr8+ SP) X = (opr16+ SP) (IMM) 8 bit immediate (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset MOV #opr8_1,opr8_2 MOV opr8_1,opr8_2 MOV X+,opr8 MOV opr8,X+ Mover Byte (opr8_1) = opr8_2 (opr8_2) = (opr8_1) (opr8) = (HX) HX = HX + 1 (HX) = (opr8) HX = HX + 1 (IMD) immediate-direct (DD) direct to direct (IX+D) indexed to direct with post increment (DIX+) direct to indexed with post increment PSHA Guardar el Acumulador de la pila Push A to stack SP = SP - 1 (INH) inherent addressing PSHHGuardar H en la pila Push H to stack SP = SP - 1 (INH) inherent addressing PSHXGuardar X en la pila Push X to stack SP = SP - 1 (INH) inherent addressing PULA Sacar Acumulador de la pila SP = SP + 1 Pull A (INH) inherent addressing

17 PULHSacar H de la pila SP = SP + 1 Pull H (INH) inherent addressing PULXSacar X de la pila SP = SP + 1 Pull X (INH) inherent addressing RSPInicializar SPSPL = $FF (INH) inherent addressing STA opr8 STA opr16 STA,X STA opr8,X STA opr16,X STA opr8,SP STA opr16,SP Almacenar Acumulador en Memoria (opr8) = A (opr16) = A (HX) = A (opr8+ HX) = A (opr16+ HX) = A (opr8+ SP) = A (opr16+ SP) = A (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset STHX opr8 Almacenar H:X en Memoria (opr8:opr8+1) = HX(INH) inherent addressing STX opr8 STX opr16 STX,X STX opr8,X STX opr16,X STX opr8,SP STX opr16,SP Almacenar X en Memoria (opr8) = X (opr16) = X (HX) = X (opr8+ HX) = X (opr16+ HX) = X (opr8+ SP) = X (opr16+ SP) = X (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset (SP1) SP with 8 bit offset (SP2) SP with 16 bit offset TAP Transfer Accumulator to CCR CCR = A(INH) inherent addressing

18 TAX Transfer Accumulator to Index Register X X = A(INH) inherent addressing TPA Transfer CCR to Accumulator A = CCR (INH) inherent addressing TSX Transfer Stack Pointer to Index Register H:X H:X = SPH:SPL (INH) inherent addressing TXA Transfer Index Register X to Accumulator A = X (INH) inherent addressing TXS Tansfer Index Register H:X to Stack Pointer SPH:SPL = H:X(INH) inherent addressing

19 4. Instrucciones de Salto JMP opr8 JMP opr16 JMP,X JMP opr8,X JMP opr16,X Salto Incondicional PC = opr8 PC = opr16 PC = (HX) PC = (opr8+HX) PC = (opr16+HX) (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset 4.1 Saltos Incondicionales

20 4.2 Saltos Condicionales (Bifurcaciones) BCC rel Bifurcar si Acarreo = 0 If C = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BCS rel Bifurcar si Acarreo = 1 If C = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BEQ relBifurcar si es igual If Z = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BGE rel Bifurcar si es  (operandos con signo) If (N  V) = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BGT rel Bifurcar si es > (operandos con signo) If (Z & (N  V)) = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BHCC rel Bifurcar si Acarreo Intermedio = 0 If H = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BHCS rel Bifurcar si Acarreo Intermedio = 1 If H = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BHI rel Bifurcar si está por encima If (C & Z) = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BHS rel Bifurcar si esta por encima o es igual If C = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing

21 BIH relBifurcar si Pin IRQ = 1 If IRQ = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BIL relBifurcar si Pin IRQ = 0 If IRQ = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BLE rel Bifurcar si es  (operandos con signo) If (Z & (N  V)) = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BLO rel Bifurcar si está por debajo If C = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BLS rel Bifurcar si esta por debajo o es igual If (C & Z) = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BLT rel Bifurcar si es < (operandos con signo) If (N  V) = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BMC rel Bifurcar si Máscara de Interrupción = 0 If I = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BMI rel Bifurcar si negativo If N = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BMS rel Bifurcar si Máscara de Interrupción = 1 If I = 1 then Branch Branch = PC + 2 + rel (REL) relative addressing BNE relBifurcar si no es igual If Z = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing

22 BPL rel Bifurcar si es positivo If N = 0 then Branch Branch = PC + 2 + rel (REL) relative addressing BRA relBifurcar SiemprePC = PC + 2 + rel(REL) relative addressing BRCLR n,opr8,rel Bifurcar si Bit n en Memoria = 0 If Mn = 0 then Branch Branch = PC + 3 + rel (DIR) 1 bit Direct BRN rel Nunca bifurcar PC = PC + 2 (REL) relative addressing BRSET n,opr8,rel Bifurcar si Bit n en Memoria = 1 If Mn = 1 then Branch Branch = PC + 3 + rel (DIR) 1 bit Direct

23 4.3 Saltos Especiales CBEQ opr8,rel CBEQ X+,rel CBEQ opr8,X+,rel CBEQ opr8,SP,rel Compara y salta si es Igual If A- (opr8) = 0 then Branch Branch = PC + 3 + rel If A - (HX) = 0 then Branch Branch = PC + 2 + rel HX = HX + 1 If A - (opr8 + HX) = 0 then Branch Branch = PC + 2 + rel HX = HX + 1 If A - (opr8 + SP) = 0 then Branch Branch = PC + 4 + rel (DIR) 8 Bit Direct (IX+) indexed with post increment (IX1+) indexed, 8 bit offset with post increment (SP1) Stack with 8 bit offset CBEQA #opr8,rel Compara con el valor inmediato y salta si es Igual If A - opr8 = 0 then Branch Branch = PC + 3 + rel (IMM) 8 Bit Immediate CBEQX #opr8,rel Compara con el valor inmediato y salta si es Igual If X - opr8 = 0 then Branch Branch = PC + 3 + rel (IMM) 8 Bit Immediate

24 DBNZ opr8,rel DBNZ X,rel DBNZ opr8,X,rel DBNZ opr8,SP,rel Decrementar y bifurcar si  0 (opr8) = (opr8) – 1 If (opr8)  0 then Branch Branch = PC + 3 + rel (HX) = (HX) – 1 If (HX)  0 then Branch Branch = PC + 3 + rel (opr8+HX) = (opr8+HX) – 1 If (opr8+HX)  0 then Branch Branch = PC + 4 + rel (opr8+SP) = (opr8+SP) - 1 If (opr8+SP)  0 then Branch Branch = PC + 4 + rel (DIR) direct mode (IX) indexed, no offset (IX1) indexed,8-bit offset (SP1) SP, 8-bit offset DBNZA rel Decrementar el Acumulador y bifurcar si  0 A = A - 1 If A  0 then Branch Branch = PC + 2 + rel (INH) inherent mode DBNZX rel Decrementar X y bifurcar si  0 X = X – 1 If X  0 then Branch Branch = PC + 2 + rel (INH) inherent mode

25 5. Instrucciones de llamado y retorno de subrutinas BSR relBifurcar a Subrutina PC = PC + 2 Push PCL SP = SP - 1 Push PCH SP = SP – 1 PC = PC + rel (REL) relative mode JSR opr8 JSR opr16 JSR,X JSR opr8,X JSR opr16,X Salto a subrutina PC = opr8 PC = opr16 PC = (HX) PC = (opr8 + HX) PC = (opr16 + HX) (DIR) 8 bit direct (EXT) 16 bit extended (IX) indexed no offset (IX1) indexed, 8 bit offset (IX2) indexed, 16 bit offset RTIRetorno de Interrupción SP = SP + 1 Pull CCR SP = SP + 1 Pull A SP = SP + 1 Pull X SP = SP + 1 Pull PCH SP = SP + 1 Pull PCL (INH) inherent addressing RTSRetorno de Subrutina SP = SP + 1 Pull PCH SP = SP + 1 Pull PCL (INH) inherent addressing

26 6. Instrucciones a nivel de bit BCLR n,opr8 Borrar Bit n en Memoria Mn  0; (n = 0,1,..7) M(opr8) can be any RAM or I/O register address (DIR) 1 bit direct BSET n,opr8 Hacer Bit n =1 en Memoria Mn <--- 1; ;(n = 0,1,..7) M(opr8) can be any RAM or I/O register address (DIR) 1 bit direct CLCBorrar Bit de Acarreo C  0 (INH) inherent Addressing CLI Borrar Máscara de Interrupción I  0 (INH) inherent addressing SEC Hacer 1 el Acarreo C  1 (INH) inherent addressing SEI Hacer 1 el bit de máscara de Interrupción I  1 (INH) inherent addressing

27 7. Otras instrucciones NOP No OperaciónDoes nothing(INH) inherent addressing STOP Enter STOP Mode, Enable ~IRQ Pin I  0 (INH) inherent addressing SWI Interrupción por Software PC = PC + 1 Push PCL SP = SP - 1 Push PCH SP = SP - 1 Push X SP = SP - 1 Push A SP= SP - 1 Push CCR SP = SP - 1 I = 0 PCH = ($FFFC) PCL = ($FFFD) (INH) inherent addressing WAITEnter Wait ModeI = 0(INH) inherent addressing


Descargar ppt "Modos de Direccionamiento y Set de instrucciones Microcontroladores Freescale Familia HC(S)08."

Presentaciones similares


Anuncios Google