S EQU 2000H
T EQU 30H
N DATA 38H
M DATA 39H
FIND BIT 00H
TEST:
MOV N,#5BH
MOV P2,#HIGH(S)
MOV R0,#LOW(S)
MOV DPTR,#LIST
MOV R2,N
LOOP:
CLR A
MOVC A,@A+DPTR
MOVX @R0,A
INC R0
INC DPTR
DJNZ R2,LOOP
MOV M,#6
MOV T,#"8"
MOV T+1,#"0"
MOV T+2,#"C"
MOV T+3,#"5"
MOV T+4,#"5"
MOV T+5,#"2"
LCALL BFSRCH
MOV M,#5
MOV T,#"8"
MOV T+1,#"0"
MOV T+2,#"C"
MOV T+3,#"5"
MOV T+4,#"1"
LCALL BFSRCH
STOP:
LJMP STOP
LIST:
DB "The 80C51 "
DB "two power mode"
DB "modes of operation "
DB "modes of power down "
BFSRCH:
MOV DPTR,#S
MOV A,N
CLR C
SUBB A,M
INC A
MOV R7,A
BF0:
MOV R0,#T
MOV R6,M
MOV R4,DPH
MOV R5,DPL
BF1:
MOVX A,@DPTR
XRL A,@R0
JNZ BF2
INC R0
INC DPTR
DJNZ R6,BF1
SETB FIND
MOV DPH,R4
MOV DPL,R5
RET
BF2:
MOV DPH,R4
MOV DPL,R5
INC DPTR
DJNZ R7,BF0
CLR FIND
RET