Click here to load reader
Upload
cristian-izquierdo
View
41
Download
0
Embed Size (px)
Citation preview
Sintaxis de un módulo fuente ensamblador:
* Instrucciones: son representaciones simbólicas del juego de instrucciones de la CPU.
[Etiqueta] nombre instrucción [operando (1)] [comentario]
La instrucción se especifica en una sola línea y los campos se separan entre sí por blancos o tabuladores.
* Etiqueta: identificador simbólico que se da a la instrucción. Puede tener hasta 31 caracteres; el primero no numérico; indiferente usar mayúsculas o minúsculas. El ensamblador interpreta las etiquetas como direcciones de memoria. El último carácter es “:”.
* Nombre instrucción: de dos a seis letras y una instrucción se transformará en una única instrucción de código máquina.
* Operando(s): especifican los datos que serán tratados por la instrucción. Puede haber 0, 1 ó 2 operando. Si tenemos dos, el primero el “destino” y el segundo “fuente”. Se separan por una coma. Existen tres tipos: inmediatos, registro y memoria; y además se pueden modificar los operadores de memoria con los prefijos de segmento.
* Comentario: cualquier cosa que comience por “;”.
* Directivas (pseudoinstrucciones): son partes del fichero fuente que indican al ensamblador cómo interpretar instrucciones o datos; sólo se utilizan en tiempo de ensamblaje; no se traducen a código máquina.
[nombre] nombre directiva [operandos] [comentario]
instrucciones básicas de lenguaje ensamblador
ACALL Absolute Call
ADD Add Accumulator
ADDC Add Accumulator with Carry
AJMP Absolute Jump
ANL Logical AND for byte variables
ANL bit Logical AND for bit variables
CJNE Compare and Jump if Not Equal
CLR A Clear Accumulator
CLR bit Clear bit
CPL A Complement Accumulator
CPL bit Complement bit
DA Decimal Adjust of Accumulator
DEC Decrement Register
DIV Divide Accumulator by B
DJNZ Decrement Register and Jump if Not Zero
INC Increment Register
JB Jump if Bit Set
JBC Jump if Bit Set and Clear Bit
JC Jump if Carry Set
JMP @ Jump indirect to Address
JNB Jump if Bit Not Set
JNC Jump if Carry Not Set
JNZ Jump if Accumulator Not Zero
JZ Jump if Accumulator Zero
LCALL Long Call
LJMP Long Jump
MOV Move byte variable
MOV bit Move bit
MOVC Move Code Memory
MOVX Move External Memory
MUL Multiply Accumulator by B
NOP No Operation
ORL Logical OR for byte variables
ORL bit Logical OR for bit variables
POP Pop From Stack
PUSH Push Onto Stack
RET Return From Subroutine
RETI Return From Interrupt
RL Rotate Accumulator Left
RLC Rotate Accumulator Left Through Carry
RR Rotate Accumulator Right
RRC Rotate Accumulator Right Through Carry
SETB Set Bit
SJMP Short Jump
SUBB Subtract From Accumulator With Borrow
SWAP Swap Accumulator Nibbles
XCH Exchange Bytes
XCHD Exchange Digits
XRL Exclusive OR
?? Undefined Instruction
Bibliografía http://www.sc.ehu.es/sbweb/webcentro/automatica/web_8051/Contenido/set_8051/set8051.htm
http://html.rincondelvago.com/ensamblador_lenguajes-de-programacion.html