2018-12-05 15:12:10 +00:00
|
|
|
|
NEW
|
2019-12-18 20:49:41 +00:00
|
|
|
|
AUTO 3,1
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-09-01 06:23:13 +00:00
|
|
|
|
.TF bin/httpget
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/mli.e.i
|
|
|
|
|
.INB inc/eth.i
|
|
|
|
|
.INB inc/libtcpip.i
|
|
|
|
|
.INB inc/net.http.i
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
2020-11-29 18:24:11 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 250 25 sec.
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPIPCfgPtr .BS 2
|
|
|
|
|
ZPHostPtr .BS 2
|
|
|
|
|
ZPPtr .BS 2
|
2020-09-02 06:27:25 +00:00
|
|
|
|
ArgIndex .BS 1
|
|
|
|
|
hSocket .BS 1
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
hReqBuf .BS 1
|
|
|
|
|
ZPReqBufPtr .BS 2
|
2018-12-08 07:36:46 +00:00
|
|
|
|
ZPReqBufLen .BS 2
|
2020-09-07 20:40:50 +00:00
|
|
|
|
bHeader .BS 1
|
2020-09-02 06:27:25 +00:00
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
bURI .BS 1
|
2020-09-01 10:47:39 +00:00
|
|
|
|
|
|
|
|
|
hEncodedBuf .BS 1
|
2018-12-08 07:36:46 +00:00
|
|
|
|
ZPEncodedBufPtr .BS 2
|
|
|
|
|
ZPEncodedBufLen .BS 2
|
2020-08-31 15:29:32 +00:00
|
|
|
|
hSendBuf .BS 1
|
|
|
|
|
ZPSendBufPtr .BS 2
|
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
hRespBuf .BS 1
|
|
|
|
|
ZPRespBufPtr .BS 2
|
|
|
|
|
ZPRespBufLen .BS 2
|
2020-09-01 06:23:13 +00:00
|
|
|
|
hFile .BS 1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
ZPFileName .BS 2
|
|
|
|
|
|
2020-08-19 19:39:43 +00:00
|
|
|
|
ZS.END .ED
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA #S.PS.F.EVENT S.PS.F
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.DA #64 SS
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
2020-11-26 19:47:57 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
|
|
|
|
L.SA.LOCAL .DA SA.LOCAL
|
|
|
|
|
L.SA.REMOTE .DA SA.REMOTE
|
|
|
|
|
L.SA.REMOTE.AD .DA SA.REMOTE+S.SOCKADDR.ADDR
|
|
|
|
|
L.MSG.IPKO .DA MSG.IPKO
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
2020-11-29 18:24:11 +00:00
|
|
|
|
L.MSG.CRLF .DA MSG.CRLF
|
2018-12-05 15:12:10 +00:00
|
|
|
|
L.MSG.UNKNOWN .DA MSG.UNKNOWN
|
2019-10-05 17:24:41 +00:00
|
|
|
|
L.MSG.CONNECT .DA MSG.CONNECT
|
2018-12-05 15:12:10 +00:00
|
|
|
|
L.MSG.SKTKO .DA MSG.SKTKO
|
2019-10-05 17:24:41 +00:00
|
|
|
|
L.MSG.CONNECTED .DA MSG.CONNECTED
|
2018-12-05 15:12:10 +00:00
|
|
|
|
L.MSG.SKTERR .DA MSG.SKTERR
|
|
|
|
|
L.MSG.IOERR .DA MSG.IOERR
|
2020-09-07 20:40:50 +00:00
|
|
|
|
L.MSG.FileLength .DA MSG.FileLength
|
|
|
|
|
L.MSG.Progress .DA MSG.Progress
|
2020-08-31 15:29:32 +00:00
|
|
|
|
L.HTTP.GET .DA HTTP.GET
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
|
|
|
|
>SYSCALL LoadLib
|
|
|
|
|
bcs .9
|
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-02-01 20:01:54 +00:00
|
|
|
|
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
|
|
|
|
bmi CS.RUN.IPOK
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>LDYA L.MSG.IPKO
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-12-05 15:12:10 +00:00
|
|
|
|
lda #E.SYN
|
2018-12-07 16:16:08 +00:00
|
|
|
|
sec
|
2018-12-05 15:12:10 +00:00
|
|
|
|
rts
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
|
|
|
|
ldx #3
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
|
|
|
|
sta SA.LOCAL+S.SOCKADDR.ADDR,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
jsr CS.RUN.GETNEXTARG
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPHostPtr
|
2020-08-19 19:39:43 +00:00
|
|
|
|
jsr Init.TimeOut
|
2018-12-05 15:12:10 +00:00
|
|
|
|
|
|
|
|
|
.2 >PUSHW L.SA.REMOTE.AD
|
|
|
|
|
>PUSHW ZPHostPtr
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcc CS.RUN.HOSTOK
|
|
|
|
|
>SLEEP
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
|
|
|
|
lda TimeOut
|
|
|
|
|
bne .2
|
2018-12-05 15:12:10 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.UNKNOWN
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHW ZPHostPtr
|
|
|
|
|
>PUSHBI 2
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bra CS.RUN.ESYN
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
.9 >PUSHW L.MSG.USAGE
|
|
|
|
|
>PUSHBI 0
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-12-05 15:12:10 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.ESYN lda #E.SYN
|
2019-10-03 06:25:27 +00:00
|
|
|
|
sec
|
2018-12-05 15:12:10 +00:00
|
|
|
|
CS.RUN.RTS rts
|
2020-09-01 10:47:39 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-02 06:27:25 +00:00
|
|
|
|
CS.RUN.HOSTOK jsr CS.RUN.GETNEXTARG
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcc .10
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
.8 jmp CS.RUN.ARGSOK
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.10 >STYA ZPPtr
|
|
|
|
|
lda (ZPPtr)
|
2020-09-02 06:27:25 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
cmp #'-'
|
|
|
|
|
beq .1
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
>LDYA ZPPtr
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>SYSCALL AToI
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcs CS.RUN.RTS
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>STYA SA.REMOTE+S.SOCKADDR.PORT
|
2020-09-01 10:47:39 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
jsr CS.RUN.GETNEXTARG
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcs .8
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>STYA ZPPtr
|
|
|
|
|
lda (ZPPtr)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne CS.RUN.ESYN
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.1 ldy #1
|
|
|
|
|
lda (ZPPtr),y
|
2019-12-18 20:49:41 +00:00
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .11
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
bcs .11
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2019-12-18 20:49:41 +00:00
|
|
|
|
eor #$20
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2019-12-18 20:49:41 +00:00
|
|
|
|
.11 cmp #'U'
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bne .2
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
bit bURI
|
|
|
|
|
bmi CS.RUN.ESYN
|
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
jsr CS.RUN.GETNEXTARG
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.9 bcs CS.RUN.ESYN
|
|
|
|
|
|
2018-12-07 16:16:08 +00:00
|
|
|
|
>STYA ZPReqBufPtr
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>SYSCALL StrLen
|
2018-12-07 16:16:08 +00:00
|
|
|
|
>STYA ZPReqBufLen
|
2020-09-01 10:47:39 +00:00
|
|
|
|
sec
|
|
|
|
|
ror bURI
|
|
|
|
|
bra CS.RUN.HOSTOK
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.2 cmp #'F'
|
2020-08-31 15:29:32 +00:00
|
|
|
|
bne .3
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
bit bURI
|
|
|
|
|
bmi CS.RUN.ESYN
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
jsr CS.RUN.GETNEXTARG
|
2019-12-18 20:49:41 +00:00
|
|
|
|
bcs .9
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>SYSCALL LoadTxtFile
|
|
|
|
|
bcs .9
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-07 16:16:08 +00:00
|
|
|
|
>STYA ZPReqBufLen
|
2020-08-31 15:29:32 +00:00
|
|
|
|
stx hReqBuf
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-12-07 16:16:08 +00:00
|
|
|
|
>STYA ZPReqBufPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
sec
|
|
|
|
|
ror bURI
|
2020-09-01 10:47:39 +00:00
|
|
|
|
jmp CS.RUN.HOSTOK
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.3 cmp #'O'
|
2020-09-02 06:27:25 +00:00
|
|
|
|
bne .9
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .9
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>STYA ZPFileName
|
2020-09-01 10:47:39 +00:00
|
|
|
|
jmp CS.RUN.HOSTOK
|
|
|
|
|
*--------------------------------------
|
2020-09-02 06:27:25 +00:00
|
|
|
|
CS.RUN.GETNEXTARG
|
|
|
|
|
inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
2020-11-26 19:47:57 +00:00
|
|
|
|
rts
|
2020-09-02 06:27:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-01 10:47:39 +00:00
|
|
|
|
CS.RUN.ARGSOK >PUSHW L.MSG.CONNECT
|
2020-02-14 07:21:56 +00:00
|
|
|
|
ldx #0
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.1 >PUSHB SA.REMOTE+S.SOCKADDR.ADDR,x
|
2020-02-14 07:21:56 +00:00
|
|
|
|
inx
|
|
|
|
|
cpx #4
|
|
|
|
|
bne .1
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW SA.REMOTE+S.SOCKADDR.PORT
|
2020-11-26 19:47:57 +00:00
|
|
|
|
>PUSHW ZPHostPtr
|
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHBI 8
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
2020-08-31 15:29:32 +00:00
|
|
|
|
lda #S.SOCKET.T.SEQPKT
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-05 17:24:41 +00:00
|
|
|
|
sta hSocket
|
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHW L.SA.LOCAL
|
2019-10-05 17:24:41 +00:00
|
|
|
|
lda hSocket
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
2019-10-05 17:24:41 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.9 pha
|
|
|
|
|
>LDYA L.MSG.SKTKO
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-10-05 17:24:41 +00:00
|
|
|
|
pla
|
2019-10-03 06:25:27 +00:00
|
|
|
|
sec
|
2019-10-05 17:24:41 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.1 jsr Init.TimeOut
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
|
|
|
|
.2 >SLEEP
|
|
|
|
|
|
|
|
|
|
>PUSHW L.SA.REMOTE
|
|
|
|
|
lda hSocket
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
2019-10-05 17:24:41 +00:00
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
cmp #ERR.SKT.NOCONN
|
|
|
|
|
bne .9
|
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
lda TimeOut
|
|
|
|
|
bne .2
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2019-10-05 17:24:41 +00:00
|
|
|
|
lda #ERR.SKT.NOCONN
|
|
|
|
|
bra .9
|
|
|
|
|
|
2021-01-13 16:57:41 +00:00
|
|
|
|
.3 >SLEEP
|
|
|
|
|
|
|
|
|
|
lda hSocket
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
|
|
|
|
bcc .7
|
|
|
|
|
|
|
|
|
|
cmp #E.NODATA
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
ldx TimeOut
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
lda #ERR.SKT.NOCONN
|
|
|
|
|
bra .9
|
|
|
|
|
|
|
|
|
|
.7 >SYSCALL Freemem
|
|
|
|
|
|
|
|
|
|
.8 >LDYA L.MSG.CONNECTED
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
|
|
|
|
>SLEEP
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
CS.RUN.GET jsr CS.RUN.ENCODE
|
|
|
|
|
bcs .99
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
jsr CS.RUN.REQUEST
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
>LDYA ZPFileName
|
|
|
|
|
beq .1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHBI O.CREATE+O.WRONLY+O.TRUNC
|
|
|
|
|
>PUSHBI 0 TYPE
|
|
|
|
|
>PUSHWI 0 AUXTYPE
|
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
|
|
|
|
sta hFile
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
.1 jsr CS.RUN.RESPONSE
|
2018-12-07 16:16:08 +00:00
|
|
|
|
bcs .99
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.9 lda #0
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.SKTERR pha
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.SKTERR
|
|
|
|
|
pla
|
|
|
|
|
pha
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-12-05 15:12:10 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.IOERR pha
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.IOERR
|
|
|
|
|
pla
|
|
|
|
|
pha
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-12-05 15:12:10 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-12-07 16:16:08 +00:00
|
|
|
|
*--------------------------------------
|
2018-12-08 07:36:46 +00:00
|
|
|
|
CS.RUN.ENCODE >LDYA ZPReqBufPtr
|
|
|
|
|
>STYA ZPPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-09 12:47:18 +00:00
|
|
|
|
inc ZPEncodedBufLen for ending \0
|
2018-12-08 07:36:46 +00:00
|
|
|
|
|
2020-09-09 12:47:18 +00:00
|
|
|
|
.1 lda (ZPPtr)
|
2018-12-08 07:36:46 +00:00
|
|
|
|
beq .4
|
|
|
|
|
|
2020-09-09 12:47:18 +00:00
|
|
|
|
inc ZPPtr
|
|
|
|
|
bne .2
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
inc ZPPtr+1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
.2 jsr CS.RUN.TOENCODE if CS 3 bytes, if CC 1 byte
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
lda #1
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
inc
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
.3 adc ZPEncodedBufLen
|
2018-12-08 07:36:46 +00:00
|
|
|
|
sta ZPEncodedBufLen
|
2020-09-09 12:47:18 +00:00
|
|
|
|
bcc .1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
inc ZPEncodedBufLen+1
|
2020-09-09 12:47:18 +00:00
|
|
|
|
bra .1
|
|
|
|
|
*--------------------------------------
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.4 >LDYA ZPEncodedBufLen
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
>STYA ZPEncodedBufPtr
|
2020-09-09 12:47:18 +00:00
|
|
|
|
>STYA ZPPtr
|
2020-09-12 12:09:24 +00:00
|
|
|
|
stx hEncodedBuf
|
2020-09-09 12:47:18 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.5 lda (ZPReqBufPtr)
|
|
|
|
|
beq .8
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
inc ZPReqBufPtr
|
|
|
|
|
bne .6
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
inc ZPReqBufPtr+1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.6 jsr CS.RUN.TOENCODE
|
|
|
|
|
bcc .7
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
jsr CS.RUN.ADDBYTETOBUF
|
|
|
|
|
bra .5
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.7 jsr CS.RUN.ADDTOBUF
|
|
|
|
|
bra .5
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2020-09-09 12:47:18 +00:00
|
|
|
|
.8 sta (ZPPtr) ending \0
|
|
|
|
|
|
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2018-12-08 07:36:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.TOENCODE ldx #URI.ToEncode.Cnt-1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.1 cmp URI.ToEncode,x
|
|
|
|
|
beq .9 CS
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.ADDBYTETOBUF
|
|
|
|
|
pha
|
|
|
|
|
lda #'%'
|
|
|
|
|
jsr CS.RUN.ADDTOBUF
|
|
|
|
|
pla
|
|
|
|
|
pha
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
ora #$30
|
|
|
|
|
cmp #$3A
|
|
|
|
|
bcc .1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
adc #6
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
.1 jsr CS.RUN.ADDTOBUF
|
|
|
|
|
pla
|
|
|
|
|
and #$0F
|
|
|
|
|
ora #$30
|
|
|
|
|
cmp #$3A
|
|
|
|
|
bcc CS.RUN.ADDTOBUF
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
adc #6
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-08 07:36:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.ADDTOBUF sta (ZPPtr)
|
|
|
|
|
inc ZPPtr
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPPtr+1
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.8 rts
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
CS.RUN.REQUEST jsr Init.TimeOut
|
2018-12-06 07:46:26 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>LDYAI 1024
|
|
|
|
|
>SYSCALL GetMem
|
2018-12-05 15:12:10 +00:00
|
|
|
|
bcs .9
|
2020-09-01 06:23:13 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>STYA ZPSendBufPtr
|
|
|
|
|
stx hSendBuf
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHYA
|
2020-09-01 06:23:13 +00:00
|
|
|
|
>PUSHW L.HTTP.GET
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>PUSHW ZPEncodedBufPtr
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>PUSHW ZPHostPtr
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>PUSHBI 4
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>SYSCALL SPrintF
|
|
|
|
|
bcs .90
|
2020-09-01 06:23:13 +00:00
|
|
|
|
|
|
|
|
|
>PUSHYA Byte count
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>PUSHW ZPSendBufPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2019-10-05 17:24:41 +00:00
|
|
|
|
lda hSocket
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.90 php
|
|
|
|
|
pha
|
|
|
|
|
lda hSendBuf
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
pla
|
|
|
|
|
plp
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-11-29 18:24:11 +00:00
|
|
|
|
.9
|
|
|
|
|
CS.RUN.REQUEST.RTS
|
|
|
|
|
rts
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
CS.RUN.RESPONSE jsr Init.TimeOut
|
2018-12-07 16:16:08 +00:00
|
|
|
|
|
|
|
|
|
.1 >SLEEP
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
|
|
|
|
lda hSocket
|
2020-08-31 15:29:32 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
2018-12-07 16:16:08 +00:00
|
|
|
|
bcc .2
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2019-10-05 17:24:41 +00:00
|
|
|
|
cmp #E.NODATA
|
2020-09-07 20:40:50 +00:00
|
|
|
|
bne .80
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-11-29 18:24:11 +00:00
|
|
|
|
jsr CS.RUN.CtrlC
|
|
|
|
|
bcs CS.RUN.REQUEST.RTS
|
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
lda TimeOut
|
2020-09-01 06:23:13 +00:00
|
|
|
|
bne .1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
bit bHeader
|
2020-09-05 13:38:04 +00:00
|
|
|
|
bmi .1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.80 jmp .8
|
2020-09-01 06:23:13 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
.2 jsr CS.RUN.GETRESPONSE
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
bit bHeader
|
2020-09-01 10:47:39 +00:00
|
|
|
|
bmi .6
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
jsr CS.RUN.GETHEADER
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
sec
|
2020-09-07 20:40:50 +00:00
|
|
|
|
ror bHeader
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
.6 >PUSHW ZPRespBufLen
|
2018-12-07 16:16:08 +00:00
|
|
|
|
>PUSHW ZPRespBufPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
lda hFile
|
2020-09-01 10:47:39 +00:00
|
|
|
|
bne .7
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2018-12-07 16:16:08 +00:00
|
|
|
|
ldy #S.PS.hStdOut
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2020-09-01 10:47:39 +00:00
|
|
|
|
|
|
|
|
|
.7 >SYSCALL FWrite
|
2018-12-07 16:16:08 +00:00
|
|
|
|
bcs .9
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
lda hRespBuf
|
|
|
|
|
stz hRespBuf
|
|
|
|
|
>SYSCALL FreeMem
|
2018-12-07 16:16:08 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
lda ZPRespBufLen
|
|
|
|
|
clc
|
|
|
|
|
adc Received
|
|
|
|
|
sta Received
|
|
|
|
|
|
|
|
|
|
lda ZPRespBufLen+1
|
|
|
|
|
adc Received+1
|
|
|
|
|
sta Received+1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
bcc .70
|
|
|
|
|
|
|
|
|
|
inc Received+2
|
|
|
|
|
bne .70
|
|
|
|
|
|
|
|
|
|
inc Received+3
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.70 >PUSHW L.MSG.Progress
|
|
|
|
|
>PUSHL Received
|
2020-11-29 18:24:11 +00:00
|
|
|
|
>PUSHBI 4
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-09-09 06:11:45 +00:00
|
|
|
|
bcs .9
|
2020-09-07 20:40:50 +00:00
|
|
|
|
|
2020-09-01 10:47:39 +00:00
|
|
|
|
jmp CS.RUN.RESPONSE
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.8 bit bHeader
|
2020-09-01 06:23:13 +00:00
|
|
|
|
bpl .99
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
>PUSHW L.MSG.CRLF
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
jsr CS.RUN.CHECKLEN
|
|
|
|
|
bcc .9
|
2019-10-05 17:24:41 +00:00
|
|
|
|
|
2018-12-07 16:16:08 +00:00
|
|
|
|
.99 lda #MLI.E.IO
|
2020-09-01 10:47:39 +00:00
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
2018-12-07 16:16:08 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-02 06:27:25 +00:00
|
|
|
|
CS.RUN.GETRESPONSE
|
|
|
|
|
sta hRespBuf
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPRespBufPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
ldy #S.IP.TOTAL.LENGTH+1
|
|
|
|
|
lda (ZPRespBufPtr),y
|
|
|
|
|
sec
|
2020-11-26 19:47:57 +00:00
|
|
|
|
sbc #S.TCP-S.ETH.EII
|
2020-09-02 06:27:25 +00:00
|
|
|
|
sta ZPRespBufLen
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
dey
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
lda (ZPRespBufPtr),y
|
2020-11-26 19:47:57 +00:00
|
|
|
|
sbc /S.TCP-S.ETH.EII
|
2020-09-02 06:27:25 +00:00
|
|
|
|
sta ZPRespBufLen+1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
lda ZPRespBufPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.TCP
|
|
|
|
|
sta ZPRespBufPtr
|
|
|
|
|
bcc .8
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-02 06:27:25 +00:00
|
|
|
|
inc ZPRespBufPtr+1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
|
|
|
|
.8 rts
|
2020-09-02 06:27:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-07 20:40:50 +00:00
|
|
|
|
CS.RUN.GETHEADER
|
|
|
|
|
.1 ldy #$ff
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
|
|
|
|
|
lda (ZPRespBufPtr),y
|
|
|
|
|
eor #C.CR
|
|
|
|
|
bne .2
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
sta (ZPRespBufPtr),y
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
iny skip CR
|
|
|
|
|
iny skip LF
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
sty ArgIndex
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
>LDYA ZPRespBufPtr
|
|
|
|
|
>STYA ZPPtr
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
lda ZPRespBufLen
|
|
|
|
|
sec
|
|
|
|
|
sbc ArgIndex
|
|
|
|
|
sta ZPRespBufLen
|
|
|
|
|
bcs .3
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
dec ZPRespBufLen+1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.3 lda ArgIndex
|
|
|
|
|
tay
|
|
|
|
|
clc
|
|
|
|
|
adc ZPRespBufPtr
|
|
|
|
|
sta ZPRespBufPtr
|
|
|
|
|
bcc .4
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
inc ZPRespBufPtr+1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
.4 dey
|
|
|
|
|
dey
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.5 iny
|
|
|
|
|
lda (ZPPtr),y
|
|
|
|
|
cmp HEAD.ContentLength,y
|
|
|
|
|
bne .1
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
bne .5
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-07 20:40:50 +00:00
|
|
|
|
tya
|
|
|
|
|
sec skip SPACE
|
|
|
|
|
adc ZPPtr
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPtr+1
|
|
|
|
|
adc #0
|
|
|
|
|
|
|
|
|
|
>SYSCALL AToL
|
|
|
|
|
>PULLL Length
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.FileLength
|
|
|
|
|
>PUSHL Length
|
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
jmp .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2020-09-07 20:40:50 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-12 12:09:24 +00:00
|
|
|
|
CS.RUN.CHECKLEN ldx #3
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
2020-11-26 19:47:57 +00:00
|
|
|
|
.1 lda Received,x
|
|
|
|
|
eor Length,x
|
2020-09-12 12:09:24 +00:00
|
|
|
|
bne .9
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
dex
|
2020-11-26 19:47:57 +00:00
|
|
|
|
bpl .1
|
|
|
|
|
|
2020-09-12 12:09:24 +00:00
|
|
|
|
clc
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2020-09-12 12:09:24 +00:00
|
|
|
|
*--------------------------------------
|
2020-11-29 18:24:11 +00:00
|
|
|
|
CS.RUN.CtrlC ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL FEOF
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
bne .8 CC
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
beq .9 CS
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2018-12-05 15:12:10 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9 is it a TIMER event?
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
lda TimeOut
|
2018-12-05 15:12:10 +00:00
|
|
|
|
beq .9
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
|
|
|
|
dec TimeOut
|
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-05 17:24:41 +00:00
|
|
|
|
CS.QUIT lda hSocket
|
2018-12-05 15:12:10 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2020-09-05 13:38:04 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2020-09-01 06:23:13 +00:00
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.1 lda hReqBuf
|
2018-12-05 15:12:10 +00:00
|
|
|
|
beq .2
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
|
|
|
|
.2 lda hEncodedBuf
|
2018-12-05 15:12:10 +00:00
|
|
|
|
beq .3
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
|
|
|
|
.3 lda hRespBuf
|
2018-12-08 07:36:46 +00:00
|
|
|
|
beq .4
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
.4 lda hFile
|
|
|
|
|
beq .5
|
2020-11-26 19:47:57 +00:00
|
|
|
|
|
2020-09-01 06:23:13 +00:00
|
|
|
|
>SYSCALL FClose
|
|
|
|
|
|
|
|
|
|
.5 lda hLIBTCPIP
|
2018-12-05 15:12:10 +00:00
|
|
|
|
beq .8
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
Init.TimeOut lda #TIMEOUT.MAX
|
2020-08-31 15:29:32 +00:00
|
|
|
|
sta TimeOut
|
2018-12-05 15:12:10 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2019-12-03 15:42:17 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip"
|
2018-12-05 15:12:10 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
MSG.IPKO .AZ "TCP/IP Not Loaded/Configured."
|
|
|
|
|
MSG.USAGE .AS "Usage : HTTPGET <ip|host> [port]\r\n"
|
2020-12-23 14:54:57 +00:00
|
|
|
|
.AS " -U : Url\r\n"
|
|
|
|
|
.AS " -F : UrlFile\r\n"
|
|
|
|
|
.AS " -O : OutputFile"
|
2020-11-29 18:24:11 +00:00
|
|
|
|
MSG.CRLF .AZ "\r\n"
|
2018-12-05 15:12:10 +00:00
|
|
|
|
MSG.UNKNOWN .AZ "%s: Unknown host\r\n"
|
2019-10-05 17:24:41 +00:00
|
|
|
|
MSG.CONNECT .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
|
2018-12-05 15:12:10 +00:00
|
|
|
|
MSG.SKTKO .AZ "Failed to Open Socket."
|
2019-10-05 17:24:41 +00:00
|
|
|
|
MSG.CONNECTED .AZ "Connected."
|
2018-12-05 15:12:10 +00:00
|
|
|
|
MSG.SKTERR .AZ "Socket Error : $%h\r\n"
|
|
|
|
|
MSG.IOERR .AZ "I/O Error : $%h\r\n"
|
2020-11-29 18:24:11 +00:00
|
|
|
|
MSG.FileLength .AZ "File Length : %10u Bytes\r\n"
|
|
|
|
|
MSG.Progress .AZ "\rReceived : %10u"
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF
|
|
|
|
|
.BS 1
|
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.BS 2 S.SOCKADDR.PORT
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SA.REMOTE .DA #AF.INET S.SOCKADDR.AF
|
|
|
|
|
.BS 1
|
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.DA TCP.PORT.HTTP
|
|
|
|
|
*--------------------------------------
|
2018-12-08 07:36:46 +00:00
|
|
|
|
URI.ToEncode .DA #C.LF,#C.CR,#C.SPACE,#'"'
|
|
|
|
|
.AS "%-.\^_`{|}~"
|
|
|
|
|
URI.ToEncode.Cnt .EQ *-URI.ToEncode
|
|
|
|
|
*--------------------------------------
|
2020-09-07 20:40:50 +00:00
|
|
|
|
HEAD.ContentLength .AZ "Content-Length: "
|
|
|
|
|
*--------------------------------------
|
2020-08-31 15:29:32 +00:00
|
|
|
|
HTTP.GET .AS "GET /%s HTTP/1.1"
|
2018-12-06 07:46:26 +00:00
|
|
|
|
.DA #C.CR,#C.LF
|
|
|
|
|
.AS "User-Agent: A2osX.HTTPGET"
|
|
|
|
|
.DA #C.CR,#C.LF
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.AS "Host: %s"
|
|
|
|
|
.DA #C.CR,#C.LF
|
2018-12-06 21:58:47 +00:00
|
|
|
|
.AS "Connection: close"
|
|
|
|
|
.DA #C.CR,#C.LF
|
2018-12-06 16:39:53 +00:00
|
|
|
|
.DA #C.CR,#C.LF
|
2020-09-01 06:23:13 +00:00
|
|
|
|
.DA #0
|
2020-09-07 20:40:50 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
Received .BS 4
|
|
|
|
|
Length .BS 4
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2020-11-26 19:47:57 +00:00
|
|
|
|
DS.START
|
2020-08-31 15:29:32 +00:00
|
|
|
|
DS.END .ED
|
2018-12-05 15:12:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-19 19:39:43 +00:00
|
|
|
|
SAVE usr/src/bin/httpget.s
|
2018-12-05 15:12:10 +00:00
|
|
|
|
ASM
|