Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-06-24 16:39:11 +02:00
parent 18bd2b644f
commit de6e7d977c
3 changed files with 248 additions and 92 deletions

Binary file not shown.

View File

@ -13,13 +13,14 @@ NEW
*--------------------------------------
TIMEOUT.MAX .EQ 200 20 sec.
MSGSIZE .EQ 1024
TEXTMAX .EQ 240
*--------------------------------------
* https://tools.ietf.org/html/rfc2812#section-3.3
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPIPCfgPtr .BS 2
ZPPtr1 .BS 2
hSocket .BS 1
hFile .BS 1
@ -27,18 +28,24 @@ hFile .BS 1
ZPUsrBufPtr .BS 2
hUsrBuf .BS 1
ZPLineBufPtr .BS 2
hLineBuf .BS 1
ZPLineBufPtr .BS 2
TextPtr .BS 1
TextLen .BS 1
hText .BS 1
ZPTextPtr .BS 2
bEscMode .BS 1
hMsg .BS 1
ZPMsgPtr .BS 2
ZPMsgBodyPtr .BS 2
TimeOut .BS 1
ZPMsgPtr .BS 2
ZPMsgPfxPtr .BS 2
ZPMsgCmdPtr .BS 2
ZPMsgArgPtr .BS 2
ZPMsgExtPtr .BS 2
ZS.END
.ED
*--------------------------------------
@ -84,9 +91,14 @@ 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
L.SEQ.TXTCLR .DA SEQ.TXTCLR
L.SEQ.PRIVMSG .DA SEQ.PRIVMSG
L.SEQ.DUMPMSG .DA SEQ.DUMPMSG
L.SEQ.RESET .DA SEQ.RESET
L.IRC.CMDS .DA IRC.CMDS
J.IRC.CMDS .DA CS.RUN.CMD.PING
.DA CS.RUN.CMD.PRIVMSG
.DA CS.RUN.CMD.MODE
J.ESC .DA CS.RUN.CHARIN.LEFT
.DA CS.RUN.CHARIN.DOWN
.DA CS.RUN.CHARIN.UP
@ -102,8 +114,8 @@ CS.INIT >LDYA L.LIBTCPIP
*--------------------------------------
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
>STYA ZPIPCfgPtr
lda (ZPIPCfgPtr) Configured ?
>STYA ZPPtr1
lda (ZPPtr1) Configured ?
bmi CS.RUN.IPOK
>LDYA L.MSG.IPKO
@ -120,7 +132,7 @@ CS.RUN.IPOK ldy #S.PS.ARGC
ldy #S.IPCFG.IP+3
ldx #3
.1 lda (ZPIPCfgPtr),y
.1 lda (ZPPtr1),y
sta SA.LOCAL+S.SOCKADDR.ADDR,x
dey
dex
@ -242,15 +254,17 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
CS.RUN.LOOP >SLEEP
lda hFile
>SYSCALL feof
bcs .9
tay
bne .2
>PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hFile
>SYSCALL fgets
bcc .1
tay
beq .2 NO DATA
bra .9
bcs .9
.1 jsr CS.RUN.REQ
bcs .9
@ -259,7 +273,7 @@ CS.RUN.LOOP >SLEEP
lda (pPS),y
>SYSCALL feof
bcs CS.RUN.ERR
bcs .9
tay
bne CS.RUN.LOOP EOF = true, no char from STDIN
@ -269,8 +283,7 @@ CS.RUN.LOOP >SLEEP
jsr CS.RUN.CHARIN
bcc CS.RUN.LOOP
.9
CS.RUN.ERR php
.9 php
pha
>PUSHW L.SEQ.RESET
>PUSHBI 0
@ -303,13 +316,7 @@ CS.RUN.MkNod >PUSHEA.G NodBuf
.9 rts
*--------------------------------------
CS.RUN.GETBUF >LDYAI MSGSIZE
>SYSCALL GetMem
bcs .9
stx hMsg
>STYA ZPMsgPtr
>LDYAI 256
CS.RUN.GETBUF >LDYAI 256
>SYSCALL GetMem
bcs .9
stx hUsrBuf
@ -318,6 +325,12 @@ CS.RUN.GETBUF >LDYAI MSGSIZE
lda #0
sta (ZPUsrBufPtr)
>LDYAI 256
>SYSCALL GetMem
bcs .9
stx hText
>STYA ZPTextPtr
>LDYAI 256
>SYSCALL GetMem
bcs .9
@ -371,15 +384,6 @@ CS.RUN.TOPUPDATE
rts
*--------------------------------------
CS.RUN.PRINTMSG >PUSHW L.SEQ.PRINTMSG
>PUSHW ZPMsgPtr
>PUSHW ZPMsgBodyPtr
>PUSHBI 4
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.STATUSPDATE
>PUSHW ZPLineBufPtr
>PUSHW L.MSG.STATUSBAR
@ -399,7 +403,8 @@ CS.RUN.STATUSPDATE
rts
*--------------------------------------
CS.RUN.TXTCLR lda #0
sta (pData)
sta (ZPTextPtr)
stz TextPtr
stz TextLen
stz bEscMode
@ -431,8 +436,8 @@ CS.RUN.NICK >PUSHW L.MSG.NICK
>SYSCALL fgets
bcs .9
jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
jsr CS.RUN.SPLITMSG
jsr CS.RUN.DUMPMSG
ldx #$ff
dey
@ -442,7 +447,7 @@ CS.RUN.NICK >PUSHW L.MSG.NICK
lda IRC.REP.NOIDENT,x
beq .8
cmp (ZPMsgPtr),y
cmp (ZPMsgCmdPtr),y
beq .3
bra .1
@ -475,8 +480,8 @@ CS.RUN.USER >LDYA L.MSG.USER
>SYSCALL fgets
bcs .9
.2 jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
.2 jsr CS.RUN.SPLITMSG
jsr CS.RUN.DUMPMSG
ldx #$ff
dey
@ -486,7 +491,7 @@ CS.RUN.USER >LDYA L.MSG.USER
lda IRC.REP.001,x
beq .8
cmp (ZPMsgPtr),y
cmp (ZPMsgCmdPtr),y
beq .3
bra .1
@ -533,8 +538,8 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
>SYSCALL fgets
bcs .9
.4 jsr CS.RUN.SKIPPFX
jsr CS.RUN.PRINTMSG
.4 jsr CS.RUN.SPLITMSG
jsr CS.RUN.DUMPMSG
ldx #$ff
dey
@ -544,7 +549,7 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
lda IRC.REP.JOIN,x
beq .8
cmp (ZPMsgPtr),y
cmp (ZPMsgCmdPtr),y
beq .5
bra .3
@ -552,63 +557,183 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
.8 clc
.9 rts
*--------------------------------------
CS.RUN.REQ jsr CS.RUN.SKIPPFX
ldx #$ff
dey
CS.RUN.REQ jsr CS.RUN.SPLITMSG
bcs .8
.1 inx
iny
lda IRC.MSG.PING,x
>LDYA L.IRC.CMDS
>STYA ZPPtr1
ldx #0
.1 lda (ZPPtr1)
beq .8
cmp (ZPMsgPtr),y
beq .1
ldy #$ff
>PUSHB hFile
>PUSHW L.IRC.PONG
>PUSHW ZPMsgBodyPtr
>PUSHBI 2
>SYSCALL FPrintF
bcs .9
.2 iny
lda (ZPPtr1),y
cmp (ZPMsgCmdPtr),y
bne .3
ora #0
bne .2
jmp (J.IRC.CMDS,x)
.3 ora #0
beq .5
.4 iny
lda (ZPPtr1),y
bne .4
.5 inx
inx
tya
sec
adc ZPPtr1
sta ZPPtr1
bcc .1
inc ZPPtr1+1
bra .1
.8 clc
.9 rts
*--------------------------------------
CS.RUN.SKIPPFX lda ZPMsgPtr
sta ZPMsgBodyPtr
lda ZPMsgPtr+1
sta ZPMsgBodyPtr+1
CS.RUN.CMD.PING >PUSHB hFile
>PUSHW L.IRC.PONG
>PUSHW ZPMsgArgPtr
>PUSHBI 2
>SYSCALL FPrintF
rts
*--------------------------------------
CS.RUN.CMD.PRIVMSG
>PUSHW L.SEQ.PRIVMSG
>PUSHW ZPMsgArgPtr
>PUSHW ZPMsgExtPtr
>PUSHBI 4
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.CMD.MODE
clc
rts
*--------------------------------------
CS.RUN.SPLITMSG lda ZPMsgPtr
stz ZPMsgPfxPtr+1
stz ZPMsgCmdPtr+1
stz ZPMsgArgPtr+1
stz ZPMsgExtPtr+1
ldy #0
lda (ZPMsgPtr)
cmp #':'
bne .8
bne .3
.1 iny
lda (ZPMsgPtr),y
beq .8
beq .9
cmp #C.SPACE
bne .1
lda #0
sta (ZPMsgPtr),y
iny
tya
lda ZPMsgPtr
clc
adc ZPMsgBodyPtr
sta ZPMsgBodyPtr
bcc .8
adc #1
sta ZPMsgPfxPtr
lda ZPMsgPtr+1
adc #0
sta ZPMsgPfxPtr+1
.2 iny
lda (ZPMsgPtr),y
beq .4
inc ZPMsgBodyPtr+1
.3 cmp #C.SPACE
bne .2
.8 clc
rts
lda #0
sta (ZPMsgPtr),y
inc
.4 php
tya
sec
adc ZPMsgPtr
sta ZPMsgCmdPtr
lda #0
adc ZPMsgPtr+1
sta ZPMsgCmdPtr+1
plp
beq .8
iny
lda (ZPMsgPtr),y
cmp #':'
beq .8
.6 iny
lda (ZPMsgPtr),y
beq .7
cmp #C.SPACE
bne .6
lda #0
sta (ZPMsgPtr),y
inc
.7 php
tya
adc ZPMsgPtr
sta ZPMsgArgPtr
lda #0
adc ZPMsgPtr+1
sta ZPMsgArgPtr+1
plp
beq .80
.8 iny
tya
adc ZPMsgPtr
sta ZPMsgExtPtr
lda #0
adc ZPMsgPtr+1
sta ZPMsgExtPtr+1
.80 clc
rts
.9 sec
rts
*--------------------------------------
CS.RUN.DUMPMSG >PUSHW L.SEQ.DUMPMSG
>PUSHW ZPMsgPfxPtr
>PUSHW ZPMsgCmdPtr
>PUSHW ZPMsgArgPtr
>PUSHW ZPMsgExtPtr
>PUSHBI 8
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.CHARIN bit bEscMode
bpl .4
@ -659,11 +784,44 @@ CS.RUN.CHARIN bit bEscMode
jmp CS.RUN.CHARIN.DEL
*--------------------------------------
CS.RUN.CHARIN.INS
ldy TextLen
cpy #TEXTMAX
beq .8
ldy TextPtr
sta (ZPTextPtr),y
iny
sty TextPtr
pha
lda #0
sta (ZPTextPtr),y
pla
>SYSCALL PutChar
rts
.8 clc
rts
CS.RUN.CHARIN.CTRL
clc
rts
cmp #C.CR
bne .8
>PUSHW L.SEQ.PRIVMSG
lda #4 channel
>SYSCALL ArgV
>PUSHYA
>PUSHW ZPTextPtr
>PUSHBI 4
>SYSCALL PrintF
bcs .9
jmp CS.RUN.TXTCLR
.8 clc
.9 rts
CS.RUN.CHARIN.LEFT
lda TextPtr
@ -710,7 +868,7 @@ CS.QUIT lda hFile
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
.2 lda hMsg
.2 lda hText
beq .3
>SYSCALL FreeMem
@ -746,7 +904,11 @@ EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
IRC.REP.NOIDENT .AZ "NOTICE * :*** No Ident response"
IRC.REP.001 .AZ "001"
IRC.REP.JOIN .AZ "JOIN"
IRC.MSG.PING .AZ "PING"
*--------------------------------------
IRC.CMDS .AZ "PING"
.AZ "PRIVMSG"
.AZ "MODE"
.DA #0
*--------------------------------------
IRC.NICK .AZ "NICK %s\r\n"
IRC.USER .AZ "USER %s 0 * :%s\r\n"
@ -757,8 +919,9 @@ IRC.PRIVMSG .AZ "PRIVMSG %s :%s\r\n"
*--------------------------------------
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.PRIVMSG .AZ "\e7\r\n\e[20;1H\e[7m%s:\e[0m%s\r\n\e8"
SEQ.DUMPMSG .AZ "\e7\r\n\e[20;1H\e[7m:%s %s \e[0m%s %s\r\n\e8"
SEQ.RESET .AZ "\ec"
*--------------------------------------
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF
@ -776,7 +939,6 @@ NOD.Template .AZ "/dev/irc%h"
.DUMMY
.OR 0
DS.START
TxtBuf .BS 240
NodBuf .BS 11
DS.END
.ED

View File

@ -513,19 +513,13 @@ CPU.Init.6502 >PUSHWI MSG.CPU
bpl .20 (2*)
bit ZPPtr1 //c ?
bpl .3
lda IO.IIC.CLRVBLIRQ yes, clear IRQ
lda #0 wait for UP again
bmi .31
.3 dex
bne .20
bra .60
*--------------------------------------
bit ZPPtr1 //c ?
bpl .60
lda IO.IIC.CLRVBLIRQ yes, clear IRQ
.31 lda IO.IIC.CLRVBLIRQ yes, clear IRQ
bit ZPPtr1+1 Disable VBLIRQ ?
bpl .60