STACK EQU 1FH BOTTOM EQU 00H TOP DATA 3EH TREE EQU 20H OUT EQU 21H TST: MOV SP,#5FH MOV DPTR,#DATS MOV P2,#TREE MOV R0,#0 MOV R2,#32 CPY: CLR A MOVC A,@A+DPTR MOVX @R0,A INC DPTR INC R0 DJNZ R2,CPY 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 PRE DATS: DB 0BH,41H,42H,43H DB 44H,45H,46H,00H DB 47H,48H,49H,00H DB 4AH,4BH,00H,00H DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 PRE: MOVX A,@R0 JZ PREND MOVX @DPTR,A INC DPTR MOV A,R0 JB ACC.7,PREND LCALL DPUSH CLR C RLC A MOV R0,A LCALL PRE LCALL DPOP SETB C RLC A MOV R0,A LCALL PRE PREND: 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