mirror of
https://github.com/A2osX/A2osX.git
synced 2025-03-24 09:33:48 +00:00
Kernel 0.94
This commit is contained in:
parent
5c84f81898
commit
ea7bbc3731
Binary file not shown.
@ -3,7 +3,8 @@ NEW
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/httpget
|
||||
* .TF bin/httpget
|
||||
.TF root/httpget
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
@ -13,8 +14,7 @@ NEW
|
||||
.INB inc/libtcpip.i
|
||||
.INB inc/net.http.i
|
||||
*--------------------------------------
|
||||
RESP.BUFSIZE .EQ 1024
|
||||
TIMEOUT.MAX .EQ 50 5 sec.
|
||||
TIMEOUT.MAX .EQ 200 20 sec.
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
@ -29,7 +29,21 @@ ZPEncodedBufPtr .BS 2
|
||||
ZPEncodedBufLen .BS 2
|
||||
ZPRespBufPtr .BS 2
|
||||
|
||||
ArgIndex .BS 1
|
||||
hSocket .BS 1
|
||||
hReqBuf .BS 1
|
||||
hEncodedBuf .BS 1
|
||||
|
||||
hSendBuf .BS 1
|
||||
ZPSendBufPtr .BS 2
|
||||
|
||||
ZPFileName .BS 2
|
||||
|
||||
hRespBuf .BS 1
|
||||
bResponse .BS 1
|
||||
TimeOut .BS 1
|
||||
bURI .BS 1
|
||||
|
||||
ZS.END .ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
@ -62,9 +76,7 @@ L.MSG.SKTKO .DA MSG.SKTKO
|
||||
L.MSG.CONNECTED .DA MSG.CONNECTED
|
||||
L.MSG.SKTERR .DA MSG.SKTERR
|
||||
L.MSG.IOERR .DA MSG.IOERR
|
||||
L.HTTP.GET1 .DA HTTP.GET1
|
||||
L.HTTP.GET2 .DA HTTP.GET2
|
||||
L.HTTP.GET3 .DA HTTP.GET3
|
||||
L.HTTP.GET .DA HTTP.GET
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.LIBTCPIP
|
||||
@ -78,6 +90,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
||||
>STYA ZPIPCfgPtr
|
||||
lda (ZPIPCfgPtr) Configured ?
|
||||
bmi CS.RUN.IPOK
|
||||
|
||||
>LDYA L.MSG.IPKO
|
||||
>SYSCALL PutS
|
||||
lda #E.SYN
|
||||
@ -93,7 +106,8 @@ CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>INC.G ArgIndex
|
||||
inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .9
|
||||
|
||||
@ -105,8 +119,9 @@ CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
|
||||
bcc CS.RUN.HOSTOK
|
||||
>SLEEP
|
||||
jsr Wait.TimeOut
|
||||
bcc .2
|
||||
|
||||
lda TimeOut
|
||||
bne .2
|
||||
|
||||
>PUSHW L.MSG.UNKNOWN
|
||||
>PUSHW ZPHostPtr
|
||||
@ -122,7 +137,8 @@ CS.RUN.ESYN lda #E.SYN
|
||||
sec
|
||||
CS.RUN.RTS rts
|
||||
|
||||
CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
CS.RUN.HOSTOK inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcc .10
|
||||
|
||||
@ -138,7 +154,8 @@ CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
bcs CS.RUN.RTS
|
||||
|
||||
>STYA SA.REMOTE+S.SOCKADDR.PORT
|
||||
>INC.G ArgIndex
|
||||
inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .8
|
||||
|
||||
@ -159,7 +176,8 @@ CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
.11 cmp #'U'
|
||||
bne .2
|
||||
|
||||
>INC.G ArgIndex
|
||||
inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
|
||||
.9 bcs CS.RUN.ESYN
|
||||
@ -170,8 +188,10 @@ CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
.8 bra CS.RUN.PORTOK
|
||||
|
||||
.2 cmp #'F'
|
||||
bne CS.RUN.ESYN
|
||||
>INC.G ArgIndex
|
||||
bne .3
|
||||
|
||||
inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .9
|
||||
|
||||
@ -183,11 +203,24 @@ CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
bcs .9
|
||||
|
||||
>STYA ZPReqBufLen
|
||||
txa
|
||||
>STA.G hReqBuf
|
||||
stx hReqBuf
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPReqBufPtr
|
||||
|
||||
sec
|
||||
ror bURI
|
||||
bra CS.RUN.PORTOK
|
||||
|
||||
.3 cmp #'O'
|
||||
bcs .9
|
||||
|
||||
inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .9
|
||||
|
||||
>STYA ZPFileName
|
||||
|
||||
CS.RUN.PORTOK >PUSHW L.MSG.CONNECT
|
||||
ldx #0
|
||||
|
||||
@ -203,7 +236,7 @@ CS.RUN.PORTOK >PUSHW L.MSG.CONNECT
|
||||
>SYSCALL PrintF
|
||||
|
||||
CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
lda #S.SOCKET.T.STREAM
|
||||
lda #S.SOCKET.T.SEQPKT
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
||||
bcs .9
|
||||
|
||||
@ -233,37 +266,26 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
cmp #ERR.SKT.NOCONN
|
||||
bne .9
|
||||
|
||||
jsr Wait.TimeOut
|
||||
bcc .2
|
||||
lda TimeOut
|
||||
bne .2
|
||||
|
||||
lda #ERR.SKT.NOCONN
|
||||
bra .9
|
||||
|
||||
.3 >LDYA L.MSG.CONNECTED
|
||||
>SYSCALL PutS
|
||||
|
||||
>LDYAI RESP.BUFSIZE
|
||||
>SYSCALL GetMem
|
||||
bcs .99
|
||||
|
||||
>STYA ZPRespBufPtr
|
||||
txa
|
||||
>STA.G hRespBuf
|
||||
|
||||
>SLEEP
|
||||
|
||||
CS.RUN.GET jsr CS.RUN.ENCODE
|
||||
bcs .99
|
||||
* >PUSHW ZPEncodedBufLen
|
||||
* >PUSHW ZPEncodedBufPtr
|
||||
* ldy #S.PS.hStdOut
|
||||
* lda (pPS),y
|
||||
* >SYSCALL FWrite
|
||||
|
||||
jsr CS.RUN.REQUEST
|
||||
bcs .99
|
||||
|
||||
jsr CS.RUN.RESPONSE
|
||||
bcs .99
|
||||
|
||||
.9 lda #0
|
||||
sec
|
||||
.99 rts
|
||||
@ -290,8 +312,6 @@ CS.RUN.IOERR pha
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.CONNECT
|
||||
*--------------------------------------
|
||||
CS.RUN.ENCODE >LDYA ZPReqBufPtr
|
||||
>STYA ZPPtr
|
||||
|
||||
@ -300,47 +320,62 @@ CS.RUN.ENCODE >LDYA ZPReqBufPtr
|
||||
|
||||
inc ZPEncodedBufLen
|
||||
bne .1
|
||||
|
||||
inc ZPEncodedBufLen+1
|
||||
|
||||
.1 inc ZPPtr
|
||||
bne .11
|
||||
|
||||
inc ZPPtr+1
|
||||
|
||||
.11 jsr CS.RUN.TOENCODE
|
||||
bcc .10
|
||||
|
||||
.3 lda ZPEncodedBufLen
|
||||
clc
|
||||
adc #2
|
||||
sta ZPEncodedBufLen
|
||||
bcc .10
|
||||
|
||||
inc ZPEncodedBufLen+1
|
||||
bra .10
|
||||
|
||||
.4 >LDYA ZPEncodedBufLen
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPEncodedBufPtr
|
||||
>STYA ZPPtr
|
||||
txa
|
||||
>STA.G hEncodedBuf
|
||||
stx hEncodedBuf
|
||||
|
||||
.5 lda (ZPReqBufPtr)
|
||||
beq .8
|
||||
|
||||
inc ZPReqBufPtr
|
||||
bne .6
|
||||
|
||||
inc ZPReqBufPtr+1
|
||||
|
||||
.6 jsr CS.RUN.TOENCODE
|
||||
bcc .7
|
||||
|
||||
jsr CS.RUN.ADDBYTETOBUF
|
||||
bra .5
|
||||
|
||||
.7 jsr CS.RUN.ADDTOBUF
|
||||
bra .5
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.TOENCODE ldx #URI.ToEncode.Cnt-1
|
||||
|
||||
.1 cmp URI.ToEncode,x
|
||||
beq .9 CS
|
||||
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -357,14 +392,18 @@ CS.RUN.ADDBYTETOBUF
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc .1
|
||||
|
||||
adc #6
|
||||
|
||||
.1 jsr CS.RUN.ADDTOBUF
|
||||
pla
|
||||
and #$0F
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc CS.RUN.ADDTOBUF
|
||||
|
||||
adc #6
|
||||
|
||||
*--------------------------------------
|
||||
CS.RUN.ADDTOBUF sta (ZPPtr)
|
||||
inc ZPPtr
|
||||
@ -374,69 +413,67 @@ CS.RUN.ADDTOBUF sta (ZPPtr)
|
||||
*--------------------------------------
|
||||
CS.RUN.REQUEST jsr Init.TimeOut
|
||||
|
||||
>PUSHWI HTTP.GET1.LEN
|
||||
>PUSHW L.HTTP.GET1
|
||||
jsr .8
|
||||
bcs .99
|
||||
|
||||
>PUSHW ZPEncodedBufLen
|
||||
>PUSHW ZPEncodedBufPtr
|
||||
jsr .8
|
||||
>LDYAI 1024
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>PUSHWI HTTP.GET2.LEN
|
||||
>PUSHW L.HTTP.GET2
|
||||
jsr .8
|
||||
.99 bcs .9
|
||||
|
||||
>LDYA ZPHostPtr
|
||||
>SYSCALL StrLen
|
||||
>STYA ZPSendBufPtr
|
||||
stx hSendBuf
|
||||
|
||||
>PUSHYA
|
||||
>PUSHW HTTP.GET
|
||||
>PUSHW ZPEncodedBufPtr
|
||||
>PUSHW ZPHostPtr
|
||||
jsr .8
|
||||
bcs .9
|
||||
|
||||
>PUSHWI HTTP.GET3.LEN
|
||||
>PUSHW L.HTTP.GET3
|
||||
|
||||
.8 lda #'!'
|
||||
>SYSCALL PutChar
|
||||
>PUSHBI 4
|
||||
|
||||
>SYSCALL SPrintF
|
||||
bcs .90
|
||||
|
||||
>PUSHYA
|
||||
>PUSHW ZPSendBufPtr
|
||||
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Write
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
||||
|
||||
.90 php
|
||||
pha
|
||||
lda hSendBuf
|
||||
>SYSCALL FreeMem
|
||||
pla
|
||||
plp
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.RESPONSE jsr Init.TimeOut
|
||||
|
||||
.1 >SLEEP
|
||||
>PUSHWI RESP.BUFSIZE
|
||||
>PUSHW ZPRespBufPtr
|
||||
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
||||
bcc .2
|
||||
|
||||
cmp #E.NODATA
|
||||
bne .8
|
||||
|
||||
jsr Wait.TimeOut
|
||||
bcs .80
|
||||
lda TimeOut
|
||||
bne .80
|
||||
bra .1
|
||||
|
||||
.2 >PUSHYA len
|
||||
.2 >SYSCALL GetMemPtr
|
||||
>STYA ZPRespBufPtr
|
||||
|
||||
>PUSHW ZPRespBufPtr
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPS),y
|
||||
>SYSCALL FWrite
|
||||
bcs .9
|
||||
|
||||
>INC.G bResponse
|
||||
inc bResponse
|
||||
bra .1
|
||||
|
||||
.8 cmp #MLI.E.IO SKT Close ?
|
||||
bne .9
|
||||
|
||||
.80 >LDA.G bResponse
|
||||
.80 lda bResponse
|
||||
beq .99
|
||||
|
||||
.81 clc
|
||||
@ -448,10 +485,12 @@ CS.RUN.RESPONSE jsr Init.TimeOut
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .9 is it a TIMER event?
|
||||
>LDA.G TimeOut
|
||||
|
||||
lda TimeOut
|
||||
beq .9
|
||||
dec
|
||||
sta (pData),y
|
||||
|
||||
dec TimeOut
|
||||
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -459,39 +498,40 @@ CS.QUIT lda hSocket
|
||||
beq .1
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
||||
.1 >LDA.G hReqBuf
|
||||
.1 lda hReqBuf
|
||||
beq .2
|
||||
|
||||
>SYSCALL FreeMem
|
||||
.2 >LDA.G hEncodedBuf
|
||||
|
||||
.2 lda hEncodedBuf
|
||||
beq .3
|
||||
|
||||
>SYSCALL FreeMem
|
||||
.3 >LDA.G hRespBuf
|
||||
|
||||
.3 lda hRespBuf
|
||||
beq .4
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.4 lda hLIBTCPIP
|
||||
beq .8
|
||||
|
||||
>SYSCALL UnloadLib
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
Init.TimeOut lda #TIMEOUT.MAX
|
||||
>STA.G TimeOut
|
||||
sta TimeOut
|
||||
rts
|
||||
*--------------------------------------
|
||||
Wait.TimeOut sec
|
||||
>LDA.G TimeOut
|
||||
beq .9
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
LIBTCPIP .AZ "libtcpip"
|
||||
hLIBTCPIP .BS 1
|
||||
MSG.IPKO .AZ "TCP/IP Not Loaded/Configured."
|
||||
MSG.USAGE .AS "Usage : HTTPGET <ip|host> [port]\r\n"
|
||||
.AS " -U Url\r\n"
|
||||
.AZ " -F UrlFile\r\n"
|
||||
.AS " -F UrlFile\r\n"
|
||||
.AZ " -O OutputFile\r\n"
|
||||
MSG.UNKNOWN .AZ "%s: Unknown host\r\n"
|
||||
MSG.CONNECT .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
|
||||
MSG.SKTKO .AZ "Failed to Open Socket."
|
||||
@ -513,31 +553,21 @@ URI.ToEncode .DA #C.LF,#C.CR,#C.SPACE,#'"'
|
||||
.AS "%-.\^_`{|}~"
|
||||
URI.ToEncode.Cnt .EQ *-URI.ToEncode
|
||||
*--------------------------------------
|
||||
HTTP.GET1 .AS "GET /"
|
||||
HTTP.GET1.LEN .EQ *-HTTP.GET1
|
||||
HTTP.GET2 .AS " HTTP/1.1"
|
||||
HTTP.GET .AS "GET /%s HTTP/1.1"
|
||||
.DA #C.CR,#C.LF
|
||||
.AS "User-Agent: A2osX.HTTPGET"
|
||||
.DA #C.CR,#C.LF
|
||||
.AS "Host: "
|
||||
HTTP.GET2.LEN .EQ *-HTTP.GET2
|
||||
HTTP.GET3 .DA #C.CR,#C.LF
|
||||
.AS "Host: %s"
|
||||
.DA #C.CR,#C.LF
|
||||
.AS "Connection: close"
|
||||
.DA #C.CR,#C.LF
|
||||
.DA #C.CR,#C.LF
|
||||
HTTP.GET3.LEN .EQ *-HTTP.GET3
|
||||
HTTP.GET.LEN .EQ *-HTTP.GET
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
ArgIndex .BS 1
|
||||
hReqBuf .BS 1
|
||||
hEncodedBuf .BS 1
|
||||
hRespBuf .BS 1
|
||||
bResponse .BS 1
|
||||
TimeOut .BS 1
|
||||
DS.END
|
||||
.ED
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/httpget.s
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
|
@ -1,10 +1,9 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF sys/km/km.nsc
|
||||
.TF sys/km.nsc
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/io.i
|
||||
|
517
SYS/KM.VEDRIVE.S.txt
Normal file
517
SYS/KM.VEDRIVE.S.txt
Normal file
@ -0,0 +1,517 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF sys/km.vedrive
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/io.i
|
||||
.INB inc/monitor.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/mli.e.i
|
||||
*--------------------------------------
|
||||
TmpPtr1 .EQ $0
|
||||
ADT.CMD.VSD .EQ $C5 "E": Virtual Drive Command Envelope
|
||||
ADT.CMD.PING .EQ $D9 "Y": PING
|
||||
DRV.EntryPoint .EQ $BF41
|
||||
*--------------------------------------
|
||||
VSDRIVE.Init >LDYAI VSDRIVE.MSG0
|
||||
jsr PrintFYA
|
||||
|
||||
jsr VSDRIVE.Check
|
||||
bcs .90
|
||||
|
||||
.1 lda #$C1 Self Modified
|
||||
|
||||
.2 jsr SSC.Detect
|
||||
bcs .99
|
||||
|
||||
stx DRV+2 DRV.Slotn0
|
||||
|
||||
sta .1+1 Slot Cn
|
||||
and #$0F
|
||||
pha slot n
|
||||
>LDYAI VSDRIVE.SSCOK
|
||||
jsr PrintFYA
|
||||
|
||||
jsr VSDRIVE.Ping
|
||||
|
||||
bcs .92
|
||||
|
||||
>LDYAI VSDRIVE.SRVOK
|
||||
jsr PrintFYA
|
||||
|
||||
jsr VSDRIVE.SetSlot
|
||||
bcs .91
|
||||
pha Push slot
|
||||
pha 2 times
|
||||
>LDYAI VSDRIVE.DEVOK
|
||||
jsr PrintFYA
|
||||
|
||||
jsr VSDRIVE.Install
|
||||
>LDYAI VSDRIVE.OK
|
||||
jsr PrintFYA
|
||||
rts
|
||||
.90 >LDYAI VSDRIVE.DRVKO
|
||||
jsr PrintFYA
|
||||
rts
|
||||
.91 >LDYAI VSDRIVE.NOSLOT
|
||||
jsr PrintFYA
|
||||
rts
|
||||
.92 pha Push EC
|
||||
>LDYAI VSDRIVE.SRVKO
|
||||
jsr PrintFYA
|
||||
inc .1+1
|
||||
lda .1+1
|
||||
cmp #$C8
|
||||
bne .2 Go try next SSC....
|
||||
|
||||
.99 >LDYAI VSDRIVE.SSCKO
|
||||
jsr PrintFYA
|
||||
rts
|
||||
*--------------------------------------
|
||||
VSDRIVE.Check bit RRAMWRAMBNK2
|
||||
bit RRAMWRAMBNK2
|
||||
|
||||
clc
|
||||
lda $D001
|
||||
eor DRV
|
||||
bne .8
|
||||
lda $D002
|
||||
eor DRV+1
|
||||
bne .8
|
||||
sec
|
||||
.8 bit RROMBNK1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SSC.Detect stz TmpPtr1
|
||||
sta TmpPtr1+1
|
||||
.1 ldx #DEVSIG.Value-DEVSIG.Offset-1
|
||||
|
||||
.2 ldy DEVSIG.Offset,x
|
||||
lda (TmpPtr1),y
|
||||
cmp DEVSIG.Value,x
|
||||
bne .3
|
||||
dex
|
||||
bpl .2
|
||||
lda TmpPtr1+1 A=SlotCN
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
tax X=SlotN0
|
||||
stz SSC.RESET,x
|
||||
jsr VSDRIVE.Wait
|
||||
lda #SSC.CTL.CLKINT+SSC.CTL.B115200+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
||||
sta SSC.CTL,x
|
||||
jsr VSDRIVE.Wait
|
||||
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
||||
sta SSC.CMD,x
|
||||
jsr VSDRIVE.Wait
|
||||
|
||||
lda TmpPtr1+1 A=Slot Cn, X=n0
|
||||
|
||||
clc
|
||||
rts X=SlotN0, A=SlotCN
|
||||
.3 inc TmpPtr1+1 no match, try next slot....
|
||||
lda TmpPtr1+1
|
||||
cmp #$C8
|
||||
bne .1
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
VSDRIVE.Ping ldx DRV+2 DRV.Slotn0
|
||||
|
||||
stz VSDRIVE.Ping.TO
|
||||
stz VSDRIVE.Ping.TO+1
|
||||
|
||||
.10 jsr VSDRIVE.IncTimer Wait.......
|
||||
bne .10
|
||||
ldy #10
|
||||
.1 lda SSC.STATUS,x
|
||||
and #SSC.STATUS.TDRE Ready for transmit?
|
||||
bne .20
|
||||
|
||||
jsr VSDRIVE.IncTimer Wait.......
|
||||
bne .1
|
||||
dey
|
||||
bne .1
|
||||
lda #1
|
||||
sec
|
||||
rts Time Out.....
|
||||
.20 stz VSDRIVE.Ping.TO
|
||||
stz VSDRIVE.Ping.TO+1
|
||||
|
||||
ldy #5 5 bytes to send
|
||||
|
||||
.2 lda VSDRIVE.CMDS-1,y
|
||||
sta SSC.DATA,x
|
||||
.3 lda SSC.STATUS,x
|
||||
and #SSC.STATUS.TDRE char transmitted?
|
||||
bne .4
|
||||
|
||||
jsr VSDRIVE.IncTimer
|
||||
bne .3
|
||||
lda #2
|
||||
sec
|
||||
rts
|
||||
.4 dey
|
||||
bne .2 next byte
|
||||
lda #521^$ffff 522 bytes to recieve
|
||||
sta VSDRIVE.Ping.BC
|
||||
lda /521^$ffff
|
||||
sta VSDRIVE.Ping.BC+1
|
||||
stz VSDRIVE.Ping.TO
|
||||
stz VSDRIVE.Ping.TO+1
|
||||
|
||||
ldy #3 EC if no byte recieved
|
||||
.5 lda SSC.STATUS,x
|
||||
and #SSC.STATUS.RDRF incoming char?
|
||||
bne .6
|
||||
* jsr VSDRIVE.Wait
|
||||
jsr VSDRIVE.IncTimer
|
||||
bne .5
|
||||
tya
|
||||
sec
|
||||
rts
|
||||
.6 ldy #4 EC=4 if recieved only partial reply
|
||||
|
||||
lda SSC.DATA,x
|
||||
inc VSDRIVE.Ping.BC
|
||||
bne .5
|
||||
inc VSDRIVE.Ping.BC+1
|
||||
bne .5
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
VSDRIVE.IncTimer
|
||||
inc VSDRIVE.Ping.TO
|
||||
bne .8
|
||||
inc VSDRIVE.Ping.TO+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
VSDRIVE.Wait lda #0
|
||||
.1 dec
|
||||
bne .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
VSDRIVE.CMDS .HS C6.00.00.03
|
||||
.DA #ADT.CMD.VSD
|
||||
* C6=C5 eor 03 eor 00 eor 00
|
||||
VSDRIVE.Ping.TO .BS 2
|
||||
VSDRIVE.Ping.BC .BS 2
|
||||
*--------------------------------------
|
||||
* Find 2 free slots in DEVPTRS (D1 & D2)
|
||||
*--------------------------------------
|
||||
VSDRIVE.SetSlot ldx #2 Starts at Slot1
|
||||
|
||||
.1 lda DEVPTRS,x Drive1
|
||||
cmp DEVPTRS pointing to S0D1 NODEV ?
|
||||
bne .2
|
||||
lda DEVPTRS+1,x
|
||||
cmp DEVPTRS+1
|
||||
bne .2
|
||||
lda DEVPTRS+16,x Drive2
|
||||
cmp DEVPTRS
|
||||
bne .2
|
||||
lda DEVPTRS+17,x
|
||||
cmp DEVPTRS+1
|
||||
bne .2
|
||||
lda #DRV.EntryPoint
|
||||
sta DEVPTRS,x
|
||||
sta DEVPTRS+16,x
|
||||
lda /DRV.EntryPoint
|
||||
sta DEVPTRS+1,x
|
||||
sta DEVPTRS+17,x
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ora #$0D
|
||||
ldy DEVCNT
|
||||
iny
|
||||
sta DEVLST,y add Drv1
|
||||
ora #$80
|
||||
iny
|
||||
sta DEVLST,y add Drv2
|
||||
sty DEVCNT
|
||||
txa
|
||||
lsr exit with A=SLOT
|
||||
clc
|
||||
rts
|
||||
.2 inx
|
||||
inx
|
||||
cpx #16
|
||||
bne .1
|
||||
rts sec from CPX
|
||||
*--------------------------------------
|
||||
VSDRIVE.Install ldx #PATCH.SIZE
|
||||
|
||||
.1 lda PATCH-1,x
|
||||
sta DRV.EntryPoint-1,x
|
||||
dex
|
||||
bne .1
|
||||
bit RRAMWRAMBNK2
|
||||
bit RRAMWRAMBNK2
|
||||
ldx #DRV.SIZE
|
||||
.2 lda DRV-1,x
|
||||
sta $D000,x
|
||||
dex
|
||||
bne .2
|
||||
bit RROMBNK1
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
.INB usr/src/shared/x.printf.s
|
||||
*--------------------------------------
|
||||
DEVSIG.Offset .HS 05070B0C
|
||||
DEVSIG.Value .HS 38180131
|
||||
VSDRIVE.MSG0 .AZ "VEDRIVE (ADTPro Vitual Ethernet HD) Driver For A2osX\n"
|
||||
VSDRIVE.DRVKO .AZ "VEDRIVE (Or other custom Driver) Already Installed.\n"
|
||||
VSDRIVE.SSCKO .AZ "Uthernet2 Not Detected.\n"
|
||||
VSDRIVE.SSCOK .AZ "Uthernet2 Found At Slot %d.\nContacting ADTPro Server..."
|
||||
VSDRIVE.SRVKO .AZ "No Response From ADTPro Server (EC=%d).\n"
|
||||
VSDRIVE.SRVOK .AZ "ADTPro Server Is Online.\n"
|
||||
VSDRIVE.NOSLOT .AZ "No ProDOS device slot available.\n"
|
||||
VSDRIVE.DEVOK .AZ "VEDRIVE Installed 2 devices at S%d,D1 & S%d,D2.\n"
|
||||
VSDRIVE.OK .AZ "VEDRIVE Driver Successfully Installed.\n"
|
||||
*--------------------------------------
|
||||
* ProDOS $BE41->$BE4B Patch for switching to BANK2 (10 bytes)
|
||||
*--------------------------------------
|
||||
PATCH .PH DRV.EntryPoint
|
||||
bit RRAMWRAMBNK2
|
||||
jsr $D001
|
||||
bit RRAMWRAMBNK1
|
||||
rts
|
||||
.EP
|
||||
PATCH.SIZE .EQ *-PATCH
|
||||
*--------------------------------------
|
||||
* Driver
|
||||
*--------------------------------------
|
||||
* OP = 2 : Write drv1
|
||||
* OP = 3 : Read drv1
|
||||
* OP = 4 : Write drv2
|
||||
* OP = 5 : Read drv2
|
||||
* CMD = $C5+OP+BLKLO+BLKHI+CHKSUM
|
||||
* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS
|
||||
* reuses them after Block operation
|
||||
* A1,A2 are used by Disk II Driver,
|
||||
* so we use it safely as Tmp Ptr
|
||||
*--------------------------------------
|
||||
DRV.A1L .EQ $3C
|
||||
DRV.A1H .EQ $3D
|
||||
DRV.A2L .EQ $3E
|
||||
DRV.A2H .EQ $3F
|
||||
DRV.COMMAND .EQ $42
|
||||
DRV.UNITNUM .EQ $43
|
||||
DRV.BUFF .EQ $44
|
||||
DRV.BLKNUM .EQ $46
|
||||
*--------------------------------------
|
||||
DRV .EQ *
|
||||
.PH $D001 Main LC Bnk 2 $D001->$DFFF
|
||||
cld
|
||||
DRV.Slotn0 ldx #$ff Self Modified
|
||||
lda DRV.COMMAND S=0,R=1,W=2,F=3
|
||||
bne .1
|
||||
ldx #$ff return Status
|
||||
ldy #$ff
|
||||
.8 lda #0
|
||||
clc
|
||||
rts
|
||||
.1 cmp #3
|
||||
beq .8 Format ....
|
||||
* bcs DRV.DO.CMD.ERR more....IO error
|
||||
|
||||
ora #2 W=2,R=3
|
||||
ldy DRV.UNITNUM
|
||||
bpl .2
|
||||
adc #2 CC from bcs
|
||||
.2 sta DRV.CmdBuf.Cmd store cmd
|
||||
eor #ADT.CMD.VSD
|
||||
eor DRV.BLKNUM
|
||||
eor DRV.BLKNUM+1
|
||||
sta DRV.CmdBuf.Sum Compute & store CheckSum
|
||||
lda DRV.BLKNUM
|
||||
sta DRV.CmdBuf.BlkL
|
||||
|
||||
lda DRV.BLKNUM+1
|
||||
sta DRV.CmdBuf.BlkH
|
||||
* send CMD+CS
|
||||
ldy #4 Send 5 bytes including Sum
|
||||
.3 lda DRV.CmdBuf.Sum,y
|
||||
jsr DRV.SSCSend
|
||||
dey
|
||||
bpl .3
|
||||
|
||||
ldy #8
|
||||
|
||||
.5 lda DRV.READWRITE,y
|
||||
sta $100,y
|
||||
dey
|
||||
bpl .5
|
||||
*--------------------------------------
|
||||
lda DRV.COMMAND
|
||||
dec 1-1=0 if read
|
||||
bne DRV.DO.CMD.W go write
|
||||
*--------------------------------------
|
||||
* Read block
|
||||
*--------------------------------------
|
||||
DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes
|
||||
|
||||
.1 jsr DRV.SSCGet
|
||||
eor DRV.CmdBuf.BlkH,y
|
||||
bne DRV.DO.CMD.ERR
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
ldy #4 Read 4 bytes DATE/TIME + 1 Byte Checksum
|
||||
|
||||
.2 jsr DRV.SSCGet
|
||||
|
||||
eor DRV.CmdBuf.Sum
|
||||
sta DRV.CmdBuf.Sum
|
||||
dey
|
||||
bpl .2
|
||||
|
||||
tay Last EOR was with Checksum, must be 0
|
||||
bne DRV.DO.CMD.ERR
|
||||
|
||||
* Y=0 from TAY
|
||||
|
||||
stz DRV.CmdBuf.Sum
|
||||
sec
|
||||
.3 jsr DRV.SSCGet
|
||||
jsr $100
|
||||
eor DRV.CmdBuf.Sum
|
||||
sta DRV.CmdBuf.Sum
|
||||
iny
|
||||
bne .3
|
||||
bcc .4
|
||||
inc DRV.BUFF+1
|
||||
clc
|
||||
bcc .3
|
||||
|
||||
.4 dec DRV.BUFF+1
|
||||
jsr DRV.SSCGet
|
||||
eor DRV.CmdBuf.Sum
|
||||
bne DRV.DO.CMD.ERR
|
||||
rts A=0,CC from bcc .4
|
||||
*--------------------------------------
|
||||
DRV.DO.CMD.ERR1 pla
|
||||
pla
|
||||
DRV.DO.CMD.ERR lda #MLI.E.IO
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Write Block
|
||||
*--------------------------------------
|
||||
DRV.DO.CMD.W lda #$B1 lda (),y
|
||||
|
||||
sta $103
|
||||
ldy #0
|
||||
|
||||
stz DRV.CmdBuf.Sum
|
||||
|
||||
sec
|
||||
.1 jsr $100
|
||||
jsr DRV.SSCSend
|
||||
eor DRV.CmdBuf.Sum
|
||||
sta DRV.CmdBuf.Sum
|
||||
iny
|
||||
bne .1
|
||||
bcc .2
|
||||
inc DRV.BUFF+1
|
||||
clc
|
||||
bcc .1
|
||||
.2 dec DRV.BUFF+1
|
||||
* A = DRV.CmdBuf.Sum
|
||||
|
||||
jsr DRV.SSCSend
|
||||
|
||||
* read back CMD
|
||||
ldy #4 Read 5 bytes (echo from server)
|
||||
.3 jsr DRV.SSCGet
|
||||
|
||||
eor DRV.CmdBuf.Sum,y Check 5 bytes (including block Sum)
|
||||
bne DRV.DO.CMD.ERR
|
||||
dey
|
||||
bpl .3
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRV.SendRCmd
|
||||
|
||||
|
||||
DRV.SendWCmd
|
||||
|
||||
ldx DRV.Slotn0
|
||||
|
||||
>AR.Sn.SELECT S0.TX.FSR
|
||||
lda W5100.DR,x get send size HI
|
||||
ldy W5100.DR,x LO
|
||||
|
||||
cpy #5
|
||||
sbc /5
|
||||
bcc IOERR
|
||||
|
||||
>AR.Sn.SELECT S0.TX.WR
|
||||
lda W5100.DR,x Get HI
|
||||
ldy W5100.DR,x Get LO
|
||||
and /TX.BASE
|
||||
ora /RXTX.MASK
|
||||
sta W5100.AR,x Write HI
|
||||
pha
|
||||
tya
|
||||
sta W5100.AR+1,x Write LO
|
||||
clc
|
||||
adc #5
|
||||
sta .3+1
|
||||
pla
|
||||
adc /0
|
||||
sta .2+1
|
||||
|
||||
ldy #4
|
||||
|
||||
.1 lda DRV.CmdBuf.Sum,y
|
||||
sta W5100.DR,x
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
>AR.SELECT S0.TX.WR
|
||||
|
||||
.2 lda #$ff SELF MODIFIED
|
||||
sta W5100.DR,x write HI
|
||||
.3 lda #$ff SELF MODIFIED
|
||||
sta W5100.DR,x write LO
|
||||
|
||||
>AR.Sn.SELECT S0.CR
|
||||
lda #W5100.AR.Sn.CR.SEND
|
||||
sta W5100.DR,x
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRV.READWRITE bit RRAMWRAMBNK1
|
||||
sta (DRV.BUFF),y
|
||||
bit RRAMWRAMBNK2
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRV.CmdBuf.Sum .BS 1 Reverse order for dey
|
||||
DRV.CmdBuf.BlkH .BS 1
|
||||
DRV.CmdBuf.BlkL .BS 1
|
||||
DRV.CmdBuf.Cmd .BS 1
|
||||
DRV.CmdBuf.Env .DA #ADT.CMD.VSD
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
DRV.SIZE .EQ *-DRV
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* CONTROL SECTION :
|
||||
*--------------------------------------
|
||||
.DO DRV.SIZE>255
|
||||
* ERROR:DRV.SIZE too big
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/km.vedrive.s
|
||||
ASM
|
@ -1,10 +1,9 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF sys/km/km.vsdrive
|
||||
.TF sys/km.vsdrive
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/io.i
|
||||
@ -312,23 +311,31 @@ DRV.BLKNUM .EQ $46
|
||||
*--------------------------------------
|
||||
DRV .EQ *
|
||||
.PH $D001 Main LC Bnk 2 $D001->$DFFF
|
||||
|
||||
cld
|
||||
|
||||
DRV.Slotn0 ldx #$ff Self Modified
|
||||
lda DRV.COMMAND S=0,R=1,W=2,F=3
|
||||
bne .1
|
||||
|
||||
ldx #$ff return Status
|
||||
ldy #$ff
|
||||
.8 lda #0
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 cmp #3
|
||||
beq .8 Format ....
|
||||
|
||||
* bcs DRV.DO.CMD.ERR more....IO error
|
||||
|
||||
ora #2 W=2,R=3
|
||||
|
||||
ldy DRV.UNITNUM
|
||||
bpl .2
|
||||
|
||||
adc #2 CC from bcs
|
||||
|
||||
.2 sta DRV.CmdBuf.Cmd store cmd
|
||||
eor #ADT.CMD.VSD
|
||||
eor DRV.BLKNUM
|
||||
@ -341,10 +348,12 @@ DRV.Slotn0 ldx #$ff Self Modified
|
||||
sta DRV.CmdBuf.BlkH
|
||||
* send CMD+CS
|
||||
ldy #4 Send 5 bytes including Sum
|
||||
|
||||
.3 lda DRV.CmdBuf.Sum,y
|
||||
jsr DRV.SSCSend
|
||||
dey
|
||||
bpl .3
|
||||
|
||||
ldy #8
|
||||
|
||||
.5 lda DRV.READWRITE,y
|
||||
@ -359,12 +368,15 @@ DRV.Slotn0 ldx #$ff Self Modified
|
||||
* Read block
|
||||
*--------------------------------------
|
||||
DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes
|
||||
|
||||
.1 jsr DRV.SSCGet
|
||||
eor DRV.CmdBuf.BlkH,y
|
||||
bne DRV.DO.CMD.ERR
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
ldy #4 Read 4 bytes DATE/TIME + 1 Byte Checksum
|
||||
|
||||
.2 jsr DRV.SSCGet
|
||||
|
||||
eor DRV.CmdBuf.Sum
|
||||
@ -374,17 +386,22 @@ DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes
|
||||
|
||||
tay Last EOR was with Checksum, must be 0
|
||||
bne DRV.DO.CMD.ERR
|
||||
|
||||
* Y=0 from TAY
|
||||
|
||||
stz DRV.CmdBuf.Sum
|
||||
|
||||
sec
|
||||
|
||||
.3 jsr DRV.SSCGet
|
||||
jsr $100
|
||||
eor DRV.CmdBuf.Sum
|
||||
sta DRV.CmdBuf.Sum
|
||||
iny
|
||||
bne .3
|
||||
|
||||
bcc .4
|
||||
|
||||
inc DRV.BUFF+1
|
||||
clc
|
||||
bcc .3
|
||||
@ -406,42 +423,52 @@ DRV.DO.CMD.ERR lda #MLI.E.IO
|
||||
DRV.DO.CMD.W lda #$B1 lda (),y
|
||||
|
||||
sta $103
|
||||
|
||||
ldy #0
|
||||
|
||||
stz DRV.CmdBuf.Sum
|
||||
|
||||
sec
|
||||
|
||||
.1 jsr $100
|
||||
jsr DRV.SSCSend
|
||||
eor DRV.CmdBuf.Sum
|
||||
sta DRV.CmdBuf.Sum
|
||||
iny
|
||||
bne .1
|
||||
|
||||
bcc .2
|
||||
|
||||
inc DRV.BUFF+1
|
||||
clc
|
||||
bcc .1
|
||||
|
||||
.2 dec DRV.BUFF+1
|
||||
|
||||
* A = DRV.CmdBuf.Sum
|
||||
|
||||
jsr DRV.SSCSend
|
||||
|
||||
* read back CMD
|
||||
ldy #4 Read 5 bytes (echo from server)
|
||||
.3 jsr DRV.SSCGet
|
||||
|
||||
.3 jsr DRV.SSCGet
|
||||
eor DRV.CmdBuf.Sum,y Check 5 bytes (including block Sum)
|
||||
bne DRV.DO.CMD.ERR
|
||||
|
||||
dey
|
||||
bpl .3
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRV.SSCSend sta .2+1
|
||||
|
||||
.1 lda SSC.STATUS,x
|
||||
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR
|
||||
* beq DRV.DO.CMD.ERR1
|
||||
and #SSC.STATUS.TDRE Outgoing char?
|
||||
beq .1
|
||||
|
||||
.2 lda #$ff
|
||||
sta SSC.DATA,x
|
||||
rts
|
||||
@ -451,6 +478,7 @@ DRV.SSCGet lda SSC.STATUS,x
|
||||
* beq DRV.DO.CMD.ERR1
|
||||
and #SSC.STATUS.RDRF incoming char?
|
||||
beq DRV.SSCGet
|
||||
|
||||
lda SSC.DATA,x
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user