STACK EQU 1FH BOTTOM EQU 00H TOP DATA 3EH TREE EQU 20H POINT1 EQU 21H POINT2 EQU 22H POINT3 EQU 23H OUT EQU 24H TST: MOV SP,#5FH MOV DPTR,#DATS MOV P2,#TREE MOV R0,#0 MOV R2,#19 CPY: CLR A MOVC A,@A+DPTR MOVX @R0,A INC DPTR INC R0 DJNZ R2,CPY MOV DPTR,#Z1 MOV P2,#POINT1 MOV R0,#0 MOV R2,#19 CPY1: CLR A MOVC A,@A+DPTR MOVX @R0,A INC DPTR INC R0 DJNZ R2,CPY1 MOV DPTR,#Z2 MOV P2,#POINT2 MOV R0,#0 MOV R2,#19 CPY2: CLR A MOVC A,@A+DPTR MOVX @R0,A INC DPTR INC R0 DJNZ R2,CPY2 MOV DPTR,#Z3 MOV P2,#POINT3 MOV R0,#0 MOV R2,#19 CPY3: CLR A MOVC A,@A+DPTR MOVX @R0,A INC DPTR INC R0 DJNZ R2,CPY3 MOV DPH,#OUT MOV DPL,#0 MOV R2,#0 CLR A CLEAR: MOVX @DPTR,A INC DPTR DJNZ R2,CLEAR MOV P2,#TREE MOV R0,#0 MOV DPH,#OUT MOV DPL,#0 MOVX A,@R0 MOVX @DPTR,A INC R0 INC DPTR JZ STOP LCALL SETNULL LCALL POST STOP: LJMP STOP DATS: DB 12H,41H,42H,43H DB 44H,45H,46H,47H DB 48H,49H,4AH,4BH DB 4CH,4DH,4EH,4FH DB 50H,51H,52H Z1: DB 00H,02H,05H,00H DB 07H,08H,00H,0AH DB 0CH,00H,0FH,12H DB 00H,00H,00H,00H DB 00H,00H,00H Z2: DB 00H,03H,06H,00H DB 00H,09H,00H,0BH DB 0DH,00H,10H,00H DB 00H,00H,00H,00H DB 00H,00H,00H Z3: DB 00H,04H,00H,00H DB 00H,00H,00H,00H DB 0EH,00H,11H,00H DB 00H,00H,00H,00H DB 00H,00H,00H POST: MOV P2,#TREE MOVX A,@R0 JZ POSTEND MOV P2,#POINT1 MOVX A,@R0 JZ POST1 XCH A,R0 LCALL DPUSH LCALL POST LCALL DPOP MOV R0,A MOV P2,#POINT2 MOVX A,@R0 JZ POST1 XCH A,R0 LCALL DPUSH LCALL POST LCALL DPOP MOV R0,A MOV P2,#POINT3 MOVX A,@R0 JZ POST1 XCH A,R0 LCALL DPUSH LCALL POST LCALL DPOP MOV R0,A POST1: MOV P2,#TREE MOVX A,@R0 MOVX @DPTR,A INC DPTR POSTEND: RET SETNULL: MOV A,#BOTTOM MOV TOP,A RET DPUSH: INC TOP PUSH DPH PUSH DPL MOV DPH,#STACK MOV DPL,TOP MOVX @DPTR,A POP DPL POP DPH RET DPOP: PUSH DPH PUSH DPL MOV DPH,#STACK MOV DPL,TOP MOVX A,@DPTR DEC TOP POP DPL POP DPH RET