NET EQU 20H
LEN EQU 0E0H
POINT EQU 0F0H
N DATA 3EH
K DATA 3FH
TST:
MOV SP,#5FH
MOV DPTR,#NETDAT
MOV P2,#NET
MOV R0,#0
MOV R2,#80H
CPY:
CLR A
MOVC A,@A+DPTR
MOVX @R0,A
INC DPTR
INC R0
DJNZ R2,CPY
MOV DPH,#NET
MOV DPL,#0
MOVX A,@DPTR
INC A
MOV N,A
MOV K,#1
TEST1:
LCALL MINTREE
INC K
MOV A,K
CJNE A,N,TEST1
STOP: LJMP STOP
MINTREE:
OV DPH,#NET
MOV DPL,#0
MOVX A,@DPTR
MOV R7,A
MOV R6,A
CLEAR:
MOV A,DPL
ADD A,#10H
MOV DPL,A
CLR A
MOVX @DPTR,A
DJNZ R6,CLEAR
MOV P2,#NET
MOV A,K
MOV R2,A
SWAP A
MOV R1,A
MOV A,#1
MOVX @R1,A
MOV R0,#LEN
MOV A,R7
MOV R6,A
MINTR:
INC R1
INC R0
MOVX A,@R1
MOVX @R0,A
DJNZ R6,MINT
MOV R0,#POINT
MOV A,R7
MOV R6,A
MOV A,R2
MINTR1:
INC R0
MOVX @R0,A
DJNZ R6,MINTR1
MOV A,R2
ADD A,#POINT
MOV R0,A
MOV A,#0
MOVX @R0,A
MOV A,R7
DEC A
MOV R3,A
MINTR2:
OV R4,#0FFH
MOV R5,#0
MOV R0,#LEN+1
MOV R1,#10H
MOV A,R7
MOV R6,A
MINTR3:
MOVX A,@R1
JNZ MINTR4
MOVX A,@R0
CLR C
SUBB A,R4
JNC MINTR4
MOVX A,@R0
MOV R4,A
MOV A,R0
ANL A,#0FH
MOV R5,A
MINTR4:
INC R0
MOV A,R1
ADD A,#10H
MOV R1,A
DJNZ R6,MINTR3
MOV A,R5
SWAP A
MOV R0,A
MOV A,#1
MOVX @R0,A
INC R0
MOV DPL,#LEN+1
MOV R1,#10H
MOV A,R7
MOV R6,A
MINTR6:
MOVX A,@R1
JNZ MINTR7
MOVX A,@R0
MOV R2,A
MOVX A,@DPTR
SETB C
SUBB A,R2
JC MINTR7
MOV A,R2
MOVX @DPTR,A
MOV A,R0
MOV R2,A
ANL A,#0FH
ADD A,#POINT
MOV R0,A
MOV A,R5
MOVX @R0,A ;
MOV A,R2
MOV R0,A
MINTR7:
INC R0
INC DPTR ;
MOV A,R1 ;
ADD A,#10H
MOV R1,A
DJNZ R6,MINTR6
;2010H: 00 00 04 07 06 FF FF FF
;2020H: 00 04 00 FF 09 08 FF FF
;2030H: 00 07 FF 00 08 FF 05 FF
;2040H: 00 06 09 08 00 05 03 04
;2050H: 00 FF 08 FF 05 00 FF 02
;2060H: 00 FF FF 05 03 FF 00 09
;2070H: 00 FF FF FF 04 02 09 00
;20E0H: 00 00 00 00 00 00 00 00
;20F0H: 00 00 00 00 00 00 00 00
NETDAT:
DB 07H,41H,42H,43H
DB 44H,45H,46H,47H
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,00H,04H,07H
DB 06H,0FFH,0FFH,0FFH
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,04H,00H,0FFH
DB 09H,08H,0FFH,0FFH
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,07H,0FFH,00H
DB 08H,0FFH,05H,0FFH
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,06H,09H,08H
DB 00H,05H,03H,04H
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,0FFH,08H,0FFH
DB 05H,00H,0FFH,02H
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,0FFH,0FFH,05H
DB 03H,0FFH,00H,09H
DB 00H,00H,00H,00H
DB 00H,00H,00H,00H
DB 00H,0FFH,0FFH,0FFH
DB 04H,02H,09H,00H
END