Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-06-23 08:19:11 +02:00
parent 4608eef70a
commit 6c3cea75ae
2 changed files with 84 additions and 71 deletions

Binary file not shown.

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/eth.i
.INB inc/libtcpip.i
*--------------------------------------
@ -21,6 +22,7 @@ ZS.START
ZPIPCfgPtr .BS 2
hSocket .BS 1
hFile .BS 1
ZPUsrBufPtr .BS 2
hUsrBuf .BS 1
@ -35,12 +37,6 @@ bEscMode .BS 1
ZPMsgPtr .BS 2
hMsg .BS 1
hReq .BS 1
ZPReqPtr .BS 2
hRep .BS 1
ZPRepPtr .BS 2
TimeOut .BS 1
ZS.END
.ED
@ -67,6 +63,7 @@ L.LIBTCPIP .DA LIBTCPIP
L.SA.LOCAL .DA SA.LOCAL
L.SA.REMOTE .DA SA.REMOTE
L.SA.REMOTE.AD .DA SA.REMOTE+S.SOCKADDR.ADDR
L.NOD.Template .DA NOD.Template
L.MSG.IPKO .DA MSG.IPKO
L.MSG.USAGE .DA MSG.USAGE
L.MSG.UNKNOWN .DA MSG.UNKNOWN
@ -218,6 +215,9 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
>PUSHBI 0
>SYSCALL PrintF
jsr CS.RUN.MkNod
bcs .99
jsr CS.RUN.GETBUF
bcs .99
@ -234,11 +234,14 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
jsr CS.RUN.JOIN
bcs .99
jsr CS.RUN.SCRSETUP
bcs .99
CS.RUN.LOOP >SLEEP
>PUSHW MSGSIZE
>PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hSocket
lda hFile
>SYSCALL fgets
bcc .1
tay
@ -273,6 +276,30 @@ CS.RUN.ERR php
plp
rts
*--------------------------------------
CS.RUN.MkNod >PUSHEA.G NodBuf
>PUSHW L.NOD.Template
>PUSHB hSocket
>PUSHBI 1
>SYSCALL sprintf
bcs .9
>PUSHEA.G NodBuf
>PUSHW 0
>PUSHB hSocket
>SYSCALL mknod
bcs .9
>PUSHEA.G NodBuf
>PUSHBI O.RDWR+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
sta hFile
.9 rts
*--------------------------------------
CS.RUN.GETBUF >LDYAI MSGSIZE
>SYSCALL GetMem
bcs .9
@ -381,27 +408,21 @@ CS.RUN.TXTCLR lda #0
CS.RUN.NICK >LDYA L.MSG.NICK
>SYSCALL PutS
>PUSHW ZPMsgPtr
>PUSHB hFile
>PUSHW L.IRC.NICK
lda #3 nickname
>SYSCALL ArgV
>PUSHYA
>PUSHBI 2
>SYSCALL SPrintF
bcs .9
>PUSHW ZPMsgPtr
lda hSocket
>SYSCALL fputs
>DEBUG
>SYSCALL FPrintF
bcs .9
.1 >SLEEP
>PUSHW MSGSIZE
>PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hSocket
lda hFile
>SYSCALL fgets
bcc .2
tay
@ -409,7 +430,10 @@ CS.RUN.NICK >LDYA L.MSG.NICK
.9 rts
.2 jsr CS.RUN.SKIPPFX
.2
>LDYA ZPMsgPtr
>SYSCALL puts
jsr CS.RUN.SKIPPFX
ldx #$ff
dey
@ -419,21 +443,19 @@ CS.RUN.NICK >LDYA L.MSG.NICK
lda IRC.REP.NOIDENT,x
beq .8
cmp (ZPRepPtr),y
cmp (ZPMsgPtr),y
beq .3
jsr .8
bra .1
.8
* clc
.8 clc
rts
*--------------------------------------
CS.RUN.USER >LDYA L.MSG.USER
>SYSCALL PutS
>PUSHW ZPMsgPtr
>PUSHB hFile
>PUSHW L.IRC.USER
lda #3 nickname
@ -443,19 +465,14 @@ CS.RUN.USER >LDYA L.MSG.USER
>SYSCALL ArgV
>PUSHYA
>PUSHBI 4
>SYSCALL SPrintF
bcs .9
>PUSHW ZPMsgPtr
lda hSocket
>SYSCALL fgets
>SYSCALL FPrintF
bcs .9
.1 >SLEEP
>PUSHW MSGSIZE
>PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hSocket
lda hFile
>SYSCALL fgets
bcc .2
tay
@ -463,7 +480,10 @@ CS.RUN.USER >LDYA L.MSG.USER
.9 rts
.2 jsr CS.RUN.SKIPPFX
.2
>LDYA ZPMsgPtr
>SYSCALL puts
jsr CS.RUN.SKIPPFX
ldx #$ff
dey
@ -473,22 +493,18 @@ CS.RUN.USER >LDYA L.MSG.USER
lda IRC.REP.001,x
beq .8
cmp (ZPRepPtr),y
cmp (ZPMsgPtr),y
beq .3
jsr .8
bra .1
.8 lda hRep
>SYSCALL FreeMem
* clc
.8 clc
rts
*--------------------------------------
CS.RUN.JOIN >LDYA L.MSG.JOIN
>SYSCALL PutS
>PUSHW ZPMsgPtr
>PUSHB hFile
lda #5 key
>SYSCALL ArgV
@ -513,18 +529,14 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
>PUSHYA
>PUSHBI 2
.2 >SYSCALL SPrintF
.2 >SYSCALL FPrintF
bcs .9
>PUSHW ZPMsgPtr
lda hSocket
>SYSCALL fputs
bcs .9
.3 >SLEEP
>PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hSocket
lda hFile
>SYSCALL fgets
bcc .4
tay
@ -532,12 +544,8 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
.9 rts
.4
bra .8
.4 >LDYA ZPMsgPtr
>SYSCALL puts
jsr CS.RUN.SKIPPFX
ldx #$ff
@ -548,16 +556,12 @@ CS.RUN.JOIN >LDYA L.MSG.JOIN
lda IRC.REP.JOIN,x
beq .8
cmp (ZPRepPtr),y
cmp (ZPMsgPtr),y
beq .5
jsr .8
bra .3
bra .4
.8 lda hRep
>SYSCALL FreeMem
* clc
.8 clc
rts
*--------------------------------------
CS.RUN.REQ
@ -565,14 +569,14 @@ CS.RUN.REQ
clc
rts
*--------------------------------------
CS.RUN.SKIPPFX ldy #S.TCP
lda (ZPRepPtr),y
CS.RUN.SKIPPFX ldy #0
lda (ZPMsgPtr)
cmp #':'
bne .8
.1 iny
lda (ZPRepPtr),y
lda (ZPMsgPtr),y
cmp #C.SPACE
bne .1
@ -671,17 +675,22 @@ CS.DOEVENT lda (pEvent)
.9 sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT lda hSocket
CS.QUIT lda hFile
beq .1
>SYSCALL fclose
.1 lda hSocket
beq .2
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
.1 lda hMsg
beq .2
.2 lda hMsg
beq .3
>SYSCALL FreeMem
.2 lda hLIBTCPIP
.3 lda hLIBTCPIP
beq .8
>SYSCALL UnloadLib
@ -718,6 +727,7 @@ IRC.NICK .AZ "NICK %s\r\n"
IRC.USER .AZ "USER %s 0 * :%s\r\n"
IRC.JOIN .AZ "JOIN %s\r\n"
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"
@ -735,11 +745,14 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF
.BS 1
.BS 4 S.SOCKADDR.ADDR
.BS 2
*--------------------------------------
NOD.Template .AZ "/dev/irc%h"
*--------------------------------------
.DUMMY
.OR 0
DS.START
TxtBuf .BS 240
NodBuf .BS 11
DS.END
.ED
*--------------------------------------