检测一下吧
ORG 00H
START:MOV A,#09H
CLR A
MOV R1,#8
LEFT:RLC A
MOV P0,A
CALL DELAY
JNB P1.0,RIGHT
SJMP LEFT
MOV R2,#7
RIGHT:RRC A
JNB P1.0,LEFT
SJMP RIGHT
DELAY:MOV R3,#20
DEL1:MOV R4,#20
DEL2:MOV R5,#248
DJNZ R5,$
DJNZ R4,DEL2
DJNZ R3,DEL1
RET
END