; PUTREE - Output symbol tree in alphabetical order ; Mike Gabrielson 8/10/78 ; accepts: HL = contents of ROOT pointer (must not be grounded) ; ============================================================= entry putree extrn putnam ; This is an external routine not ; Defined in this assembly. PUTNAM ; Outputs the ASCII string addressed ; By HL (which must be saved) and ; Terminated by NUL. putree: push de ; Save pointer to the pointer when reentered push hl ; Save address of node ld d,(hl) ; Get pointer to left subtree into DE inc hl ld e,(hl) inc hl ex de,hl ; Then into HL ld a,h ; No left subtree? or l ; (pointer grounded?) call nz,putree ; Subtree exists, traverse it now ex de,hl ; Restore address of original node to HL inc hl ; Skip right subtree pointer inc hl ; And get address of symbol narae call putnam ; Output the ASCII string dec hl ; Get node's right subtree pointer into DE ld e,(hl) dec hl ld d,(hl) ex de,hl ; Then into HL ld a,h ; No right subtree? or l ; (pointer grounded?) call nz,putree ; Subtree exists, traverse it now pop hl ; Restore stack pop de ret end