NEW
  AUTO 3,1
				.LIST OFF
				.OP	65C02
				.OR	$2000
				.TF BIN/ATBROWSE
*--------------------------------------
				.INB INC/MACROS.I
				.INB INC/A2OSX.I
				.INB INC/MLI.I
				.INB INC/MLI.E.I
				.INB INC/APPLETALK.I
*--------------------------------------
ZPPTR1			.EQ ZPBIN
ZPPTR2			.EQ ZPBIN+2
*--------------------------------------
*			File Header (16 Bytes)
*--------------------------------------
CS.START		cld
				jmp (.1,x)
				.DA #$61				6502,Level 1 (65c02)
				.DA #1					BIN Layout Version 1
				.DA 0
				.DA CS.END-CS.START		CS
				.DA DS.END-DS.START		DS
				.DA #16					SS
				.DA #4					ZP
				.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------				
.1				.DA CS.INIT
				.DA CS.RUN
				.DA CS.DOEVENT		
				.DA	CS.QUIT
L.MSG.NOATK		.DA MSG.NOATK
L.MSG.NETNODE	.DA MSG.NETNODE
L.SEARCH.STRING	.DA SEARCH.STRING
L.MSG.DUMP0		.DA MSG.DUMP0
L.MSG.DUMP		.DA MSG.DUMP
				.DA 0
*--------------------------------------
CS.INIT			clc
				rts
*--------------------------------------
CS.RUN			>STZ.G P.GetInfo		Sync
				lda #ATGetInfo
				>STA.G P.GetInfo+1
				
				jsr A2osX.ATKCALL
				bcc .10
				
				pha
				>LDYA L.MSG.NOATK
				>SYSCALL printf
				pla
				sec
.99				rts				
				
.10				>LDA.G P.GetInfo+$E		NODE
				>PUSHA
				>PUSHW.G P.GetInfo+$8	NET
				>LDYA L.MSG.NETNODE
				>SYSCALL printf

				>STZ.G P.LookupName		Sync
				lda #ATLookupName
				>STA.G P.LookupName+1
				
				>LDYA L.SEARCH.STRING
				>STYA.G P.LookupName+$08	Entry Name Ptr

				lda #4
				>STA.G P.LookupName+$C	RetInt
				>STA.G P.LookupName+$D	RetCnt
				
				>LDYAI 1024
				>STYA.G P.LookupName+$10	BufLen
				
				>SYSCALL getmem
				bcs .99
				
				>STYA.G P.LookupName+$12	BufPtr
				
				>STYA ZPPTR1
				
				txa
				>STA.G hBuf
				
				lda #16
				>STA.G P.LookupName+$16		MaxMatch
				
				jsr A2osX.ATKCALL
				bcs .99
				
				>LDA.G P.LookupName+$17
				beq .8
				
				>LDYA L.MSG.DUMP0
				>SYSCALL printf
				bcs .9
				
.1				lda ZPPTR1
				clc
				adc #5
				sta ZPPTR2
				lda ZPPTR1+1
				adc #0
				sta ZPPTR2+2
				
				>PUSHW ZPPTR2
	
				ldy #4
				
.2				>PUSHB (ZPPTR1),y
				dey
				bpl .2
				
				>LDYA L.MSG.DUMP
				>SYSCALL printf
				bcs .9
				
				lda ZPPTR2
				sec
				adc (ZPPTR2)
				sta ZPPTR1
				lda ZPPTR2+1
				adc #0
				sta ZPPTR1+1
				
				>DEC.G P.LookupName+$17
				bne .2
				
				lda #0
.8				sec
.9				rts
*--------------------------------------
CS.DOEVENT		sec
				rts
*--------------------------------------
CS.QUIT			>LDA.G hBuf
				beq .8
				>SYSCALL FreeMem

.8				clc
				rts
*--------------------------------------
CS.END			
MSG.NOATK		.AZ "AppleTalk Not Loaded.\r\n"
MSG.NETNODE		.AZ "Network/Node:$%H/$%h\r\n"
SEARCH.STRING	>PSTR "*:*@*"
MSG.DUMP0		.AZ "Net   Nod SkT En# Name\r\n"
MSG.DUMP		.AZ "%H $%h $%h $%h %S\r\n"
*--------------------------------------
				.DUMMY
				.OR 0
DS.START
P.GetInfo		.BS $0F
P.LookupName	.BS $17
hBuf			.BS 1
DS.END
				.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/BIN/ATBROWSE.S
ASM
