A2osX/BIN/ATLOGON.S.txt

561 lines
9.4 KiB
Plaintext
Raw Normal View History

NEW
2019-05-02 09:52:32 +00:00
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2020-08-04 07:10:48 +00:00
.TF bin/atlogon
*--------------------------------------
2020-08-04 07:10:48 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/appletalk.i
*--------------------------------------
2020-08-04 07:10:48 +00:00
.DUMMY
.OR ZPBIN
ZS.START
2020-08-06 20:01:14 +00:00
ZPAtlkParams .BS 2
2021-01-12 21:14:13 +00:00
hCmdBuf .BS 1
hReplyBuf .BS 1
ZPCmdBuf .BS 2
ZPReplyBuf .BS 2
2020-08-04 07:10:48 +00:00
ZPPTR1 .BS 2
ZPPTR2 .BS 2
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
2021-01-14 21:39:36 +00:00
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
2021-01-24 19:44:43 +00:00
.DA CS.DOEVENT
.DA CS.QUIT
2021-01-17 21:48:54 +00:00
L.MSG.USAGE .DA MSG.USAGE
L.MSG.NOATK .DA MSG.NOATK
2020-08-06 20:01:14 +00:00
L.MSG.ATKERR .DA MSG.ATKERR
2020-09-05 18:44:58 +00:00
L.MSG.GETINFO .DA MSG.GETINFO
2021-01-17 21:48:54 +00:00
L.MSG.NETNODPORT .DA MSG.NETNODPORT
L.MSG.NOTFOUND .DA MSG.NOTFOUND
2021-01-24 19:44:43 +00:00
L.MSG.SRVINFO1 .DA MSG.SRVINFO1
L.MSG.SRVINFO2 .DA MSG.SRVINFO2
L.MSG.PSTR .DA MSG.PSTR
L.FPLogin.Guest .DA FPLogin.Guest
L.FPLogin.Auth .DA FPLogin.Auth
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
2020-09-05 18:44:58 +00:00
CS.RUN ldy #S.PS.ARGC
2020-12-15 13:23:22 +00:00
lda (pPS),y
2020-09-05 18:44:58 +00:00
beq CS.RUN.USAGE
jsr CS.RUN.GetInfo
bcs .9
jsr CS.RUN.LookupName
bcs .9
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
jsr CS.RUN.GetParms
bcs .9
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
jsr CS.RUN.GetStatus
bcs .9
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
jsr CS.RUN.FILogin
bcs .9
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
lda #0
sec
.9 rts
*--------------------------------------
2020-08-06 20:01:14 +00:00
CS.RUN.USAGE >PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
2020-09-05 18:44:58 +00:00
2020-08-06 20:01:14 +00:00
lda #E.SYN
sec
rts
*--------------------------------------
2021-01-12 21:14:13 +00:00
CS.RUN.GetInfo >LEA.G P.GetInfo
ldx #AT.GetInfo
jsr CS.RUN.GOATLK
2020-09-05 18:44:58 +00:00
bcs .9
>PUSHW L.MSG.GETINFO
>PUSHB.G P.GetInfo+$08 THIS-NET
2021-01-17 21:48:54 +00:00
>PUSHB.G P.GetInfo+$09 THIS-NET
2020-09-05 18:44:58 +00:00
>PUSHB.G P.GetInfo+$0E NODE
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
>PUSHB.G P.GetInfo+$0A BRIDGE
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
>PUSHB.G P.GetInfo+$0C HARDWARE ID
2021-01-17 21:48:54 +00:00
>PUSHB.G P.GetInfo+$0D HARDWARE ID
2020-09-05 18:44:58 +00:00
>PUSHB.G P.GetInfo+$0B ROM VERSION
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
>PUSHBI 7
>SYSCALL PrintF
rts
2020-08-06 20:01:14 +00:00
2020-09-05 18:44:58 +00:00
.9 pha
>LDYA L.MSG.NOATK
>SYSCALL PutS
pla
sec
rts
*--------------------------------------
CS.RUN.LookupName
2020-08-06 20:01:14 +00:00
lda #1
>SYSCALL ArgV
2021-01-12 21:14:13 +00:00
>STYA ZPPTR1
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>LEA.G NameBuf
>STYA ZPPTR2
2020-08-06 20:01:14 +00:00
>STYA.G P.LookupName+$08
2021-01-12 21:14:13 +00:00
ldy #$ff
.1 iny
lda (ZPPTR1),y
bne .1
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
tya
tax
jsr CS.RUN.PutPtr2
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
.2 ldy #0
.3 lda (ZPPTR1),y
jsr CS.RUN.PutPtr2
iny
dex
bne .3
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
ldx #SEARCH.STRING.Len
ldy #0
.4 lda SEARCH.STRING,y
2021-01-12 21:14:13 +00:00
jsr CS.RUN.PutPtr2
2021-01-24 19:44:43 +00:00
iny
2021-01-17 21:48:54 +00:00
dex
bne .4
2021-01-24 19:44:43 +00:00
2020-08-06 20:01:14 +00:00
lda #4
>STA.G P.LookupName+$C RetInt
>STA.G P.LookupName+$D RetCnt
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
>LDYAI 5+99
2020-08-06 20:01:14 +00:00
>STYA.G P.LookupName+$10 BufLen
2021-01-12 21:14:13 +00:00
2021-01-17 21:48:54 +00:00
>LEA.G LookupBuf
2020-08-06 20:01:14 +00:00
>STYA.G P.LookupName+$12 BufPtr
2021-01-24 19:44:43 +00:00
2020-08-06 20:01:14 +00:00
lda #1
>STA.G P.LookupName+$16 MaxMatch
2021-01-24 19:44:43 +00:00
2020-08-06 20:01:14 +00:00
>LEA.G P.LookupName
2020-09-05 18:44:58 +00:00
ldx #AT.LookupName
2021-01-17 21:48:54 +00:00
jsr CS.RUN.GOATLK
bcs .9
>LDA.G P.LookupName+$17
beq .99
>PUSHW L.MSG.NETNODPORT
ldy #LookupBuf
ldx #4
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
.5 lda (pData),y
>PUSHA
iny
dex
bne .5
>PUSHBI 4
>SYSCALL PrintF
.9 rts
.99 >LDYA L.MSG.NOTFOUND
>SYSCALL PutS
lda #MLI.E.IO
sec
rts
2020-09-05 18:44:58 +00:00
*--------------------------------------
2021-01-12 21:14:13 +00:00
CS.RUN.GetParms >LEA.G P.GetParms
ldx #AT.GetParms
jsr CS.RUN.GOATLK
bcs .9
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>LDYA.G P.GetParms+$4
>SYSCALL GetMem
bcs .9
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>STYA ZPCmdBuf
stx hCmdBuf
>LDYA.G P.GetParms+$6
>SYSCALL GetMem
bcs .9
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>STYA ZPReplyBuf
stx hReplyBuf
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
.9 rts
*--------------------------------------
2021-01-17 21:48:54 +00:00
CS.RUN.GetStatus
2021-01-24 19:44:43 +00:00
>LEA.G LookupBuf
2021-01-17 21:48:54 +00:00
>STYA ZPPTR1
>LEA.G P.GetStatus+$8
>STYA ZPPTR2
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
ldy #3
2021-01-24 19:44:43 +00:00
.1 lda (ZPPTR1),y copy NETWORK/NODE/SOCKET
2021-01-17 21:48:54 +00:00
sta (ZPPTR2),y
dey
bpl .1
2021-01-24 19:44:43 +00:00
2021-01-17 21:48:54 +00:00
>LDYA.G P.GetParms+$6
>STYA.G P.GetStatus+$C Reply buffer length
>LDYA ZPReplyBuf
>STYA.G P.GetStatus+$E
>LEA.G P.GetStatus
ldx #AT.GetStatus
jsr CS.RUN.GOATLK
bcs .9
2021-01-24 19:44:43 +00:00
>PUSHW L.MSG.SRVINFO1
lda #10 Server Name
2021-01-17 21:48:54 +00:00
clc
adc ZPReplyBuf
tay
lda #0
adc ZPReplyBuf+1
>PUSHYA
2021-01-24 19:44:43 +00:00
ldy #1
lda (ZPReplyBuf),y Offset to Machine Type
clc
adc ZPReplyBuf
pha
lda (ZPReplyBuf)
adc ZPReplyBuf+1
ply
>PUSHYA
>PUSHBI 4
>SYSCALL PrintF
ldy #3 Offset to Version list
lda (ZPReplyBuf),y
clc
adc ZPReplyBuf
pha
dey
lda (ZPReplyBuf),y
adc ZPReplyBuf+1
ply
jsr CS.RUN.PrintListYA
>LDYA L.MSG.SRVINFO2
>SYSCALL PutS
ldy #5 Offset to UAM list
lda (ZPReplyBuf),y
clc
adc ZPReplyBuf
pha
dey
lda (ZPReplyBuf),y
adc ZPReplyBuf+1
ply
jsr CS.RUN.PrintListYA
clc
.9 rts
*--------------------------------------
CS.RUN.PrintListYA
>STYA ZPPTR1
lda (ZPPTR1)
beq .8
tax
inc ZPPTR1
bne .1
inc ZPPTR1+1
.1 phx
>PUSHW L.MSG.PSTR
>PUSHW ZPPTR1
2021-01-17 21:48:54 +00:00
>PUSHBI 2
>SYSCALL PrintF
2021-01-24 19:44:43 +00:00
plx
bcs .9
lda (ZPPTR1)
sec
adc ZPPTR1
sta ZPPTR1
bcc .2
inc ZPPTR1+1
.2 dex
bne .1
.8 clc
.9 rts
2021-01-17 21:48:54 +00:00
*--------------------------------------
2021-01-24 19:44:43 +00:00
CS.RUN.FILogin >LEA.G LookupBuf
2021-01-12 21:14:13 +00:00
>STYA ZPPTR1
>LEA.G P.FILogin+$4
2020-08-06 20:01:14 +00:00
>STYA ZPPTR2
2021-01-24 19:44:43 +00:00
2020-08-06 20:01:14 +00:00
ldy #3
2021-01-24 19:44:43 +00:00
.1 lda (ZPPTR1),y copy NETWORK/NODE/SOCKET
2020-08-06 20:01:14 +00:00
sta (ZPPTR2),y
dey
bpl .1
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>LDYA.G P.GetParms+$6
>STYA.G P.FILogin+$E Reply buffer length
2020-08-06 20:01:14 +00:00
2021-01-12 21:14:13 +00:00
>LDYA ZPReplyBuf
2020-08-06 20:01:14 +00:00
>STYA.G P.FILogin+$10
2021-01-24 19:44:43 +00:00
lda #2 USERNAME
>SYSCALL ArgV
bcc .2
>LDYAI FPLogin.Guest.Len
>STYA.G P.FILogin+$8 Cmd buffer length
>LDYA L.FPLogin.Guest
>STYA.G P.FILogin+$A
bra .80
*--------------------------------------
.2 >STYA ZPPTR1
ldx #FPLogin.Auth.Len
ldy #0
.3 lda FPLogin.Auth,y
sta (ZPCmdBuf),y
iny
dex
bne .3
phy
ldy #$ff
.4 iny
lda (ZPPTR1),y
bne .4
tya
tax
ply
sta (ZPCmdBuf),y USERNAME Len
iny
.5 jsr CS.RUN.GetPtr1
sta (ZPCmdBuf),y
iny
dex
bne .5
tya
lsr
bcc .6
lda #0
sta (ZPCmdBuf),y
iny
.6 phy
lda #3 PASSWORD
>SYSCALL ArgV
bcs .99
>STYA ZPPTR1
ldx #8
ply
.7 jsr CS.RUN.GetPtr1
beq .8
sta (ZPCmdBuf),y
iny
dex
bne .7
.8 txa
beq .10
lda #0
.9 sta (ZPCmdBuf),y
iny
dex
bne .9
.10 >STYA.G P.FILogin+$8 Cmd buffer length
>LDYA ZPCmdBuf
>STYA.G P.FILogin+$A
.80 >LEA.G P.FILogin
2020-09-05 18:44:58 +00:00
ldx #AT.FILogin
2021-01-24 19:44:43 +00:00
jsr CS.RUN.GOATLK
bcs .89
>LDA.G P.FILogin+$14
sta A2osX.ATLKSID
.89 rts
.99 ply
lda #E.SYN
sec
rts
2020-08-06 20:01:14 +00:00
*--------------------------------------
CS.RUN.GOATLK >STYA ZPAtlkParams
2020-09-05 18:44:58 +00:00
ldy #1
txa
sta (ZPAtlkParams),y
>LDYA ZPAtlkParams
2020-08-06 20:01:14 +00:00
jsr A2osX.ATKCALL
bcc .9
2020-08-04 07:10:48 +00:00
2020-08-06 20:01:14 +00:00
pha
2020-08-04 07:10:48 +00:00
2020-08-06 20:01:14 +00:00
>PUSHW L.MSG.ATKERR
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
ldy #1
lda (ZPAtlkParams),y
>PUSHA
2021-01-24 19:44:43 +00:00
2020-08-06 20:01:14 +00:00
ldy #3
lda (ZPAtlkParams),y
>PUSHA
dey
lda (ZPAtlkParams),y
>PUSHA
2021-01-24 19:44:43 +00:00
2020-09-05 18:44:58 +00:00
>PUSHBI 3
2020-08-25 14:54:30 +00:00
>SYSCALL PrintF
2020-08-04 07:10:48 +00:00
2020-08-06 20:01:14 +00:00
pla
sec
2021-01-24 19:44:43 +00:00
.9 rts
*--------------------------------------
CS.RUN.GetPtr1 lda (ZPPTR1)
beq .8
inc ZPPTR1
bne .8
inc ZPPTR1+1
.8 rts
*--------------------------------------
2021-01-12 21:14:13 +00:00
CS.RUN.PutPtr2 sta (ZPPTR2)
inc ZPPTR2
bne .8
2021-01-17 21:48:54 +00:00
2021-01-12 21:14:13 +00:00
inc ZPPTR2+1
2021-01-24 19:44:43 +00:00
.8 rts
2021-01-12 21:14:13 +00:00
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
2021-01-12 21:14:13 +00:00
CS.QUIT lda hReplyBuf
beq .1
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>SYSCALL FreeMem
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
.1 lda hCmdBuf
beq .2
2021-01-24 19:44:43 +00:00
2021-01-12 21:14:13 +00:00
>SYSCALL FreeMem
.2 clc
rts
*--------------------------------------
2021-01-24 19:44:43 +00:00
CS.END
MSG.USAGE .CZ "Usage : ATLOGON <SERVER> [USER] [PASSWORD]"
MSG.NOATK .CZ "AppleTalk Not Loaded."
MSG.ATKERR .CZ "AppleTalk Call %h, ERR:%H\r\n"
MSG.GETINFO .CS "Network/Node:%H/%h\r\n"
.CS "Bridge : %h\r\n"
.CZ "HWID/ROMVER :%H/%h\r\n"
MSG.NETNODPORT .CZ "Server Address : %H/%h:%h\r\n"
MSG.NOTFOUND .CZ "Server not found"
MSG.SRVINFO1 .CS "Server Name : %S\r\n"
.CS "Server Type : %S\r\n"
.CZ "AFP Dialects :\r\n"
MSG.SRVINFO2 .CZ "Supported UAMs :"
MSG.PSTR .CZ " %S\r\n"
SEARCH.STRING .PS "AFPServer"
.PS "*"
2021-01-17 21:48:54 +00:00
SEARCH.STRING.Len .EQ *-SEARCH.STRING
*--------------------------------------
2021-01-24 19:44:43 +00:00
FPLogin.Guest .DA #18
* .DA #0
.PS "AFPVersion 2.1"
.PS "No User Authent"
2021-01-24 19:44:43 +00:00
FPLogin.Guest.Len .EQ *-FPLogin.Guest
*--------------------------------------
FPLogin.Auth .DA #18
* .DA #0
.PS "AFPVersion 2.1"
.PS "Cleartxt Passwrd"
* .PS "username"
2021-01-24 19:44:43 +00:00
* .AS "password" 8 bytes, word aligned, 0 padded
FPLogin.Auth.Len .EQ *-FPLogin.Auth
*--------------------------------------
.DUMMY
.OR 0
2021-01-24 19:44:43 +00:00
DS.START
2020-08-04 07:10:48 +00:00
P.GetInfo .BS $0F
2021-01-24 19:44:43 +00:00
P.LookupName .BS $18
2021-01-12 21:14:13 +00:00
P.GetParms .BS $07
2021-01-17 21:48:54 +00:00
P.GetStatus .BS $14
2020-08-06 20:01:14 +00:00
P.FILogin .BS $19
2021-01-12 21:14:13 +00:00
NameBuf .BS 36
lookupBuf .BS 5+99
DS.END
.ED
*--------------------------------------
MAN
2020-08-04 07:10:48 +00:00
SAVE usr/src/bin/atlogon.s
ASM