Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Instruction Set
Instruction Set
Copy
Arithmetic
Logic
Bit Manipulation
Redirect
Control
Addressing Modes
Immediate
MOV A, #32H
MOV B, #0F2H
MOV DPTR, #20FFH
Register
MOV A, R7
MOV R5, A
MOV R1, R2 ; Illegal - Not allowed
MOV @R1, A
; Clear A
;Set up R5 as a counter
;Clear memory
;Point to next me memory
R5, REPEAT
DPTR, #100H
CLR A
MOVC A, @ A + DPTR ;Copy from Code memory into A
Note Instruction: MOVC Copy from code memory
Problem:
Write a program to transfer a string of data
terminated in 00 from code memory location 200H
to RAM location 50H.
Program:
REPEAT:
CLR
MOV A, @A+DPTR
JZ
EXIT
MOV @R0, A
INC
DPTR
INC
R0
SJMP REPEAT
HERE:
SJMP HERE
Jump Instructions:
Unconditional:
LJMP (Long Jump 3 bytes anywhere from
0000 to FFFFH)
Example: LJMP START
SJMP (Short Jump 2 bytes Opcode followed
by an 8-bit signed number - limited to 00 to FFH
Backward and Forward - )
; Short Jump if A = 0
JNZ
; Short Jump if A =/ 0
PSW.7
PSW.0
CY
PSW.6
AC
PSW.2
OV
; Set bit = 1
CLR
bit
; Clear bit
CPL
bit
JB
JNB
JBC
BIT
BIT
P0.7
P1.0
MOV C, SW
LED , C
SJMP HERE
EQU P0.7
EQU P1.0
MOV C, SW
LED , C
SJMP HERE