Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-06-24 08:12:43 +02:00
parent 4f94890429
commit 18bd2b644f
2 changed files with 83 additions and 58 deletions

Binary file not shown.

View File

@ -34,8 +34,9 @@ TextPtr .BS 1
TextLen .BS 1
bEscMode .BS 1
ZPMsgPtr .BS 2
hMsg .BS 1
ZPMsgPtr .BS 2
ZPMsgBodyPtr .BS 2
TimeOut .BS 1
ZS.END
@ -80,6 +81,7 @@ L.IRC.NICK .DA IRC.NICK
L.IRC.USER .DA IRC.USER
L.IRC.JOIN .DA IRC.JOIN
L.IRC.JOINKEY .DA IRC.JOINKEY
L.IRC.PONG .DA IRC.PONG
L.SEQ.INIT .DA SEQ.INIT
L.SEQ.BAR .DA SEQ.BAR
L.SEQ.PRINTMSG .DA SEQ.PRINTMSG
@ -99,6 +101,7 @@ CS.INIT >LDYA L.LIBTCPIP
.9 rts
*--------------------------------------
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
>STYA ZPIPCfgPtr
lda (ZPIPCfgPtr) Configured ?
bmi CS.RUN.IPOK
@ -107,7 +110,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
>SYSCALL PutS
lda #E.SYN
sec
rts
.99 rts
CS.RUN.IPOK ldy #S.PS.ARGC
lda (pPS),y
@ -221,6 +224,9 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
jsr CS.RUN.GETBUF
bcs .99
jsr CS.RUN.SCRSETUP
bcs .99
jsr CS.RUN.NICK
bcs .99
@ -233,10 +239,7 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
jsr CS.RUN.JOIN
bcs .99
jsr CS.RUN.SCRSETUP
bcs .99
CS.RUN.LOOP >SLEEP
>PUSHWI MSGSIZE
@ -311,6 +314,9 @@ CS.RUN.GETBUF >LDYAI MSGSIZE
bcs .9
stx hUsrBuf
>STYA ZPUsrBufPtr
lda #0
sta (ZPUsrBufPtr)
>LDYAI 256
>SYSCALL GetMem
@ -358,21 +364,18 @@ CS.RUN.TOPUPDATE
>SYSCALL SPrintF
>PUSHW L.SEQ.BAR
>PUSHBI 1
>PUSHW ZPLineBufPtr
>PUSHBI 2
>PUSHBI 3
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.PRINTMSG >PUSHW L.SEQ.PRINTMSG
lda #3
>SYSCALL ArgV
>PUSHYA
lda #1
>SYSCALL ArgV
>PUSHYA
>PUSHW ZPMsgPtr
>PUSHW ZPMsgBodyPtr
>PUSHBI 4
>SYSCALL PrintF
rts
@ -389,8 +392,9 @@ CS.RUN.STATUSPDATE
>SYSCALL SPrintF
>PUSHW L.SEQ.BAR
>PUSHBI 21
>PUSHW ZPLineBufPtr
>PUSHBI 2
>PUSHBI 3
>SYSCALL PrintF
rts
*--------------------------------------
@ -405,8 +409,9 @@ CS.RUN.TXTCLR lda #0
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.NICK >LDYA L.MSG.NICK
>SYSCALL PutS
CS.RUN.NICK >PUSHW L.MSG.NICK
>PUSHBI 0
>SYSCALL printf
>PUSHB hFile
>PUSHW L.IRC.NICK
@ -424,16 +429,10 @@ CS.RUN.NICK >LDYA L.MSG.NICK
>PUSHW ZPMsgPtr
lda hFile
>SYSCALL fgets
bcc .2
tay
beq .1 No Data
.9 rts
.2
>LDYA ZPMsgPtr
>SYSCALL puts
bcs .9
jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
ldx #$ff
dey
@ -449,7 +448,7 @@ CS.RUN.NICK >LDYA L.MSG.NICK
bra .1
.8 clc
rts
.9 rts
*--------------------------------------
CS.RUN.USER >LDYA L.MSG.USER
>SYSCALL PutS
@ -474,16 +473,10 @@ CS.RUN.USER >LDYA L.MSG.USER
>PUSHW ZPMsgPtr
lda hFile
>SYSCALL fgets
bcc .2
tay
beq .1 No Frame
bcs .9
.9 rts
.2
>LDYA ZPMsgPtr
>SYSCALL puts
jsr CS.RUN.SKIPPFX
.2 jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
ldx #$ff
dey
@ -499,7 +492,7 @@ CS.RUN.USER >LDYA L.MSG.USER
bra .1
.8 clc
rts
.9 rts
*--------------------------------------
CS.RUN.JOIN >LDYA L.MSG.JOIN
>SYSCALL PutS
@ -538,15 +531,10 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
>PUSHW ZPMsgPtr
lda hFile
>SYSCALL fgets
bcc .4
tay
beq .3 No Frame
.9 rts
bcs .9
.4 >LDYA ZPMsgPtr
>SYSCALL puts
jsr CS.RUN.SKIPPFX
.4 jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
ldx #$ff
dey
@ -562,14 +550,40 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
bra .3
.8 clc
rts
.9 rts
*--------------------------------------
CS.RUN.REQ
CS.RUN.REQ jsr CS.RUN.SKIPPFX
clc
rts
ldx #$ff
dey
.1 inx
iny
lda IRC.MSG.PING,x
beq .8
cmp (ZPMsgPtr),y
beq .1
>PUSHB hFile
>PUSHW L.IRC.PONG
>PUSHW ZPMsgBodyPtr
>PUSHBI 2
>SYSCALL FPrintF
bcs .9
.8 clc
.9 rts
*--------------------------------------
CS.RUN.SKIPPFX ldy #0
CS.RUN.SKIPPFX lda ZPMsgPtr
sta ZPMsgBodyPtr
lda ZPMsgPtr+1
sta ZPMsgBodyPtr+1
ldy #0
lda (ZPMsgPtr)
cmp #':'
@ -577,10 +591,21 @@ CS.RUN.SKIPPFX ldy #0
.1 iny
lda (ZPMsgPtr),y
beq .8
cmp #C.SPACE
bne .1
lda #0
sta (ZPMsgPtr),y
iny
tya
clc
adc ZPMsgBodyPtr
sta ZPMsgBodyPtr
bcc .8
inc ZPMsgBodyPtr+1
.8 clc
rts
@ -708,20 +733,20 @@ MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
MSG.SKTKO .AZ "Failed to Open Socket."
MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n"
MSG.SKTERR .AZ "Socket Error : $%h\r\n"
MSG.NICK .AZ "Registering User..."
MSG.NICK .AZ "\e[2;1HRegistering User..."
MSG.USER .AZ "Connecting User..."
MSG.JOIN .AZ "Joining Channel..."
MSG.TOPBAR .AZ "A2osX IRC %d.%d %s:%s %s"
MSG.STATUSBAR .AZ "\e[19;1H%s:%s"
MSG.STATUSBAR .AZ "%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.REP.NOIDENT .AZ "NOTICE * :*** No Ident response"
IRC.REP.001 .AZ "001"
IRC.REP.JOIN .AZ "JOIN"
IRC.MSG.PING .AZ "PING"
*--------------------------------------
IRC.NICK .AZ "NICK %s\r\n"
IRC.USER .AZ "USER %s 0 * :%s\r\n"
@ -730,10 +755,10 @@ IRC.JOINKEY .AZ "JOIN %s %s\r\n"
IRC.PONG .AZ "PONG %s\r\n"
IRC.PRIVMSG .AZ "PRIVMSG %s :%s\r\n"
*--------------------------------------
SEQ.INIT .AZ "\ec\e(B\e)0\e[?7l\e[2;19r"
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.INIT .AZ "\ec\e(B\e)0\e[?7l\e[2;20r\e[22;1H"
SEQ.BAR .AZ "\e7\e[%d;1H\e[7m\e[37;40m%80s\e[0m\e8"
SEQ.PRINTMSG .AZ "\e7\r\n\e[20;1H\e[7m%s:\e[0m%s\r\n\e8"
SEQ.TXTCLR .AZ "\e[22;1H\e[K\r\n\e[K\r\n\e[K\e[22;1H"
SEQ.RESET .AZ "\ec"
*--------------------------------------
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF