本帖最后由 daniu 于 2014-12-25 13:18 编辑
- ORG 0000H
- MOV SP,50H
- SJMP MAIN
- MAIN: LCALL SM
- CJNE R7,#16,N0
- SJMP MAIN
- N0: MOV 30H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N0
- MAIN0: LCALL SM
- CJNE R7,#16,N1
- SJMP MAIN0
- N1: MOV 31H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N1
- MAIN1: LCALL SM
- CJNE R7,#16,N2
- SJMP MAIN1
- N2: MOV 32H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N2
- MAIN2: LCALL SM
- CJNE R7,#16,N3
- SJMP MAIN2
- N3: MOV 33H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N3
- MAIN3: LCALL SM
- CJNE R7,#16,N4
- SJMP MAIN3
- N4: MOV 34H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N4
- MAIN4: LCALL SM
- CJNE R7,#16,N5
- SJMP MAIN4
- N5: MOV 35H,R7
- LCALL SM
- LCALL XS
- CJNE R7,#16,N5
- YZ: MOV A,30H
- CJNE A,#3,CW
- MOV A,31H
- CJNE A,#3,CW
- MOV A,32H
- CJNE A,#3,CW
- MOV A,33H
- CJNE A,#3,CW
- MOV A,34H
- CJNE A,#3,CW
- MOV A,35H
- CJNE A,#3,CW
- CLR P1.1
- SJMP $
- RET
- CW: CLR P2.6
- SJMP $
- RET
- XS: MOV DPTR,#TAB
- MOV A,30H
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- MOV A,31H
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- MOV A,32H
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- MOV A,33H
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- MOV A,34H
- MOV DPTR,#TAB
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- MOV A,35H
- MOVC A,@A+DPTR
- MOV SBUF,A
- JNB TI,$
- CLR TI
- LCALL YS
- RET
- SM:MOV P0,#0F0H
- MOV R7,P0
- CJNE R7,#0F0H,KX
- SJMP KK
- LCALL YS
- CJNE R7,#0F0H,KX
- SJMP KK
- KX:MOV P0,#0FH
- MOV A,P0
- ORL A,R7
- CJNE A,#0EEH,K1
- MOV R7,#1
- RET
- K1:CJNE A,#0EDH,K2
- MOV R7,#2
- RET
- K2:CJNE A,#0EBH,K3
- MOV R7,#3
- RET
- K3:CJNE A,#0E7H,K4
- MOV R7,#4
- RET
- K4:CJNE A,#0DEH,K5
- MOV R7,#5
- RET
- K5:CJNE A,#0DDH,K6
- MOV R7,#6
- RET
- K6:CJNE A,#0DBH,K7
- MOV R7,#7
- RET
- K7:CJNE A,#0D7H,K8
- MOV R7,#8
- RET
- K8:CJNE A,#0BEH,K9
- MOV R7,#9
- RET
- K9:CJNE A,#0BDH,K10
- MOV R7,#0
- RET
- K10:CJNE A,#0BBH,K11
- MOV R7,#10
- RET
- K11:CJNE A,#0B7H,K12
- MOV R7,#11
- RET
- K12:CJNE A,#07EH,K13
- MOV R7,#12
- RET
- K13:CJNE A,#07DH,K14
- MOV R7,#13
- RET
- K14:CJNE A,#07BH,K15
- MOV R7,#14
- RET
- K15:CJNE A,#077H,K16
- MOV R7,#15
- RET
- K16:NOP
- RET
- KK:MOV R7,#16
- RET
- YS:MOV R6,#00FH
- Y1:MOV R5,#0FFH
- DJNZ R5,$
- DJNZ R6,Y1
- RET
- TAB:DB 088H,0BEH,0C4H,094H,0B2H
- DB 091H,081H,0BCH,080H,090H
- END
复制代码
|