Vous êtes sur la page 1sur 27

Modos de Direccionamiento

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

0. Modos de direccionamiento
Direccionamiento
Inherente (INH)

La instruccin no especifica un operando (la CPU lo


conoce), de esta manera no se necesitan datos adicionales
para la ejecucin de la instruccin.
En general, son operaciones sobre los registros de la CPU o
sobre bits.
Ejemplo: CLRA

Direccionamiento Especifica el valor de una constante directamente, no la


Inmediato (IMM) direccin del valor.

Indicado por el simbolo #


Ejemplo: LDA #0FFH
Direccionamiento
Directo (DIR)

Se especifican 8 bits con la direccin del operando. El byte


superior de los 16 bits de direccin se asume que es 00H.
Utilizado para acceder a los primeros 256 bytes del mapa de
memoria
Ejemplo: LDA 50H

Direccionamiento
Extendido (EXT)

Se especifican 16 bits con la direccccin 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


direccin del operando
Ejemplo: CLR ,X

Direccionamiento
Indexado con
Offset de 8 bits
(IX1)

Offset de 8 bits sin signo + registro H:X sin signo = posicin


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 =


posicin 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 = posicin


memoria
Registro SP no es modificado
Ejemplo: LDA 5,SP

Direccionamiento
Indexado con el
SP y Offset de 16
bits (SP2)

Offset de 16 bits sin signo + Registro SP sin signo = posicin


memoria
Registro SP no es modificado
Ejemplo: LDA 0500H,SP

Direccionamiento
Relativo (REL)

Usado en todas las instrucciones de bifurcacin condicionales


Si la condicin 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 direccin del operando.


Despues que la direccin 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


despus que la direccin del operando es calculada, H:X es
incrementado en 1
Ejemplo: CBEQ 50H,X+,2480H

Direccionamiento
Memoria a
memoria

Usado para mover informacin desde una posicin 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

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 direccin del operando es hallada, H:X es
incrementado en 1

Direccionamiento
Memoria a
memoria
Directo a
Indexado con
PostIncremento
(DIX+)

La Fuente debe estar en las primeras 256 posiciones del mapa


de memoria

Ejemplo: MOV X+,25H

El Destino puede ser cualquier lugar en el mapa de memoria


Despues que la direccin del operando es hallada, H:X es
incrementado en 1
Ejemplo: MOV 75H,X+

1. Instrucciones Aritmticas
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

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

ADD #opr8
ADD opr8
ADD opr16
ADD ,X
ADD opr8,X
ADD opr16,X
ADD opr8,SP
ADD opr16,SP

(DIR) 8 bit direct


(IX) indexed no offset
(IX1) indexed, 8 bit offset
(SP1) SP with 8 bit offset

ASLA

C (opr8) 0
Corrimiento Aritmtico C (HX) 0
a la izquierda
C (opr8 + HX) 0
C (opr8 + SP) 0
Corrimiento Aritmtico C A 0
a la izquierda de A

ASLX

Corrimiento Aritmtico C X 0
a la izquierda de X

(INH) inherent mode

ASR opr8
ASR ,X
ASR opr8,X
ASR opr8,SP

(DIR) 8 bit direct


(IX) indexed, no offset
(IX1) indexed, 8 bit offset
(SP1) SP with 8 bit offset

ASRA

M7 (opr8) C
Corrimiento Aritmtico M7 (HX) C
a la derecha
M7 (opr8 + HX) C
M7 (opr8 + SP) C
Corrimiento Aritmtico A7 A C
a la derecha de A

ASRX

Corrimiento Aritmtico X7 X C
a la derecha de X

(INH) inherent mode

ASL opr8
ASL ,X
ASL opr8,X
ASL opr8,SP

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)

(INH) inherent mode

(INH) inherent mode

(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

CPHX #opr16
CPHX opr16
CPX #opr8
CPX opr8
CPX opr16
CPX ,X
CPX opr8,X
CPX opr16,X
CPX opr8,SP
CPX opr16,SP
DAA
DEC opr8
DEC ,X
DEC opr8,X
DEC opr8,SP

Comparar H:X con


Memoria

Comparar Registro X
con Memoria

Ajuste Decimal de
Acumulador
Decrementar

HX - opr16
HX - (opr16)

(IMM) 16 bit immediate


(DIR) direct, 16 bit data

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

A10

(INH) inherent addressing

(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

DECA

Decrementar A

A= A- 1

(INH) inherent mode

DECX

Decrementar X

X=X-1

(INH) inherent mode

Divisin

A = H:A
X

DIV
INC opr8
INC ,X
INC opr8,X
INC opr8,SP

Incrementar

H = Residuo

(opr8) = (opr8)+ 1
(HX) = (HX) + 1
(opr8+HX)=(opr8+HX)+1
(opr8+SP) = (opr8+SP)+ 1

(INH) inherent addressing


(DIR) 8 bit direct
(IX) indexed no offset
(IX1) indexed,8 bit offset
(SP1) SP with 8 bit offset

INCA

Incrementar A

A= A+ 1

(INH) inherent mode

INCX

Incrementar X

X=X+1

(INH) inherent mode

MUL

Multiplicacin

X:A = A * X

(INH) inherent addressing

NSA

Nibble Swap
Accumulator

A = A[3:0]:A[7:4]

(INH) inherent addressing

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

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

(opr8) - $00
(HX) - $00
(opr8+HX) - $00

(DIR) 8 bit direct


(IX) indexed no offset
(IX1) indexed 8 bit offset

SBC #opr8
SBC opr8
SBC opr16
SBC ,X
SBC opr8,X
SBC opr16,X
SBC opr8,SP
SBC opr16,SP
SUB #opr8
SUB opr8
SUB opr16
SUB ,X
SUB opr8,X
SUB opr16,X
SUB opr8,SP
SUB opr16,SP
TST opr8
TST ,X
TST opr8,X

Resta con Prstamo

Resta

Test for Negative or


Zero

2. Instrucciones Lgicas
AND #opr8
AND opr8
AND opr16
AND ,X
AND opr8,X
AND opr16,X
AND opr8,SP
AND opr16,SP
BIT #opr8
BIT opr8
BIT opr16
BIT ,X
BIT opr8,X
BIT opr16,X
BIT opr8,SP
BIT opr16,SP
COM opr8
COM ,X
COM opr8,X
COM opr8,SP
COMA

Funcin Lgica AND

Bit Test

Complemento a uno

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

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

(DIR) 8 bit direct


(IX) indexed no offset
(opr8+HX)=$FF-(opr8+HX) (IX1) indexed,8 bit offset
(opr8+SP)=$FF-(opr8+SP) (SP1) SP, 8 bit offset
(opr8) = $FF - (opr8)
(HX) = $FF - (HX)

Complemento a uno de A A = $FF - A

(INH) inherent addressing

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

(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

LSLA

A = A opr8
A = A (opr8)
A = A (opr16)
OR Exclusiva entre
A = A (HX)
Acumulador y Memoria
A = A (opr8+ HX)
A = A (opr16+ HX)
A = A (opr8+ SP)
A = A (opr16+ SP)
C (opr8) 0
Corrimiento Lgico a la C (HX) 0
Izquierda
C (opr8+ HX) 0
C (opr8+ SP) 0
Corrimiento Lgico a la C A 0
Izquierda de A

LSLX

Corrimiento Lgico a la C X 0
Izquierda de X

(INH) inherent addressing

LSR opr8
LSR ,X
LSR opr8,X
LSR opr8,SP

0 (opr8) C
Corrimiento Lgico a la 0 (HX) C
Derecha
0 (opr8+HX) C
0 (opr8+SP) C
Corrimiento Lgico a la 0 A C
Derecha de A

(DIR) 8 bit direct


(IX) indexed no offset
(IX1) indexed, 8 bit offset
(SP1) SP with 8 bit offset

LSL opr8
LSL ,X
LSL opr8,X
LSL opr8,SP

LSRA
LSRX

Corrimiento Lgico a

0 X C

(DIR) 8 bit direct


(IX) indexed no offset
(IX1) indexed, 8 bit offset
(SP1) SP with 8 bit offset
(INH) inherent addressing

(INH) inherent addressing


(INH) inherent addressing

NEG opr8
NEG ,X
NEG opr8,X
NEG opr8,SP

Complemento a Dos

(DIR) 8 bit direct


(IX) indexed no offset
(opr8+HX) = $00- (opr8+HX) (IX1) indexed,8 bit offset
(opr8+SP)=$00-(opr8+SP) (SP1) SP with 8 bit offset
(opr8) = $00 - (opr8)
(HX) = $00 - (HX)

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

A = A or opr8
A = A or (opr8)
A = A or (opr16)
OR entre Acumulador y A = A or (HX)
Memoria
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
ROLA
ROLX

Rotacin a la izquierda
a travs 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

Rotacin a la izquierda
del Acumulador a
travs del Acarreo

C A C

(INH) inherent addressing

Rotacin a la izquierda
de X a travs del
Acarreo

CXC

(INH) inherent addressing

ROR opr8
ROR ,X
ROR opr8,X
ROR opr8,SP
RORA
RORX

C (opr8) C
Rotacin a la derecha a C (HX) C
travs del Acarreo
C (opr8+ HX) C
C (opr8+ SP) C
Rotacin a la derecha
del Acumulador a travs C A C
del Acarreo
Rotacin a la derecha
de X a travs del
Acarreo

CXC

(DIR) 8 bit direct


(IX) indexed no offset
(IX1) indexed 8 bit offset
(SP1) SP with 8 bit offset
(INH) inherent addressing
(INH) inherent addressing

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

CLRA

Borrar 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

LDX #opr8
LDX opr8
LDX opr16
LDX ,X
LDX opr8,X
LDX opr16,X
LDX opr8,SP
LDX opr16,SP
MOV
#opr8_1,opr8_2
MOV
opr8_1,opr8_2
MOV X+,opr8

Cargar X

Mover Byte

MOV opr8,X+

PSHA

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

(opr8_1) = opr8_2

(IMD) immediate-direct

(opr8_2) = (opr8_1)

(DD) direct to direct

(opr8) = (HX)
HX = HX + 1
(HX) = (opr8)
HX = HX + 1

(IX+D) indexed to direct


with post increment
(DIX+) direct to indexed
with post increment

Guardar el Acumulador Push A to stack


de la pila
SP = SP - 1

(INH) inherent addressing

PSHH

Guardar H en la pila

Push H to stack
SP = SP - 1

(INH) inherent addressing

PSHX

Guardar X en la pila

Push X to stack
SP = SP - 1

(INH) inherent addressing

PULA

Sacar Acumulador de la SP = SP + 1
pila
Pull A

(INH) inherent addressing

PULH

Sacar H de la pila

SP = SP + 1
Pull H

(INH) inherent addressing

PULX

Sacar X de la pila

SP = SP + 1
Pull X

(INH) inherent addressing

Inicializar SP

SPL = $FF

(INH) inherent addressing

RSP
STA opr8
STA opr16
STA ,X
STA opr8,X
STA opr16,X
STA opr8,SP
STA opr16,SP
STHX opr8
STX opr8
STX opr16
STX ,X
STX opr8,X
STX opr16,X
STX opr8,SP
STX opr16,SP
TAP

(opr8) = A
(opr16) = A
(HX) = A
Almacenar Acumulador (opr8+ HX) = A
en Memoria
(opr16+ HX) = A
(opr8+ SP) = A
(opr16+ SP) = A
Almacenar H:X en
Memoria

Almacenar X en
Memoria

(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

(opr8:opr8+1) = HX

(INH) inherent addressing

(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

Transfer Accumulator to CCR = A


CCR

(INH) inherent addressing

TAX

Transfer Accumulator to X = A
Index Register X

(INH) inherent addressing

TPA

Transfer CCR to
Accumulator

TSX

Transfer Stack Pointer


to Index Register H:X

TXA

Transfer Index Register A = X


X to Accumulator

(INH) inherent addressing

TXS

Tansfer Index Register


H:X to Stack Pointer

(INH) inherent addressing

A = CCR

(INH) inherent addressing

H:X = SPH:SPL

(INH) inherent addressing

SPH:SPL = H:X

4. Instrucciones de Salto
4.1 Saltos Incondicionales

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

Bifurcar si es igual

If Z = 1 then Branch
Branch = PC + 2 + rel

(REL) relative addressing

BGE rel

Bifurcar si es
(operandos con signo)

BGT rel

Bifurcar si es >
(operandos con signo)

If (N V) = 0 then Branch

Branch = PC + 2 + rel

(REL) relative addressing

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


(REL) relative addressing
Branch = PC + 2 + rel

BHS rel

Bifurcar si esta por


encima o es igual

If C = 0 then Branch
Branch = PC + 2 + rel

(REL) relative addressing

BIH rel

If IRQ = 1 then Branch


Bifurcar si Pin IRQ = 1 Branch = PC + 2 + rel

(REL) relative addressing

BIL rel

Bifurcar 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 Mscara de
Interrupcin = 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 Mscara de
Interrupcin = 1

If I = 1 then Branch
Branch = PC + 2 + rel

(REL) relative addressing

BNE rel

Bifurcar si no es igual

If Z = 0 then Branch
Branch = PC + 2 + rel

(REL) relative addressing

BPL rel

Bifurcar si es positivo

BRA rel

Bifurcar Siempre

BRCLR
n,opr8,rel

Bifurcar si Bit n en
Memoria = 0

BRN rel
BRSET
n,opr8,rel

Nunca bifurcar
Bifurcar si Bit n en
Memoria = 1

If N = 0 then Branch
Branch = PC + 2 + rel

(REL) relative addressing

PC = PC + 2 + rel

(REL) relative addressing

If Mn = 0 then Branch
Branch = PC + 3 + rel

(DIR) 1 bit Direct

PC = PC + 2

(REL) relative addressing

If Mn = 1 then Branch
Branch = PC + 3 + rel

(DIR) 1 bit Direct

4.3 Saltos Especiales


CBEQ opr8,rel

CBEQ X+,rel

CBEQ
opr8,X+,rel

Compara y salta si es
Igual

If A- (opr8) = 0 then
Branch
Branch = PC + 3 + rel

(DIR) 8 Bit Direct

If A - (HX) = 0 then
Branch
Branch = PC + 2 + rel
HX = HX + 1

(IX+) indexed with post


increment

If A - (opr8 + HX) = 0
then Branch
Branch = PC + 2 + rel
HX = HX + 1

(IX1+) indexed, 8 bit offset


with post increment

If A - (opr8 + SP) = 0 then (SP1) Stack with 8 bit


Branch
offset
Branch = PC + 4 + rel

CBEQ
opr8,SP,rel

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

(DIR) direct mode

DBNZ opr8,rel

(opr8) = (opr8) 1
If (opr8) 0 then Branch
Branch = PC + 3 + rel

(IX) indexed, no offset

DBNZ X,rel

(HX) = (HX) 1
If (HX) 0 then Branch
Branch = PC + 3 + rel
(opr8+HX) = (opr8+HX)
1

(IX1) indexed,8-bit offset

DBNZ opr8,X,rel

Decrementar y bifurcar
si 0

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

DBNZ
opr8,SP,rel

(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=X1
If X 0 then Branch
Branch = PC + 2 + rel

(INH) inherent mode

5. Instrucciones de llamado y
retorno de subrutinas
BSR rel

JSR opr8
JSR opr16
JSR ,X
JSR opr8,X
JSR opr16,X

RTI

RTS

Bifurcar a Subrutina

Salto a subrutina

PC = PC + 2
Push PCL
SP = SP - 1
Push PCH
SP = SP 1
PC = PC + rel

(REL) relative mode

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

SP = SP + 1 Pull CCR
SP = SP + 1 Pull A
Retorno de Interrupcin SP = SP + 1 Pull X
SP = SP + 1 Pull PCH
SP = SP + 1 Pull PCL
Retorno de Subrutina

SP = SP + 1
Pull PCH
SP = SP + 1
Pull PCL

(INH) inherent addressing

(INH) inherent addressing

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

CLC

Borrar Bit de Acarreo

C0

(INH) inherent Addressing

CLI

Borrar Mscara de
Interrupcin

I0

(INH) inherent addressing

C1

(INH) inherent addressing

SEC

Hacer 1 el Acarreo

SEI

Hacer 1 el bit de
mscara de Interrupcin I 1

(INH) inherent addressing

7. Otras instrucciones
NOP

No Operacin

STOP

Enter STOP Mode,


Enable ~IRQ Pin

Does nothing

(INH) inherent addressing

I0

(INH) inherent addressing

(INH) inherent addressing

(INH) inherent addressing

SWI

Interrupcin 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)

WAIT

Enter Wait Mode

I=0

Vous aimerez peut-être aussi