Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-06-19 17:20:59 +02:00
parent 146a336816
commit 13ee515b69
2 changed files with 231 additions and 60 deletions

Binary file not shown.

View File

@ -13,6 +13,7 @@ NEW
TIMEOUT.MAX .EQ 200 20 sec. TIMEOUT.MAX .EQ 200 20 sec.
BUFSIZE .EQ 1024 BUFSIZE .EQ 1024
MSGSIZE .EQ 240 MSGSIZE .EQ 240
USRSIZE .EQ 128
*-------------------------------------- *--------------------------------------
* https://tools.ietf.org/html/rfc2812#section-3.3 * https://tools.ietf.org/html/rfc2812#section-3.3
*-------------------------------------- *--------------------------------------
@ -25,9 +26,15 @@ ZPReqLen .BS 2
hReq .BS 1 hReq .BS 1
hSocket .BS 1 hSocket .BS 1
ZPUsrBufPtr .BS 2
hUsrBuf .BS 1
ZPMsgBufPtr .BS 2 ZPMsgBufPtr .BS 2
hMsgBuf .BS 1 hMsgBuf .BS 1
MsgPtr .BS 1
TextPtr .BS 1
TextLen .BS 1
bEscMode .BS 1
ZPRepPtr .BS 2 ZPRepPtr .BS 2
hRep .BS 1 hRep .BS 1
@ -67,12 +74,19 @@ L.MSG.SKTOK .DA MSG.SKTOK
L.MSG.SKTERR .DA MSG.SKTERR L.MSG.SKTERR .DA MSG.SKTERR
L.MSG.USER .DA MSG.USER L.MSG.USER .DA MSG.USER
L.MSG.TOPBAR .DA MSG.TOPBAR L.MSG.TOPBAR .DA MSG.TOPBAR
L.MSG.STATUSBAR .DA MSG.STATUSBAR
L.IRC.USER .DA IRC.USER L.IRC.USER .DA IRC.USER
L.IRC.JOIN .DA IRC.JOIN L.IRC.JOIN .DA IRC.JOIN
L.IRC.JOINKEY .DA IRC.JOINKEY L.IRC.JOINKEY .DA IRC.JOINKEY
L.SEQ.INIT .DA SEQ.INIT L.SEQ.INIT .DA SEQ.INIT
L.SEQ.BAR .DA SEQ.BAR L.SEQ.BAR .DA SEQ.BAR
L.SEQ.PRINTMSG .DA SEQ.PRINTMSG
L.SEQ.TXTCLR .DA SEQ.TXTCLR
L.SEQ.RESET .DA SEQ.RESET L.SEQ.RESET .DA SEQ.RESET
J.ESC .DA CS.RUN.CHARIN.LEFT
.DA CS.RUN.CHARIN.DOWN
.DA CS.RUN.CHARIN.UP
.DA CS.RUN.CHARIN.RIGHT
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT >LDYA L.LIBTCPIP CS.INIT >LDYA L.LIBTCPIP
@ -82,7 +96,20 @@ CS.INIT >LDYA L.LIBTCPIP
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ? CS.RUN jsr CS.RUN.GETBUF
bcs .99
jsr CS.RUN.SCRSETUP
bcs .99
jsr CS.RUN.PRINTMSG
lda #0
sec
.99 rts
>LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
>STYA ZPIPCfgPtr >STYA ZPIPCfgPtr
lda (ZPIPCfgPtr) Configured ? lda (ZPIPCfgPtr) Configured ?
bmi CS.RUN.IPOK bmi CS.RUN.IPOK
@ -199,28 +226,12 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
>PUSHBI 0 >PUSHBI 0
>SYSCALL PrintF >SYSCALL PrintF
>LDYAI BUFSIZE
>SYSCALL GetMem
bcs .99
stx hRep
>STYA ZPRepPtr
>LDYAI MSGSIZE
>SYSCALL GetMem
bcs .99
stx hMsgBuf
>STYA ZPMsgBufPtr
jsr CS.RUN.SCRSETUP
bcs .99
jsr CS.RUN.USER jsr CS.RUN.USER
bcs .99 bcs .99
jsr CS.RUN.JOIN jsr CS.RUN.JOIN
bcs .99 bcs .99
CS.RUN.LOOP >SLEEP CS.RUN.LOOP >SLEEP
lda hSocket lda hSocket
@ -260,10 +271,46 @@ CS.RUN.ERR php
plp plp
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.GETBUF >LDYAI BUFSIZE
>SYSCALL GetMem
bcs .9
stx hRep
>STYA ZPRepPtr
>LDYAI USRSIZE
>SYSCALL GetMem
bcs .9
stx hUsrBuf
>STYA ZPUsrBufPtr
lda #0
sta (ZPUsrBufPtr)
>LDYAI MSGSIZE
>SYSCALL GetMem
bcs .9
stx hMsgBuf
>STYA ZPMsgBufPtr
.9 rts
*--------------------------------------
CS.RUN.SCRSETUP >PUSHW L.SEQ.INIT CS.RUN.SCRSETUP >PUSHW L.SEQ.INIT
>PUSHBI 0 >PUSHBI 0
>SYSCALL PrintF >SYSCALL PrintF
bcs .9
jsr CS.RUN.TOPUPDATE
bcs .9
>DEBUG
jsr CS.RUN.STATUSPDATE
bcs .9
>DEBUG
jsr CS.RUN.TXTCLR
>DEBUG
.9 rts
*--------------------------------------
CS.RUN.TOPUPDATE
>PUSHW ZPMsgBufPtr >PUSHW ZPMsgBufPtr
>PUSHW L.MSG.TOPBAR >PUSHW L.MSG.TOPBAR
>PUSHB #K.VER >PUSHB #K.VER
@ -281,18 +328,55 @@ CS.RUN.SCRSETUP >PUSHW L.SEQ.INIT
>SYSCALL ArgV >SYSCALL ArgV
>PUSHYA >PUSHYA
lda #4 >PUSHBI 8
>SYSCALL ArgV
>PUSHYA
>PUSHBI 10
>SYSCALL SPrintF >SYSCALL SPrintF
>PUSHW L.SEQ.BAR >PUSHW L.SEQ.BAR
>PUSHW ZPMsgBufPtr >PUSHW ZPMsgBufPtr
>PUSHBI 2 >PUSHBI 2
>SYSCALL PrintF >SYSCALL PrintF
>DEBUG
rts
*--------------------------------------
CS.RUN.PRINTMSG >PUSHW L.SEQ.PRINTMSG
lda #3
>SYSCALL ArgV
>PUSHYA
lda #1
>SYSCALL ArgV
>PUSHYA
>PUSHBI 4
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.STATUSPDATE
>PUSHW ZPMsgBufPtr
>PUSHW L.MSG.STATUSBAR
lda #4
>SYSCALL ArgV
>PUSHYA
>PUSHW ZPUsrBufPtr
>PUSHBI 4
>SYSCALL SPrintF
>PUSHW L.SEQ.BAR
>PUSHW ZPMsgBufPtr
>PUSHBI 2
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.TXTCLR lda #0
sta (pData)
stz TextPtr
stz TextLen
stz bEscMode
>PUSHW L.SEQ.TXTCLR
>PUSHBI 0
>SYSCALL PrintF
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.USER >PUSHW ZPRepPtr CS.RUN.USER >PUSHW ZPRepPtr
@ -377,7 +461,85 @@ CS.RUN.SEND >PUSHYA
>LIBCALL hLIBTCPIP,LIBTCPIP.Send >LIBCALL hLIBTCPIP,LIBTCPIP.Send
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.CHARIN CS.RUN.CHARIN bit bEscMode
bpl .4
cmp #'['
beq .9
stz bEscMode
ldx #EscChars.Cnt-1
.1 cmp EscChars,x
beq .2
dex
bpl .1
.9 rts
.2 txa
asl
tax
jmp (J.ESC,x)
.4 cmp #C.ESC
bne .5
sec
ror bEscMode
clc
rts
.5 cmp #C.SPACE
bcc CS.RUN.CHARIN.CTRL
cmp #C.DEL
bne CS.RUN.CHARIN.INS
lda TextLen
beq .9
lda TextPtr
beq .9
lda #C.BS
>SYSCALL PutChar
jmp CS.RUN.CHARIN.DEL
*--------------------------------------
CS.RUN.CHARIN.INS
CS.RUN.CHARIN.CTRL
clc
rts
CS.RUN.CHARIN.LEFT
lda TextPtr
beq .9
dec TextPtr
lda #C.BS
>SYSCALL PutChar
.9 rts
CS.RUN.CHARIN.DOWN
CS.RUN.CHARIN.UP
clc
rts
CS.RUN.CHARIN.RIGHT
lda TextPtr
cmp TextLen
beq .9
inc
sta TextPtr
lda #C.FS
>SYSCALL PutChar
.9 rts
*--------------------------------------
CS.RUN.CHARIN.DEL
clc clc
rts rts
*-------------------------------------- *--------------------------------------
@ -418,17 +580,25 @@ MSG.SKTKO .AZ "Failed to Open Socket."
MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n" MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n"
MSG.SKTERR .AZ "Socket Error : $%h\r\n" MSG.SKTERR .AZ "Socket Error : $%h\r\n"
MSG.USER .AZ "User interrupt." MSG.USER .AZ "User interrupt."
MSG.TOPBAR .AZ "A2osX IRC %d.%d: %s:%s %s@%s" MSG.TOPBAR .AZ "A2osX IRC %d.%d %s:%s %s"
MSG.STATUSBAR .AZ "\e[19;1H%s:%s"
*--------------------------------------
EscChars .AS 'DBAC'
EscChars.Cnt .EQ *-EscChars
EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
*-------------------------------------- *--------------------------------------
IRC.MSG .AZ "PING" IRC.MSG .AZ "PING"
IRC.NOIDENT .AZ "No Ident response"
*-------------------------------------- *--------------------------------------
IRC.USER .AZ "USER %s 0 * :%s" IRC.USER .AZ "USER %s 0 * :%s"
IRC.JOIN .AZ "JOIN %s" IRC.JOIN .AZ "JOIN %s"
IRC.JOINKEY .AZ "JOIN %s %s" IRC.JOINKEY .AZ "JOIN %s %s"
IRC.PRIVMSG .AZ "PRIVMSG %s %s" IRC.PRIVMSG .AZ "PRIVMSG %s :%s"
*-------------------------------------- *--------------------------------------
SEQ.INIT .AZ "\ec\e(B\e)0\e[?7l\e[2;19r" SEQ.INIT .AZ "\ec\e(B\e)0\e[?7l\e[2;19r"
SEQ.BAR .AZ "\e[7m\e[37;40m%80s\e[0m" SEQ.BAR .AZ "\e7\e[7m\e[37;40m%80s\e[0m\e8"
SEQ.PRINTMSG .AZ "\e7\r\n\e[18;1H\e[7m%s:\e[0m%s\e8"
SEQ.TXTCLR .AZ "\e[20;1H\e[K\r\n\e[K\r\n\e[K\e[20;1H"
SEQ.RESET .AZ "\ec" SEQ.RESET .AZ "\ec"
*-------------------------------------- *--------------------------------------
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF SA.LOCAL .DA #AF.INET S.SOCKADDR.AF
@ -444,6 +614,7 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START
TextBuf .BS 240
DS.END DS.END
.ED .ED
*-------------------------------------- *--------------------------------------