
Chapter 6
6.3 Program Control
The EM60000 series provide easy but powerful program control instructions,
such as: jump, call, computed jump, test/skip, etc.
The following examples demonstrate some of the simple program controls.
6.3.1 Example 1 - Using DJZ or DJZA
;--------------------------------------------------------------
; Instruction about "DJZ", or "DJZA".
;--------------------------------------------------------------
ORG
0x0000
JMP POWERON
; go to power-on procedure
ORG 0x0010
; power-on reset procedure
POWERON:
MOV A, @0x02
MOV 0x14, A
; R14=02
MOV A, @0x01
MOV 0x13, A
; R13=01
DJZA 0x13
; R13-1->A If A=0 -> skip
JMP OVER
; else -> jump over
LOOP: DJZ 0x14
; R14-1->R14 (loop 2 times)
JMP LOOP
; if R14=0, -> skip
OVER: JMP OVER
; else -> jump OVER
6.3.2 Example 2 - Using JBC, JBS, BC, and BS
;--------------------------------------------------------------
; Instruction about "JBC","JBS","BC", and "BS"
;--------------------------------------------------------------
ORG
0x0000
JMP POWERON
; go to power-on procedure
ORG 0x0010
; power-on reset procedure
POWERON: MOV A, @0x0F ; A=0x0F
MOV 0x14, A
; R14=0x0F
MOV 0x13, A
; R13=0x0F
JBC 0x13, 4
; If R13(4)=0, -> R14(5)=1
BC 0x14, 1
; else -> R14(1)=0
BS 0x14, 5
JBS 0x13, 1
; If R13(1)=1, -> R14(2)=0
BS 0x14, 6
; else -> R14(6)=1
BC 0x14, 2
; R14=0x2B
OVER: JMP OVER
76
•
Software Application
EM60000Series User’s Manual
Содержание EM60000 series
Страница 8: ...Contents viii Contents EM60000 Series User s Manual ...
Страница 24: ...Chapter 2 16 Architecture EM60000 Series User s Manual ...
Страница 54: ...Chapter 4 46 Special Function Control EM60000Series User s Manual ...
Страница 80: ...Chapter 5 72 Instruction Set EM60000Series User s Manual ...