ORG 0100 h
MAIN: MOV SP, # 70 h
START: MOV P2, # 00 h
SCAN: MOV P1, # 0 f0h
LOOP: MOV A, P1
ANL A, # 0 f0h
XRL A, # 0 f0h
JZ LOOP
ACALL DEL15ms
MOV A, P1
ANL A, # 0 f0h
XRL A, # 0 f0h
JZ LOOP
R_SCAN: MOV P1, # 11111110 b
MOV A, P1
ANL A, # 0 f0h
CJNE A, # 0 f0h, ROW_0
MOV P1, # 11111101 b
MOV A, P1
ANL A, # 0 f0h
CJNE A, # 0 f0h, ROW_1
MOV P1, # 11111011 b
MOV A, P1
ANL A, # 0 f0h
CJNE A, # 0 f0h, ROW_2
MOV P1, # 11110111 b
MOV A, P1
ANL A, # 0 f0h
CJNE A, # 0 f0h, ROW_3
AJMP LOOP
ROW_0: MOV DPTR, # KCODE0
AJMP CFIND
ROW_1: MOV DPTR, # KCODE1
AJMP CFIND
ROW_2: MOV DPTR, # KCODE2
AJMP CFIND
ROW_3: MOV DPTR, # KCODE3
CFIND: JNB ACC. 4, KEY
INC DPTR
JNB ACC. 5, the KEY
INC DPTR
JNB ACC. 6 KEY
INC DPTR
KEY: the CLR A
MOVC A, @ A + DPTR
MOV P2, A
AJMP SCAN
DEL15ms: MOV R7, # 30
D1: MOV R6, # 250
DJNZ R7, D1
RET
3 fh KCODE0: DB, 6 h, 5 bh, 4 fh
Dh KCODE1: DB 66 h, 6, 7 dh, 7 h
7 fh KCODE2: DB, 6 fh, 77 h, 7 ch
39 h KCODE3: DB, 5 eh, 79 h, 71 h
END
I use the ASM c51 kile translation not to come out for bosses for help