1 JZ、JNZ分支程序实例
JZ M0
MOV A,R4
JNZ M1
M0:
AJMP G0
M1:
ACALL DP
JZ OV2
JC OV2
ORL 09H,#80H
ORL 0DH,#80H
MOV 1DH,R5
MOV 1EH,R6
MOV 1FH,R7
MOV R0,#25
CLR A
MOV R6,A
MOV R7,A
CLR C
LOOP1:
JNC M2
ACALL ADD0
ADDC A,R1
RET
2 JC、JNC分支程序实例
HSSV:
PUSH
CMP 25H,#8
JC SND7
SHR 28H,#1
MOV HSOCMD,#10H
JNC SND02
SND01:
MOV HSOCMD, #30H
SND02:
ADD HSOTIME,TIME1, #104
INC 25H
SJMP SND04
SND03:
MOV 28H,@26H
CMP 28H, #0AH
CLR 25H
MOV HSOCMD, #10H
ADD HSOTIME,TIME1, #104
INC 26H
MOV 28H,@26H
SJMP SND6
SND71:
OR 24H, #40H
SJMP SND03
SND7:
OR 24H, #80H
SND70:
MOV 26H, #DATA2
CLR 25H
SND04:
POP
RET
3 JB、JNB分支程序实例
FPCP:
MOV A,R1
XRL A,R5
JNB ACC.7,CP1
CP0:
MOV A,R1
CLR C
SUBB A,R5
RET
CP1:
MOV A,R1
JNB ACC.7,CP2
ACALL CP2
JZ CP4
CPL C
RET
CP2:
MOV A,R4
CLR C
SUBB A,R0
JNZ CP4
CP3:
MOV A,R5
SUBB A,R1
JNZ CP4
MOV A,R6
SUBB A,R2
JNZ CP4
MOV A,R7
SUBB A,R3
CP4:
RET
4 CJNE分支程序实例
CJNE A,#40H,NEQ
EQ:
MOP
NEQ:
JC LOW
NOP
LOW:
NOP
RET
5 DJNZ分支程序实例
SETB P1.1
DL:
MOV 30H,#06H
DL0:
MOV 31H,#0F2H
DL1:
DJNZ 30H,DL1
DJNZ 30H,DL0
CPL P1.1
AJMP DL