在线等回复,大虾帮忙。
这个程序是正确的,原程序如下。
ORG 0
LJMP MAIN
ORG 0013H
LJMP INT1P
ORG 0030H
MAIN: MOV SP,#60H
SETB EX1
MOV DPTR,#5FFFH
MOV A,#0DCH
MOVX @DPTR,A
LP: MOVX A,@DPTR
JB ACC.7,LP
MOV A,#00H
MOVX @DPTR,A
MOV A,#34H
MOVX @DPTR,A
CLR IT1
SETB EA
CLR 12H
MLF0: LCALL CDIR
MOV R1,#50H
MOV R7,#6
MOV R0,#3EH
MLF2: LCALL KEYI
LCALL DATAM
PUSH PSW
SETB PSW.4
LCALL DISY
POP PSW
DJNZ R7,MLF2
LCALL DELAY
LCALL DELAY
LCALL DEAL
LCALL TRANS
MLP40: LCALL DISY
LCALL AKSS
JZ MLP40
LJMP MLF0
;****************************
DATAM: MOV @R1,A
MOV @R0,A
INC R1
DEC R0
RET
DEAL: CLR 00H
MOV R7,#6
MOV R0,#50H
MOV A,@R0
LOOP: INC R0
MOV R2,A
SUBB A,@R0
MOV A,R2
JC NEXT
SETB 00H
XCH A,@R0
DEC R0
XCH A,@R0
INC R0
NEXT: MOV A,@R0
DJNZ R7,LOOP
JB 00H,DEAL
RET
TRANS: MOV R0,#3EH
MOV R1,#50H
MOV R7,#6
LOP0: MOV A,@R1
MOV @R0,A
INC R1
DEC R0
DJNZ R7,LOP0
RET
;***************************
INT1P: PUSH ACC
PUSH DPH
PUSH DPL
CLR EA
MOV A,#40H
MOV DPTR,#5FFFH
MOVX @DPTR,A
MOV DPTR,#5EFFH
MOVX A,@DPTR
MOV 27H,A
SETB 12H
SETB EA
POP DPL
POP DPH
POP ACC
RETI
;*****************************
KEYI: JNB 12H,KEYI
MOV A,27H
ANL A,#0FH
CLR 12H
RET
CDIR: MOV R0,#39H
MOV R7,#6
CDIQ: MOV @R0,#17H
INC R0
DJNZ R7,CDIQ
RET
AKSS: JNB 12H,AKSS
RET
DISY: MOV R2,#06H
MOV A,#92H
MOV DPTR,#5FFFH
MOVX @DPTR,A
MOV R0,#39H
TY11: MOV A,@R0
MOV DPTR,#TABL
MOVC A,@A+DPTR
MOV DPTR,#5EFFH
MOVX @DPTR,A
INC R0
DJNZ R2,TY11
RET
DELAY: MOV R6,#10H
MOV R7,#10H
DEL: DJNZ R6,$
DJNZ R7,DEL
RET
TABL: DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H,88H
DB 83H,0C6H,0A1H,86H,8EH,8CH
DB 0C1H,89H,0C7H,0BFH,91H
DB 00H,0FFH
END