2016-12-09 16:36:24 +00:00
|
|
|
|
PR#3
|
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2018-08-08 15:13:37 +00:00
|
|
|
|
AUTO 4,1
|
2016-12-09 16:36:24 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF SBIN/NFSD
|
2016-12-09 16:36:24 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/LIBTCPIP.I
|
2016-12-09 16:36:24 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TIMEOUT.MAX .EQ 30 30 sec.
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPSktPtr .EQ ZPBIN+2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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 Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2019-10-03 06:25:27 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-09 16:36:24 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
.DA CS.HOOK
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
|
|
|
|
L.Socket .DA Socket
|
|
|
|
|
L.MSG.TCPWAIT .DA MSG.TCPWAIT
|
|
|
|
|
L.MSG.INITOK .DA MSG.INITOK
|
|
|
|
|
L.MSG.TCPIPERR .DA MSG.TCPIPERR
|
|
|
|
|
L.MSG.SKTERR .DA MSG.SKTERR
|
|
|
|
|
L.MSG.ABORT .DA MSG.ABORT
|
|
|
|
|
L.MSG.INCOMING .DA MSG.INCOMING
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.DA 0
|
2016-12-09 16:36:24 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
|
|
|
|
>SYSCALL LoadLibYA
|
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS)
|
2016-12-09 16:36:24 +00:00
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
2020-02-28 07:21:46 +00:00
|
|
|
|
sta (pPS)
|
2016-12-09 16:36:24 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN jsr Init.Timeout
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.TCPWAIT
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-12-09 16:36:24 +00:00
|
|
|
|
.1 >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
|
|
|
|
bmi CS.RUN.INIT
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2016-12-09 16:36:24 +00:00
|
|
|
|
jsr Wait.Timeout
|
|
|
|
|
bcc .1
|
|
|
|
|
.99 >LDYA L.MSG.TCPIPERR
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2016-12-09 16:36:24 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
CS.RUN.INIT ldx #3
|
|
|
|
|
ldy #S.IPCFG.IP+3
|
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
|
|
|
|
sta Socket.Src.Addr,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2018-09-18 06:28:51 +00:00
|
|
|
|
>PUSHW L.Socket
|
2017-02-15 21:46:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.New
|
2016-12-09 16:36:24 +00:00
|
|
|
|
bcs .9
|
2018-09-17 15:42:38 +00:00
|
|
|
|
|
|
|
|
|
>STA.G hSocket
|
2016-12-09 16:36:24 +00:00
|
|
|
|
>LDYA L.MSG.INITOK
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-12-09 16:36:24 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.11 >SLEEP
|
2016-12-09 16:36:24 +00:00
|
|
|
|
ldy #bCTRLC
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .99
|
|
|
|
|
bra .11
|
|
|
|
|
ldy #hSocket
|
|
|
|
|
lda (pData),y
|
2017-03-07 16:40:32 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.AcceptA
|
2016-12-09 16:36:24 +00:00
|
|
|
|
bcs .11
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GETA
|
|
|
|
|
>STYA ZPSktPtr
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.SOCKET.DST.ADDR+3
|
|
|
|
|
.2 >PUSHB (ZPSktPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
>LDYA L.MSG.INCOMING
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-12-09 16:36:24 +00:00
|
|
|
|
bra .11
|
|
|
|
|
.9 >LDYA L.MSG.SKTERR
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2016-12-09 16:36:24 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
.99 >LDYA L.MSG.ABORT
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-12-09 16:36:24 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .1 is it a TIMER event?
|
|
|
|
|
|
|
|
|
|
asl One second ?
|
|
|
|
|
bpl .9
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
sec do not discard TIMER event
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 bit #S.EVT.F.KEY is it a KEY event?
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
|
ldy #bCTRLC
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT ldy #hSocket
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
|
|
|
|
|
lda hLIBTCPIP
|
|
|
|
|
>SYSCALL UnloadLibA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.HOOK
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
ldy #bCTRLC
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIBTCPIP >PSTR "libtcpip.o"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.TCPWAIT .AZ "NFSD:Waiting for TCP/IP initializing...\n"
|
|
|
|
|
MSG.INITOK .AZ "NFSD:Init Ok, Listening.\n"
|
|
|
|
|
MSG.TCPIPERR .AZ "NFSD:TCP/IP Not initialized properly\n"
|
|
|
|
|
MSG.SKTERR .AZ "NFSD:Listen Error\n"
|
|
|
|
|
MSG.ABORT .AZ "NFSD:User Aborted\n"
|
|
|
|
|
MSG.INCOMING .AZ "NFSD:Incoming Connection From : %d.%d.%d.%d\n"
|
2016-12-09 16:36:24 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
*--------------------------------------
|
2018-09-28 15:24:44 +00:00
|
|
|
|
Socket .DA #S.SOCKET.T.DGRAM
|
|
|
|
|
.DA #S.SOCKET.O.ACCEPTCONN
|
|
|
|
|
.DA #S.SOCKET.TCP.S.LISTEN
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.BS 1
|
2016-12-09 16:36:24 +00:00
|
|
|
|
Socket.Src.Addr .BS 4
|
|
|
|
|
Socket.Src.Port .DA 2049
|
|
|
|
|
Socket.Dst.Addr .BS 4
|
|
|
|
|
Socket.Dst.Port .BS 2
|
|
|
|
|
.BS 16
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
bCTRLC .BS 1
|
|
|
|
|
hSocket .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SBIN/NFSD.S
|
2016-12-09 16:36:24 +00:00
|
|
|
|
ASM
|