A2osX/BIN/ATMOUNT.S.txt

356 lines
6.2 KiB
Plaintext
Raw Normal View History

2021-01-24 19:44:43 +00:00
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/atmount
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/appletalk.i
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPAtlkParams .BS 2
hCmdBuf .BS 1
hReplyBuf .BS 1
ZPCmdBuf .BS 2
ZPReplyBuf .BS 2
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
.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
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.NOATK .DA MSG.NOATK
L.MSG.NOSESSION .DA MSG.NOSESSION
L.MSG.ATKERR .DA MSG.ATKERR
L.MSG.GETINFO .DA MSG.GETINFO
L.MSG.VOLLIST .DA MSG.VOLLIST
L.MSG.VOL .DA MSG.VOL
L.MSG.MOUNTED .DA MSG.MOUNTED
L.FPGetSrvrParms .DA FPGetSrvrParms
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN jsr CS.RUN.GetInfo
bcs .9
lda A2osX.ATLKSID
bne .1
>LDYA L.MSG.NOSESSION
>SYSCALL PutS
lda #0
sec
rts
.1 jsr CS.RUN.GetParms
bcs .9
lda #1
>SYSCALL ArgV
bcc .2
jsr CS.RUN.ListVols
bcs .9
lda #0
sec
rts
.2 jsr CS.RUN.MountVol
bcs .9
lda #0
sec
.9 rts
*--------------------------------------
2022-11-02 06:54:30 +00:00
CS.RUN.USAGE >LDYA L.MSG.USAGE
>SYSCALL PutS
2021-01-24 19:44:43 +00:00
lda #E.SYN
sec
rts
*--------------------------------------
CS.RUN.GetInfo >LEA.G P.GetInfo
ldx #AT.GetInfo
jsr CS.RUN.GOATLK
bcs .9
>PUSHW L.MSG.GETINFO
>PUSHB.G P.GetInfo+$08 THIS-NET
>PUSHB.G P.GetInfo+$09 THIS-NET
>PUSHB.G P.GetInfo+$0E NODE
>PUSHB.G P.GetInfo+$0A BRIDGE
>PUSHB.G P.GetInfo+$0C HARDWARE ID
>PUSHB.G P.GetInfo+$0D HARDWARE ID
>PUSHB.G P.GetInfo+$0B ROM VERSION
>PUSHBI 7
>SYSCALL PrintF
rts
.9 pha
>LDYA L.MSG.NOATK
>SYSCALL PutS
pla
sec
rts
*--------------------------------------
CS.RUN.GetParms >LEA.G P.GetParms
ldx #AT.GetParms
jsr CS.RUN.GOATLK
bcs .9
>LDYA.G P.GetParms+$4
>SYSCALL GetMem
bcs .9
>STYA ZPCmdBuf
stx hCmdBuf
>LDYA.G P.GetParms+$6
>SYSCALL GetMem
bcs .9
>STYA ZPReplyBuf
stx hReplyBuf
.9 rts
*--------------------------------------
CS.RUN.ListVols lda A2osX.ATLKSID
>STA.G P.Command+$08 Session Ref
>LDYAI FPGetSrvrParms.Len
>STYA.G P.Command+$09
>LDYA L.FPGetSrvrParms
>STYA.G P.Command+$0B
>LDYA.G P.GetParms+$6 Reply Size
>STYA.G P.Command+$0F
>LDYA ZPReplyBuf
>STYA.G P.Command+$11
>LEA.G P.Command
ldx #AT.Command
jsr CS.RUN.GOATLK
bcs .9
>LDYA L.MSG.VOLLIST
>SYSCALL PutS
2021-01-24 19:44:43 +00:00
lda ZPReplyBuf
clc
adc #4
tay
lda ZPReplyBuf+1
adc #0
jsr CS.RUN.PrintListYA
.9 rts
*--------------------------------------
CS.RUN.PrintListYA
>STYA ZPPTR1
lda (ZPPTR1)
beq .8
tax
inc ZPPTR1
bne .1
inc ZPPTR1+1
.1 phx
>PUSHW L.MSG.VOL
>PUSHB (ZPPTR1)
inc ZPPTR1
bne .10
inc ZPPTR1+1
.10 >PUSHW ZPPTR1
>PUSHBI 3
>SYSCALL PrintF
plx
bcs .9
lda (ZPPTR1)
sec
adc ZPPTR1
sta ZPPTR1
bcc .2
inc ZPPTR1+1
.2 dex
bne .1
.8 clc
.9 rts
*--------------------------------------
CS.RUN.MountVol >STYA ZPPTR1
>LEA.G VolName
>STYA ZPPTR2
ldy #$ff
.1 iny
lda (ZPPTR1),y
bne .1
tya
tax
sta (ZPPTR2)
ldy #0
.2 lda (ZPPTR1),y
iny
sta (ZPPTR2),y
dex
bne .2
lda A2osX.ATLKSID
>STA.G P.MountVol+$04 Session Ref
lda #128
>STA.G P.MountVol+$05 Mount Flag
>LEA.G VolName
>STYA.G P.MountVol+$06
>LEA.G P.MountVol
ldx #AT.FIMountVol
jsr CS.RUN.GOATLK
bcs .9
>PUSHW L.MSG.MOUNTED
>PUSHW ZPPTR2
>LDA.G P.MountVol+$0C
asl
php
lsr
lsr
lsr
lsr
lsr
>PUSHA
plp
lda #0
rol
inc
>PUSHA
>PUSHBI 4
>SYSCALL PrintF
.9 rts
*--------------------------------------
CS.RUN.GOATLK >STYA ZPAtlkParams
ldy #1
txa
sta (ZPAtlkParams),y
>LDYA ZPAtlkParams
jsr A2osX.ATKCALL
bcc .9
pha
>PUSHW L.MSG.ATKERR
ldy #1
lda (ZPAtlkParams),y
>PUSHA
ldy #3
lda (ZPAtlkParams),y
>PUSHA
dey
lda (ZPAtlkParams),y
>PUSHA
>PUSHBI 3
>SYSCALL PrintF
pla
sec
.9 rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT lda hReplyBuf
beq .1
>SYSCALL FreeMem
.1 lda hCmdBuf
beq .2
>SYSCALL FreeMem
.2 clc
rts
*--------------------------------------
CS.END
2022-11-02 06:54:30 +00:00
MSG.USAGE .CZ "Usage : ATMOUNT [VOLUME]"
MSG.NOATK .CZ "AppleTalk Not Loaded."
MSG.NOSESSION .CZ "No Active AppleTalk Session."
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.VOLLIST .CZ "Flags Volume Name"
MSG.VOL .CZ "%b %S\r\n"
MSG.MOUNTED .CZ "Volume %S Mounted as s%dd%d\r\n"
2021-01-24 19:44:43 +00:00
*--------------------------------------
FPGetSrvrParms .DA #16
FPGetSrvrParms.Len .EQ *-FPGetSrvrParms
*--------------------------------------
.DUMMY
.OR 0
DS.START
P.GetInfo .BS $0F
P.GetParms .BS $07
P.Command .BS $1B
P.MountVol .BS $11
VolName .BS 28
DS.END
.ED
*--------------------------------------
MAN
SAVE usr/src/bin/atmount.s
ASM