2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2018-07-24 16:00:24 +00:00
|
|
|
|
AUTO 4,1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF SBIN/TELNETD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2018-07-24 16:00:24 +00:00
|
|
|
|
.INB INC/ETH.I
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/LIBTCPIP.I
|
2018-10-10 15:39:22 +00:00
|
|
|
|
.INB INC/NET.TELNET.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-07 16:40:32 +00:00
|
|
|
|
CONN.MAX .EQ 16
|
2018-09-17 15:42:38 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 30 30 sec.
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPSktPtr .EQ ZPBIN+2
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.DA #S.PS.F.EVENT S.PS.F
|
|
|
|
|
.DA #0
|
2018-05-22 06:01:05 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #64 SS
|
|
|
|
|
.DA #4 ZP SS
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA CS.QUIT
|
2015-10-19 20:35:00 +00:00
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
2018-10-10 15:39:22 +00:00
|
|
|
|
L.SA.LOCAL .DA SA.LOCAL
|
2017-03-07 16:40:32 +00:00
|
|
|
|
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
|
2018-11-19 07:43:00 +00:00
|
|
|
|
L.MSG.EXECERR .DA MSG.EXECERR
|
2018-11-01 08:53:47 +00:00
|
|
|
|
L.NOD.Template .DA NOD.Template
|
|
|
|
|
L.CMD.Template .DA CMD.Template
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2018-11-12 09:22:06 +00:00
|
|
|
|
bcs .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2018-11-12 09:22:06 +00:00
|
|
|
|
.9 rts
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN jsr Init.Timeout
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.TCPWAIT
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>SYSCALL puts
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
|
|
|
|
.1 >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs .99
|
2017-03-07 16:40:32 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
|
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
|
|
|
|
bmi CS.RUN.INIT
|
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2017-03-07 16:40:32 +00:00
|
|
|
|
jsr Wait.Timeout
|
|
|
|
|
bcc .1
|
2018-05-22 06:01:05 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-03-07 16:40:32 +00:00
|
|
|
|
bcs .1
|
|
|
|
|
cmp #$03
|
|
|
|
|
bne .1
|
|
|
|
|
jmp CS.RUN.ABORT
|
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.99 pha
|
|
|
|
|
>LDYA L.MSG.TCPIPERR
|
|
|
|
|
>SYSCALL puts
|
|
|
|
|
pla
|
2017-03-07 16:40:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CS.RUN.INIT ldx #3
|
|
|
|
|
ldy #S.IPCFG.IP+3
|
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
2018-10-10 15:39:22 +00:00
|
|
|
|
sta SA.LOCAL+S.SOCKADDR.ADDR,x
|
2017-03-07 16:40:32 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>PUSHBI 0 no protocol
|
|
|
|
|
lda #S.SOCKET.T.STREAM
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
2017-03-07 16:40:32 +00:00
|
|
|
|
bcs .9
|
2018-09-17 15:42:38 +00:00
|
|
|
|
|
|
|
|
|
>STA.G hSrvSocket
|
2018-10-10 15:39:22 +00:00
|
|
|
|
pha
|
|
|
|
|
>PUSHW L.SA.LOCAL
|
|
|
|
|
pla
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G hSrvSocket
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Listen
|
|
|
|
|
bcs .9
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.INITOK
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>SYSCALL puts
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.2 >SLEEP
|
2017-03-07 16:40:32 +00:00
|
|
|
|
jsr CS.RUN.SERVER
|
|
|
|
|
bcs CS.RUN.ERR
|
2018-09-17 15:42:38 +00:00
|
|
|
|
|
|
|
|
|
* >SYSCALL GetChar
|
|
|
|
|
* bcs .2
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
* cmp #$03
|
|
|
|
|
* beq CS.RUN.ABORT
|
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
bra .2
|
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.9 pha
|
|
|
|
|
>LDYA L.MSG.SKTERR
|
|
|
|
|
>SYSCALL puts
|
|
|
|
|
pla
|
2017-03-07 16:40:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CS.RUN.ABORT >LDYA L.MSG.ABORT
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>SYSCALL puts
|
|
|
|
|
lda #3
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.ERR sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-17 15:42:38 +00:00
|
|
|
|
CS.RUN.SERVER >LDA.G hSrvSocket
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Accept
|
2017-03-07 16:40:32 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
2018-11-19 07:43:00 +00:00
|
|
|
|
pha
|
2017-03-07 16:40:32 +00:00
|
|
|
|
ldy #hSockets
|
|
|
|
|
ldx #CONN.MAX
|
|
|
|
|
|
|
|
|
|
.1 lda (pData),y
|
2018-11-19 07:43:00 +00:00
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
bra CS.RUN.CLIENT
|
|
|
|
|
|
|
|
|
|
.2 iny
|
2017-03-07 16:40:32 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
2018-11-19 07:43:00 +00:00
|
|
|
|
pla
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2018-11-19 07:43:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CLIENT >STA.G hClientSocket
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2017-03-07 16:40:32 +00:00
|
|
|
|
>STYA ZPSktPtr
|
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
>PUSHB.G hClientSocket
|
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
ldx #3
|
2018-10-10 15:39:22 +00:00
|
|
|
|
ldy #S.SOCKET.REM.ADDR+3
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
|
|
|
|
.3 >PUSHB (ZPSktPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>PUSHBI 5
|
2017-03-07 16:40:32 +00:00
|
|
|
|
>LDYA L.MSG.INCOMING
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>PUSHB.G hClientSocket
|
|
|
|
|
>PUSHBI 1
|
2018-11-01 08:53:47 +00:00
|
|
|
|
>PUSHW L.NOD.Template
|
|
|
|
|
>LEA.G NodBuf
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>SYSCALL sprintf
|
2017-03-14 07:32:31 +00:00
|
|
|
|
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>PUSHB.G hClientSocket
|
|
|
|
|
>PUSHW 0
|
2018-11-01 08:53:47 +00:00
|
|
|
|
>LEA.G NodBuf
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>SYSCALL mknod
|
2018-11-01 08:53:47 +00:00
|
|
|
|
bcs .9
|
2018-11-19 07:43:00 +00:00
|
|
|
|
>STA.G hClientFile
|
2018-11-01 08:53:47 +00:00
|
|
|
|
|
|
|
|
|
>PUSHEA.G NodBuf
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>PUSHW L.CMD.Template
|
|
|
|
|
>LEA.G CmdBuf
|
|
|
|
|
>SYSCALL sprintf
|
|
|
|
|
|
|
|
|
|
>LEA.G CmdBuf
|
|
|
|
|
>SYSCALL puts
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
>PUSHBI S.PS.F.DUPENV
|
|
|
|
|
>LEA.G CmdBuf
|
|
|
|
|
>SYSCALL execl
|
2018-11-19 07:43:00 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
|
|
|
|
>LDYA L.MSG.EXECERR
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
|
2017-03-23 07:32:11 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9 is it a TIMER event?
|
2017-04-07 06:31:47 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>LDA.G TimeOut
|
|
|
|
|
beq .9
|
2017-04-07 06:31:47 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-07 16:40:32 +00:00
|
|
|
|
CS.QUIT ldx #CONN.MAX
|
|
|
|
|
ldy #hSockets
|
|
|
|
|
|
|
|
|
|
.1 lda (pData),y
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
phy
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2017-03-07 16:40:32 +00:00
|
|
|
|
ply
|
|
|
|
|
plx
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
>LDA.G hSrvSocket
|
2017-03-19 21:47:54 +00:00
|
|
|
|
beq .3
|
2018-10-10 15:39:22 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.3 lda hLIBTCPIP
|
2018-11-12 09:22:06 +00:00
|
|
|
|
beq .8
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2018-11-12 09:22:06 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-12 09:22:06 +00:00
|
|
|
|
Init.Timeout lda #TIMEOUT.MAX
|
|
|
|
|
>STA.G TimeOut
|
2017-03-07 16:40:32 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
2018-11-12 09:22:06 +00:00
|
|
|
|
>LDA.G TimeOut
|
2017-03-07 16:40:32 +00:00
|
|
|
|
beq .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-17 15:42:38 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
2018-10-10 15:39:22 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip"
|
2018-09-17 15:42:38 +00:00
|
|
|
|
MSG.TCPWAIT .AZ "TELNETD:Waiting for TCP/IP initializing..."
|
|
|
|
|
MSG.INITOK .AZ "TELNETD:Init Ok, Listening."
|
|
|
|
|
MSG.TCPIPERR .AZ "TELNETD:TCP/IP Not initialized properly"
|
|
|
|
|
MSG.SKTERR .AZ "TELNETD:Listen Error."
|
|
|
|
|
MSG.ABORT .AZ "TELNETD:User Aborted."
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.INCOMING .AZ "TELNETD:Incoming Connection [SKT=%h] From : %d.%d.%d.%d\r\n"
|
2018-11-19 07:43:00 +00:00
|
|
|
|
MSG.EXECERR .AZ "TELNETD:ExecL failed $%h."
|
2018-11-01 08:53:47 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
NOD.Template .AZ "/DEV/TTY%h"
|
2018-11-19 07:43:00 +00:00
|
|
|
|
CMD.Template .AZ "${ROOT}SBIN/GETTY %s ${ROOT}SBIN/LOGIN"
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-10 15:39:22 +00:00
|
|
|
|
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF
|
|
|
|
|
.BS 1
|
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.DA TCP.PORT.TELNET
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
hSockets .BS CONN.MAX pData
|
|
|
|
|
SktIndex .BS 1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
hSrvSocket .BS 1
|
2018-09-17 15:42:38 +00:00
|
|
|
|
hClientSocket .BS 1
|
2018-11-19 07:43:00 +00:00
|
|
|
|
hClientFile .BS 1
|
2017-03-07 16:40:32 +00:00
|
|
|
|
TimeOut .BS 1
|
2018-11-01 08:53:47 +00:00
|
|
|
|
NodBuf .BS 11
|
|
|
|
|
CmdBuf .BS 65
|
2017-03-07 16:40:32 +00:00
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SBIN/TELNETD.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|