2016-03-13 21:54:28 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-05-08 19:02:27 +00:00
|
|
|
|
.TF sbin/httpd
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/eth.i
|
|
|
|
|
.INB inc/libtcpip.i
|
|
|
|
|
.INB inc/net.http.i
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TIMEOUT.MAX .EQ 30 30 sec.
|
2017-02-15 16:14:41 +00:00
|
|
|
|
CONN.MAX .EQ 16
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-24 05:55:42 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
2020-05-30 20:38:47 +00:00
|
|
|
|
ZPPtr1 .BS 2
|
2019-10-24 05:55:42 +00:00
|
|
|
|
ZPSktPtr .BS 2
|
2020-05-30 20:38:47 +00:00
|
|
|
|
hFile .BS 1
|
|
|
|
|
hStr .BS 1
|
|
|
|
|
ZPStrPtr .BS 2
|
|
|
|
|
|
|
|
|
|
hSrvSocket .BS 1
|
|
|
|
|
TimeOut .BS 1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
hSrvName .BS 1
|
|
|
|
|
ZPSrvNamePtr .BS 2
|
2019-10-24 14:47:28 +00:00
|
|
|
|
hRootdir .BS 1
|
|
|
|
|
ZPRootDirPtr .BS 2
|
|
|
|
|
|
|
|
|
|
hClntSocket .BS 1
|
2020-05-30 20:38:47 +00:00
|
|
|
|
|
|
|
|
|
hRequest .BS 1
|
|
|
|
|
ZPRequestPtr .BS 2
|
|
|
|
|
ZPnRequestLen .BS 2
|
|
|
|
|
|
|
|
|
|
hReply .BS 1
|
|
|
|
|
ZPReplyPtr .BS 2
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
2019-10-24 05:55:42 +00:00
|
|
|
|
ZS.END .ED
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2019-03-02 20:47:58 +00:00
|
|
|
|
.DA #S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
2018-04-16 15:25:39 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #64 SS
|
2019-10-24 05:55:42 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2019-10-03 06:25:27 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
2020-05-30 20:38:47 +00:00
|
|
|
|
L.ETCHTTPDCONF .DA ETCHTTPDCONF
|
|
|
|
|
L.KEYWORDS .DA KEYWORDS
|
|
|
|
|
J.KEYWORDS .DA CS.RUN.CONF.SERVERNAME
|
|
|
|
|
.DA CS.RUN.CONF.LISTEN
|
|
|
|
|
.DA CS.RUN.CONF.DOCUMENTROOT
|
|
|
|
|
.DA CS.RUN.CONF.ADDTYPE
|
2019-03-02 22:18:21 +00:00
|
|
|
|
L.SA.Local .DA SA.Local
|
2016-03-13 21:54:28 +00:00
|
|
|
|
L.MSG.TCPWAIT .DA MSG.TCPWAIT
|
|
|
|
|
L.MSG.TCPIPERR .DA MSG.TCPIPERR
|
2020-05-30 20:38:47 +00:00
|
|
|
|
L.MSG.INITCONF .DA MSG.INITCONF
|
2019-10-24 14:47:28 +00:00
|
|
|
|
L.MSG.INITOK .DA MSG.INITOK
|
2016-03-13 21:54:28 +00:00
|
|
|
|
L.MSG.SKTERR .DA MSG.SKTERR
|
|
|
|
|
L.MSG.INCOMING .DA MSG.INCOMING
|
2017-04-12 06:12:39 +00:00
|
|
|
|
L.HTTP.200OK .DA HTTP.200OK
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.DA 0
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2019-03-04 07:14:31 +00:00
|
|
|
|
bcs .9
|
2016-03-13 21:54:28 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.9 rts
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-24 05:55:42 +00:00
|
|
|
|
CS.RUN >LDYA L.MSG.TCPWAIT
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta TimeOut
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.1 >SLEEP
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
2016-03-13 21:54:28 +00:00
|
|
|
|
bcs .99
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1) Configured ?
|
2016-03-13 21:54:28 +00:00
|
|
|
|
bmi CS.RUN.INIT
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-10-24 14:47:28 +00:00
|
|
|
|
lda Timeout
|
2019-03-04 07:14:31 +00:00
|
|
|
|
bcs .99
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
ldy #S.PS.hStdIn
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2019-03-04 07:14:31 +00:00
|
|
|
|
>SYSCALL feof
|
|
|
|
|
bcs CS.RUN.RTS I/O err
|
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .1
|
2019-03-04 07:14:31 +00:00
|
|
|
|
|
2018-04-16 15:25:39 +00:00
|
|
|
|
>SYSCALL GetChar
|
2019-03-04 07:14:31 +00:00
|
|
|
|
bcs CS.RUN.RTS
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
cmp #3 Ctrl-C
|
2017-01-28 22:05:20 +00:00
|
|
|
|
bne .1
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
|
|
|
|
sec
|
2018-04-16 15:25:39 +00:00
|
|
|
|
rts
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.99 >LDYA L.MSG.TCPIPERR
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-10-24 14:47:28 +00:00
|
|
|
|
CS.RUN.SYN
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2016-03-13 21:54:28 +00:00
|
|
|
|
sec
|
2018-04-16 15:25:39 +00:00
|
|
|
|
CS.RUN.RTS rts
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2016-03-13 21:54:28 +00:00
|
|
|
|
CS.RUN.INIT ldx #3
|
|
|
|
|
ldy #S.IPCFG.IP+3
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.1 lda (ZPPtr1),y
|
2019-03-02 22:18:21 +00:00
|
|
|
|
sta SA.LOCAL+S.SOCKADDR.ADDR,x
|
2016-03-13 21:54:28 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs CS.RUN.RTS
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
>STYA ZPStrPtr
|
|
|
|
|
stx hStr
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.INITCONF
|
|
|
|
|
>PUSHW L.ETCHTTPDCONF
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
|
|
|
|
|
>SYSCALL PrintF
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bcs CS.RUN.RTS
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
jsr CS.RUN.CONF
|
|
|
|
|
bcs CS.RUN.RTS
|
|
|
|
|
|
|
|
|
|
>PUSHBI 0 no protocol
|
2019-10-24 05:55:42 +00:00
|
|
|
|
lda #S.SOCKET.T.SEQPACKET
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
2020-05-08 19:02:27 +00:00
|
|
|
|
bcs CS.RUN.RTS
|
2018-09-17 15:42:38 +00:00
|
|
|
|
|
2019-10-24 14:47:28 +00:00
|
|
|
|
sta hSrvSocket
|
|
|
|
|
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>PUSHW L.SA.LOCAL
|
2019-10-24 14:47:28 +00:00
|
|
|
|
lda hSrvSocket
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
|
|
|
|
bcs CS.RUN.ERR
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
|
|
|
|
lda hSrvSocket
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Listen
|
|
|
|
|
bcs CS.RUN.ERR
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.INITOK
|
2019-10-24 14:47:28 +00:00
|
|
|
|
>PUSHW SA.LOCAL+S.SOCKADDR.PORT
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW ZPRootDirPtr
|
2019-10-24 14:47:28 +00:00
|
|
|
|
>PUSHBI 4
|
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
2018-04-16 15:25:39 +00:00
|
|
|
|
CS.RUN.LOOP >SLEEP
|
2017-02-17 07:20:57 +00:00
|
|
|
|
jsr CS.RUN.SERVER
|
|
|
|
|
bcs CS.RUN.ERR
|
2018-04-16 15:25:39 +00:00
|
|
|
|
bra CS.RUN.LOOP
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2017-02-17 07:20:57 +00:00
|
|
|
|
.9 >LDYA L.MSG.SKTERR
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2017-02-17 07:20:57 +00:00
|
|
|
|
sec
|
2019-03-02 22:18:21 +00:00
|
|
|
|
CS.RUN.ERR rts
|
2017-02-17 07:20:57 +00:00
|
|
|
|
*--------------------------------------
|
2020-05-30 20:38:47 +00:00
|
|
|
|
CS.RUN.CONF >PUSHW L.ETCHTTPDCONF
|
|
|
|
|
>PUSHBI O.RDONLY+O.TEXT
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHWZ
|
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
sta hFile
|
|
|
|
|
|
|
|
|
|
.1 >PUSHWI 256
|
|
|
|
|
>PUSHW ZPStrPtr
|
|
|
|
|
lda hFile
|
|
|
|
|
>SYSCALL fgets
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
lda (ZPStrPtr)
|
|
|
|
|
cmp #'#'
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.KEYWORDS
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 lda (ZPPtr1),y
|
|
|
|
|
cmp (ZPStrPtr),y
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.CONF.JMP
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
bra .97
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.5 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .6
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.6 lda (ZPPtr1)
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
.97 lda #E.SYN
|
|
|
|
|
|
|
|
|
|
.98 pha
|
|
|
|
|
jsr .8
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.8 lda hFile
|
|
|
|
|
>SYSCALL FClose
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CONF.JMP tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPStrPtr
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
adc ZPStrPtr+1
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
jmp (J.KEYWORDS,x)
|
|
|
|
|
|
|
|
|
|
CS.RUN.CONF.SERVERNAME
|
|
|
|
|
>SYSCALL StrDup
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPSrvNamePtr
|
|
|
|
|
stx hSrvName
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
CS.RUN.CONF.LISTEN
|
|
|
|
|
>SYSCALL atoi
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA SA.LOCAL+S.SOCKADDR.PORT
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
CS.RUN.CONF.DOCUMENTROOT
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHWI 0 Allocate
|
|
|
|
|
>SYSCALL RealPath
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPRootDirPtr
|
|
|
|
|
stx hRootdir
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
CS.RUN.CONF.ADDTYPE
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-24 14:47:28 +00:00
|
|
|
|
CS.RUN.SERVER lda hSrvSocket
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.accept
|
2017-02-17 07:20:57 +00:00
|
|
|
|
bcs .8
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
|
|
|
|
sta hClntSocket
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2016-03-13 21:54:28 +00:00
|
|
|
|
>STYA ZPSktPtr
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.INCOMING
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.SOCKET.REM.ADDR
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-10-24 14:47:28 +00:00
|
|
|
|
>PUSHB hClntSocket
|
2019-03-02 22:18:21 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
.1 >PUSHB (ZPSktPtr),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>PUSHBI 5
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-03-02 22:18:21 +00:00
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
jsr CS.RUN.CLIENT
|
2017-02-17 07:20:57 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-07 20:40:06 +00:00
|
|
|
|
CS.RUN.CLIENT
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.1 >SLEEP
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
lda hClntSocket
|
2019-10-24 05:55:42 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
2019-03-07 20:40:06 +00:00
|
|
|
|
bcc .2
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
|
|
|
|
tay
|
2019-03-07 20:40:06 +00:00
|
|
|
|
beq .1
|
2019-10-24 05:55:42 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.2 sta hRequest
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPRequestPtr
|
|
|
|
|
|
|
|
|
|
ldy #S.IP.TOTAL.LENGTH+1
|
|
|
|
|
lda (ZPRequestPtr),y
|
|
|
|
|
sec
|
|
|
|
|
sbc #S.TCP-S.IP
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPnRequestLen
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
lda (ZPRequestPtr),y
|
|
|
|
|
sbc /S.TCP-S.IP
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPnRequestLen+1
|
|
|
|
|
|
|
|
|
|
lda ZPRequestPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.TCP
|
|
|
|
|
sta ZPRequestPtr
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
inc ZPRequestPtr+1
|
2019-03-07 20:40:06 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.3 jsr CS.RUN.REQUEST.GetStr
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bcs .7
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
>LDYA ZPStrPtr
|
|
|
|
|
>SYSCALL puts
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bra .3
|
2019-03-04 07:14:31 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
* jsr CS.RUN.REPLY.INIT
|
|
|
|
|
|
|
|
|
|
* lda hReply
|
|
|
|
|
* >SYSCALL FreeMem
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.7 >PUSHWI HTTP.200OK.len
|
2017-04-12 06:12:39 +00:00
|
|
|
|
>PUSHW L.HTTP.200OK
|
2019-10-24 14:47:28 +00:00
|
|
|
|
lda hClntSocket
|
2019-10-24 05:55:42 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
|
|
|
|
|
2019-10-24 14:47:28 +00:00
|
|
|
|
.8 lda hClntSocket
|
2019-03-04 07:14:31 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
|
|
|
|
|
|
|
|
|
clc
|
2016-03-13 21:54:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-05-30 20:38:47 +00:00
|
|
|
|
CS.RUN.REQUEST.GetStr
|
2019-10-24 14:47:28 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.1 inc ZPnRequestLen
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bne .2
|
2020-05-30 20:38:47 +00:00
|
|
|
|
inc ZPnRequestLen+1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.2 lda (ZPRequestPtr)
|
|
|
|
|
inc ZPRequestPtr
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bne .21
|
2020-05-30 20:38:47 +00:00
|
|
|
|
inc ZPRequestPtr+1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
|
|
|
|
.21 cmp #C.CR
|
|
|
|
|
bne .4
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
inc ZPnRequestLen
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bne .3
|
2020-05-30 20:38:47 +00:00
|
|
|
|
inc ZPnRequestLen+1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.3 lda (ZPRequestPtr)
|
|
|
|
|
inc ZPRequestPtr
|
2019-10-24 14:47:28 +00:00
|
|
|
|
bne .31
|
2020-05-30 20:38:47 +00:00
|
|
|
|
inc ZPRequestPtr+1
|
2019-10-24 14:47:28 +00:00
|
|
|
|
|
|
|
|
|
.31 eor #C.LF
|
|
|
|
|
bne .9
|
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
sta (ZPStrPtr),y Y,A = StrLen
|
2019-10-24 14:47:28 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 sta (ZPStrPtr),y
|
|
|
|
|
iny
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-05-30 20:38:47 +00:00
|
|
|
|
CS.RUN.REPLY.INIT
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-03-04 07:14:31 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9 is it a TIMER event?
|
2019-10-24 14:47:28 +00:00
|
|
|
|
lda TimeOut
|
2019-03-04 07:14:31 +00:00
|
|
|
|
beq .9
|
2019-10-24 14:47:28 +00:00
|
|
|
|
dec TimeOut
|
|
|
|
|
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-24 14:47:28 +00:00
|
|
|
|
CS.QUIT lda hSrvSocket
|
2020-05-30 20:38:47 +00:00
|
|
|
|
beq .1
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2019-03-02 22:18:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.1 lda hStr
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.2
|
|
|
|
|
lda hLIBTCPIP
|
2018-11-12 09:22:06 +00:00
|
|
|
|
beq .8
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2019-10-24 05:55:42 +00:00
|
|
|
|
|
2018-11-12 09:22:06 +00:00
|
|
|
|
.8 clc
|
2016-03-13 21:54:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
hLIBTCPIP .BS 1
|
2019-12-03 15:42:17 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip"
|
2020-05-30 20:38:47 +00:00
|
|
|
|
ETCHTTPDCONF .AZ "${BOOT}etc/httpd.conf"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
KEYWORDS .AS "ServerName "
|
|
|
|
|
.AS "Listen "
|
|
|
|
|
.AS "DocumentRoot "
|
|
|
|
|
.AS "AddType "
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
2019-03-04 07:14:31 +00:00
|
|
|
|
MSG.TCPWAIT .AZ "HTTPD:Waiting for TCP/IP initializing..."
|
|
|
|
|
MSG.TCPIPERR .AZ "HTTPD:TCP/IP Not initialized properly."
|
2020-05-30 20:38:47 +00:00
|
|
|
|
MSG.INITCONF .AZ "HTTPD:Reading %s file...\r\n"
|
2019-10-24 14:47:28 +00:00
|
|
|
|
MSG.INITOK .AZ "HTTPD:Listening on port %D, root dir: %s.\r\n"
|
2019-03-04 07:14:31 +00:00
|
|
|
|
MSG.SKTERR .AZ "HTTPD:Listen Error."
|
|
|
|
|
MSG.INCOMING .AZ "HTTPD:Incoming Connection [SKT=%h] From : %d.%d.%d.%d\r\n"
|
2017-04-12 06:12:39 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-04 07:14:31 +00:00
|
|
|
|
HTTP.200OK .AS "HTTP/1.1 200 OK"
|
|
|
|
|
.DA #C.CR,#C.LF
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.AS "Server: A2osX-HTTPD 0.94"
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.DA #C.CR,#C.LF
|
|
|
|
|
.AS "Content-Type: text/html"
|
|
|
|
|
.DA #C.CR,#C.LF
|
|
|
|
|
.AS "Content-Length: 34"
|
|
|
|
|
.DA #C.CR,#C.LF
|
|
|
|
|
.AS "Connection: Close"
|
|
|
|
|
.DA #C.CR,#C.LF
|
|
|
|
|
.DA #C.CR,#C.LF
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.AS "<HTML><BODY>Hello From A2osX-HTTPD 0.94 !</BODY></HTML>"
|
2019-03-04 07:14:31 +00:00
|
|
|
|
.DA #C.CR,#C.LF
|
2019-03-02 22:18:21 +00:00
|
|
|
|
HTTP.200OK.len .EQ *-HTTP.200OK
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-02 22:18:21 +00:00
|
|
|
|
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.BS 1
|
2019-03-02 22:18:21 +00:00
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.DA TCP.PORT.HTTP
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-05-30 20:38:47 +00:00
|
|
|
|
SAVE usr/src/sbin/httpd.s
|
2016-03-13 21:54:28 +00:00
|
|
|
|
ASM
|