Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-08-25 12:56:00 +02:00
parent 4dbe39ffce
commit ad26c6d710
18 changed files with 158 additions and 120 deletions

View File

@ -575,6 +575,17 @@ CS : not found
## RETURN VALUE
# CloseSession
## C
`int closesession(short int hSID);`
## ASM
`>PUSHB hSID`
`>SYSCALL CloseSession`
## RETURN VALUE
# OpenSession
## C
@ -633,17 +644,6 @@ CS : not found
## RETURN VALUE
# CloseSession
## C
`int closesession(short int hSID);`
## ASM
`>PUSHB hSID`
`>SYSCALL CloseSession`
## RETURN VALUE
# SListGetData
## ASM
@ -880,8 +880,8 @@ Write Str to hFILE
## ASM
**In:**
`>PUSHB stream`
`>PUSHW str`
`lda stream`
`>SYSCALL fputs`
## RETURN VALUE
@ -1016,7 +1016,7 @@ Read bytes from file
Write bytes to file
## C
`int fwrite (short int stream, const void * ptr, int count );`
`int fwrite ( short int stream, const void * ptr, int count );`
## ASM
**In:**
@ -1382,9 +1382,12 @@ Y,A = destination
# StrDup
Create a new copy of this C-String
Y,A = Ptr to source C-String
## RETURN VALUE
## C
`char * strdup ( char * str);`
## ASM
Y,A = Ptr to source C-String
CC : success
Y,A = PTR to String
X = hMem (C-String)

Binary file not shown.

Binary file not shown.

View File

@ -106,7 +106,7 @@ CS.RUN dec AttrAND set mask = $ff
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay
@ -322,7 +322,7 @@ CS.RUN.CheckSwitch
bne .9
>LDYA ZPPtr1
>SYSCALL strupr
>SYSCALL StrUpr
ldx #AttrMask-AttrList2-1

View File

@ -64,11 +64,13 @@ CS.RUN
lda ArgCount
>SYSCALL ArgV
bcs .7
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
@ -91,13 +93,17 @@ CS.RUN
lda #$80
sta 0,y
bra .1
.4 inc FileCount
bra .1 scan for any other args
.7 lda FileCount
beq .99
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPBufPtr
stx hBuf
*--------------------------------------
@ -105,13 +111,16 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
bcs .90 IO error
tay
bne .10 no char
>SYSCALL GetChar
bcs .9 IO error
cmp #$03 Ctrl-C
beq .9 Abort....
cmp #$13 Ctrl-S
bne .10
@ -124,17 +133,21 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
.11 lda hFile
bne .2
.1 inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .99 No more arg...the end!
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
beq .1 An option, skip...
>LDYA ZPPtr1
jsr CS.RUN.OPEN
.90 bcs .9
sta hFile
.2 >PUSHWI 254 Leave room for CRLF
@ -147,8 +160,10 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
jsr CS.RUN.PRINT
bcc CS.RUN.LOOP
rts
.7 cmp #MLI.E.EOF
bne .9
jsr CS.RUN.CLOSE
jmp CS.RUN.LOOP
@ -166,29 +181,39 @@ CS.RUN.OPEN stz bPrintedBlankLine Reset this flag for the new file
*--------------------------------------
CS.RUN.PRINT inc LineNum
bne .10
inc LineNum+1
.10 lda bSuppressBlankLine
bpl .2
lda (ZPBufPtr)
bne .1 Empty line ?
lda bPrintedBlankLine
bmi .8
lda #$ff
sta bPrintedBlankLine
bra .2
.1 stz bPrintedBlankLine
.2 jsr CS.RUN.PRINTNUM
bcs .99
lda bPrintAll
bmi .3
ldy #$ff
.20 iny
lda (ZPBufPtr),y
beq .21
cmp #C.SPACE
bcs .20
lda #C.SPACE
sta (ZPBufPtr),y
bra .20
@ -198,17 +223,22 @@ CS.RUN.PRINT inc LineNum
rts
.3 stz ByteIndex
.4 ldy ByteIndex
lda (ZPBufPtr),y
beq .7
cmp #C.SPACE
bcc .5
>SYSCALL PutChar
.99 bcs .9
bra .62
.8 clc
rts
.5 tax
>LDYA L.ASCII
@ -228,6 +258,7 @@ CS.RUN.PRINT inc LineNum
>PUSHBI 2
>SYSCALL PrintF
bcs .9
.62 inc ByteIndex
bne .4
@ -253,7 +284,9 @@ CS.QUIT lda hBuf
CS.RUN.CLOSE lda hFile
beq .8
stz hFile
>SYSCALL FClose
.8 clc
rts

View File

@ -118,7 +118,7 @@ CS.RUN >INC.G ArgIndex
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay

View File

@ -119,7 +119,7 @@ CS.RUN >INC.G ArgIndex
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay
@ -210,7 +210,7 @@ CS.RUN.DIR lda (ZPFileName)
>PUSHW ZPFullPath
>PUSHB.G UID
>PUSHBI 255
>SYSCALL chown
>SYSCALL ChOwn
jsr CS.RUN.CheckErr
bcs .9

View File

@ -158,9 +158,9 @@ CS.RUN.IPOK ldy #S.PS.ARGC
lda #1
>SYSCALL ArgV
>PUSHYA
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GETBYNAME
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
bcc CS.RUN.HOSTOK
lda TimeOut
lda TimeOut
bne .2
>PUSHW L.MSG.UNKNOWN
@ -180,7 +180,7 @@ CS.RUN.IPOK ldy #S.PS.ARGC
CS.RUN.HOSTOK lda #2
>SYSCALL ArgV
>SYSCALL atoi
>SYSCALL AToI
>STYA SA.REMOTE+S.SOCKADDR.PORT
>PUSHW L.MSG.HOSTOK
@ -270,7 +270,7 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
CS.RUN.LOOP >SLEEP
lda hFile
>SYSCALL feof
>SYSCALL FEOF
bcs .9
tay
@ -288,7 +288,7 @@ CS.RUN.LOOP >SLEEP
.2 ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .9
tay
bne CS.RUN.LOOP EOF = true, no char from STDIN
@ -312,13 +312,13 @@ CS.RUN.MkNod >PUSHEA.G NodBuf
>PUSHW L.NOD.Template
>PUSHB hSocket
>PUSHBI 1
>SYSCALL sprintf
>SYSCALL SPrintF
bcs .9
>PUSHEA.G NodBuf
>PUSHW 0
>PUSHB hSocket
>SYSCALL mknod
>SYSCALL MKNod
bcs .9
>PUSHEA.G NodBuf
@ -656,7 +656,7 @@ CS.RUN.CMD.376
CS.RUN.GetMsg >PUSHWI MSGSIZE
>PUSHW ZPMsgPtr
lda hFile
>SYSCALL fgets
>SYSCALL FGetS
bcs .9
lda (ZPMsgPtr)
@ -967,12 +967,12 @@ CS.DOEVENT lda (pEvent)
CS.QUIT lda hFile
beq .1
>SYSCALL fclose
>SYSCALL FClose
.1 lda hSocket
beq .2
* >LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
.2 lda hText
beq .3
@ -1058,8 +1058,7 @@ NOD.Template .AZ "/dev/irc%h"
DS.START
NULLSTRING .BS 1
NodBuf .BS 11
DS.END
.ED
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/irc.s

View File

@ -6,9 +6,9 @@ AUTO 4,1
.OR $2000
.TF bin/kconfig
*--------------------------------------
.INB INC/MACROS.I
.INB INC/MLI.I
.INB INC/A2OSX.I
.INB inc/macros.i
.INB inc/mli.i
.INB inc/a2osx.i
*--------------------------------------
.DUMMY
.OR ZPBIN
@ -406,5 +406,5 @@ DS.START
StatBuf .BS S.STAT
DS.END .ED
MAN
SAVE USR/SRC/BIN/KCONFIG.S
SAVE usr/src/bin/kconfig.s
ASM

View File

@ -104,7 +104,7 @@ CS.RUN >INC.G ArgIndex
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay
@ -265,7 +265,7 @@ CS.RUN.GetNewPath
>SYSCALL StrCpy
>LDYA ZPFileName
>SYSCALL strlwr
>SYSCALL StrLwr
>PUSHW ZPFileName
>LDYA ZPNewPath
@ -341,9 +341,7 @@ hFile .BS 1
hMem .BS 1
.INB usr/src/bin/x.fileenum.g
DS.END
.ED
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/lc.s

View File

@ -415,8 +415,8 @@ CS.RUN.OpenArc >LDA.G ArcName
>STA.G hArcFile
>PUSHB.G hArcFile
>PUSHW L.ARC.Header
>LDA.G hArcFile
>SYSCALL FPutS
.9
CS.RUN.OpenArc.RTS
@ -509,8 +509,8 @@ CS.RUN.WriteArcHdr
jsr CS.RUN.WriteArcByteA
bcs CS.RUN.WriteArcHdr.9
>PUSHB.G hArcFile
>PUSHW ZPRelPath
>LDA.G hArcFile
>SYSCALL FPutS
CS.RUN.WriteArcHdr.9
@ -683,5 +683,5 @@ DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/PAK.S
SAVE usr/src/bin/pak.s
ASM

View File

@ -5,12 +5,12 @@ NEW
.OR $2000
.TF bin/pakme
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/PAK.I
.INB INC/LIBPAK.I
.INB INC/MLI.E.I
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/pak.i
.INB inc/libpak.i
.INB inc/mli.e.i
*--------------------------------------
CHUNK.MAX .EQ 32
*--------------------------------------
@ -126,19 +126,19 @@ CS.RUN.START >PUSHW L.MSG.SRCFILE
>PUSHWZ
>PUSHWZ
lda hSrcFile
>SYSCALL fseek
>SYSCALL FSeek
bcs CS.RUN.RTS
>PUSHW ZPDstTableOfs
>PUSHW ZPSrcBufPtr
lda hSrcFile
>SYSCALL fread
>SYSCALL FRead
bcs CS.RUN.RTS
>PUSHW ZPDstTableOfs
>PUSHW ZPSrcBufPtr
lda hDstFile
>SYSCALL fwrite
>SYSCALL FWrite
bcs CS.RUN.RTS
jsr CS.QUIT.BUF
@ -151,7 +151,7 @@ CS.RUN.RTS rts
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs CS.RUN.RTS
tay
@ -228,7 +228,7 @@ CS.RUN.CheckSrcFile
>PUSHB hSrcFile
>PUSHEA.G STATBUF
>SYSCALL fstat
>SYSCALL FStat
.99 bcs .9
>LDA.G STATBUF+S.STAT.SIZE+3
@ -271,13 +271,13 @@ CS.RUN.CheckTAG >PUSHBI SEEK.SET
>PUSHYA
lda hSrcFile
>SYSCALL fseek
>SYSCALL FSeek
bcs CS.RUN.CheckSrcFile.RTS
>PUSHWI 10
>PUSHEA.G PAKME.HEADER
lda hSrcFile
>SYSCALL fread
>SYSCALL FRead
bcs CS.RUN.CheckSrcFile.RTS
ldx #4
@ -311,7 +311,7 @@ CS.RUN.GetTable >LDA.G PAKME.HEADER+8
>PUSHWZ
>PUSHW ZPDstTableOfs
lda hSrcFile
>SYSCALL fseek
>SYSCALL FSeek
bcs .9
>LDA.G PAKME.HEADER+7
@ -324,7 +324,7 @@ CS.RUN.GetTable >LDA.G PAKME.HEADER+8
>PUSHEA.G PAKME.TABLE
lda hSrcFile
>SYSCALL fread
>SYSCALL FRead
.9 rts
*--------------------------------------
@ -352,13 +352,13 @@ CS.RUN.GetChunk lda ZPChunkIndex
>PUSHWZ
>PUSHW ZPChunkOfs
lda hSrcFile
>SYSCALL fseek
>SYSCALL FSeek
bcs .9
>PUSHWI 3
>PUSHEA.G CHUNK.HEADER
lda hSrcFile
>SYSCALL fread
>SYSCALL FRead
bcs .9
>LDA.G CHUNK.HEADER
@ -378,7 +378,7 @@ CS.RUN.GetChunk lda ZPChunkIndex
>PUSHW ZPChunkLen
>PUSHW ZPSrcBufPtr
lda hSrcFile
>SYSCALL fread
>SYSCALL FRead
bcs .9
* clc
@ -416,7 +416,7 @@ CS.RUN.RewriteTable
>PUSHWZ
>PUSHW ZPDstTableOfs
lda hDstFile
>SYSCALL fseek
>SYSCALL FSeek
bcs CS.RUN.WriteTable.RTS
*--------------------------------------
CS.RUN.WriteTable
@ -427,12 +427,12 @@ CS.RUN.WriteTable
>PUSHYA
>PUSHEA.G PAKME.TABLE
lda hDstFile
>SYSCALL fwrite
>SYSCALL FWrite
CS.RUN.WriteTable.RTS
rts
*--------------------------------------
CS.RUN.WritePak lda hDstFile
>SYSCALL ftell
>SYSCALL FTell
bcs .9
>PULLW ZPChunkNewOfs
@ -442,7 +442,7 @@ CS.RUN.WritePak lda hDstFile
>PUSHW ZPChunkPakedLen
>PUSHW ZPDstBufPtr
lda hDstFile
>SYSCALL fwrite
>SYSCALL FWrite
bcs .9
>PUSHW L.MSG.PAKED
@ -457,7 +457,7 @@ CS.RUN.WritePak.RTS
*--------------------------------------
CS.RUN.WriteStore
lda hDstFile
>SYSCALL ftell
>SYSCALL FTell
bcs CS.RUN.WritePak.RTS
>PULLW ZPChunkNewOfs
@ -467,13 +467,13 @@ CS.RUN.WriteStore
>PUSHWI 3
>PUSHEA.G CHUNK.HEADER
lda hDstFile
>SYSCALL fwrite
>SYSCALL FWrite
bcs .9
>PUSHW ZPChunkLen
>PUSHW ZPSrcBufPtr
lda hDstFile
>SYSCALL fwrite
>SYSCALL FWrite
bcs .9
>PUSHW L.MSG.STORE
@ -569,5 +569,5 @@ PAKSTAT .BS S.PAKSTAT
DS.END .ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/PAKME.S
SAVE usr/src/bin/pakme.s
ASM

View File

@ -300,10 +300,11 @@ CL.PrintEOL >LDA.G CL.Ptr
CL.PrintEOL.8 clc
rts
*--------------------------------------
CL.PrintCLBuf >PUSHW ZPCLBuf
ldy #S.PS.hStdOut
CL.PrintCLBuf ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW ZPCLBuf
>SYSCALL FPutS
rts
*--------------------------------------

View File

@ -245,9 +245,11 @@ CORE.Run.7 jsr CORE.GetCharNB
jsr IO.Pipe.Out
bcs CORE.Run.Exit
lda #S.PS.F.HOLD+S.PS.F.CLOSEONX Run in the background...
tsb CORE.PSFlags ...and close PIPE OUT on exit
lda #S.PS.F.HOLD Run in the background...
trb CORE.PSFlags
lda #S.PS.F.CLOSEONX ...and close PIPE OUT on exit
tsb CORE.PSFlags
jsr CORE.ExecCmd
php

View File

@ -121,7 +121,7 @@ CS.RUN.DUMP lda ArgFile
>SYSCALL PrintF
jsr Mod2CSTR
>PUSHW L.MSG.MOD
>PUSHW L.MSG.Mod
>PUSHEA.G MOD
>PUSHBI 2
>SYSCALL PrintF

View File

@ -81,7 +81,7 @@ CS.RUN lda #1
CS.RUN.LOOP >SLEEP
lda hDev
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay
bne .2 EOF, no char
@ -89,7 +89,7 @@ CS.RUN.LOOP >SLEEP
>PUSHWI BUFSIZE
>PUSHW ZPBufPtr
lda hDev
>SYSCALL fRead
>SYSCALL FRead
bcc .1
.99 rts
@ -97,13 +97,13 @@ CS.RUN.LOOP >SLEEP
>PUSHW ZPBufPtr
ldy #S.PS.hStdOut
lda (pPS),y
>SYSCALL fwrite
>SYSCALL FWrite
bcs .9
.2 ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .9
tay
bne CS.RUN.LOOP EOF = true, no char from STDIN
@ -112,7 +112,7 @@ CS.RUN.LOOP >SLEEP
>PUSHW ZPBufPtr
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL fread
>SYSCALL FRead
.3 bcs .9
>STYA ZPBufLen
@ -123,7 +123,7 @@ CS.RUN.LOOP >SLEEP
>PUSHW ZPBufLen
>PUSHW ZPBufPtr
lda hDev
>SYSCALL fWrite
>SYSCALL FWrite
bcs .9
jmp CS.RUN.LOOP

View File

@ -104,7 +104,7 @@ CS.RUN >INC.G ArgIndex
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
>SYSCALL FEOF
bcs .99
tay
@ -265,7 +265,7 @@ CS.RUN.GetNewPath
>SYSCALL StrCpy
>LDYA ZPFileName
>SYSCALL strupr
>SYSCALL StrUpr
>PUSHW ZPFileName
>LDYA ZPNewPath
@ -341,9 +341,7 @@ hFile .BS 1
hMem .BS 1
.INB usr/src/bin/x.fileenum.g
DS.END
.ED
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/uc.s

View File

@ -17,17 +17,14 @@ K.PutChar >PUSHA character
ldy #S.PS.hStdOut
lda (pPS),y
jsr K.FPutC
bcc K.PutChar.RTS
bcc .8
cmp #E.NODATA
sec
bne K.PutChar.RTS
tay
bne .8
inc 0 = BLOCKING
>PULLA CS,A=0:BLOCKING, restore A
K.PutChar.RET1 inc pStack
K.PutChar.RTS rts
.8 rts
*/--------------------------------------
* # fputc (BLOCKING)
* Print A (char) to hFILE
@ -42,7 +39,7 @@ K.PutChar.RTS rts
* CC = success
*\--------------------------------------
K.FPutC jsr PFT.CheckNodeA
bcs K.PutChar.RET1
bcs .8
lda (pStack) character
sta K.IOBuf
@ -54,13 +51,16 @@ K.FPutC jsr PFT.CheckNodeA
>PUSHWI K.IOBuf buf
jsr UNISTD.Write
bcc K.PutChar.RET1 pop char...
bcc .8 pop char...
cmp #E.NODATA
sec
bne K.PutChar.RET1
bne .8
inc 0 = BLOCKING
* sec
inc CS,A=0:BLOCKING
rts
.8 >POP 1
rts
*/--------------------------------------
* # puts (BLOCKING)
@ -74,12 +74,13 @@ K.FPutC jsr PFT.CheckNodeA
* ## RETURN VALUE
* CC = success
*\--------------------------------------
K.PutS >STYA ZPPtr2
K.PutS >STYA .1+1
ldy #0
.1 lda (ZPPtr2),y
.1 lda $FFFF,y SELF MODIFIED
beq .2
sta K.IOBuf,y
iny
bne .1
@ -95,27 +96,26 @@ K.PutS >STYA ZPPtr2
lda #C.LF
sta K.IOBuf,y
iny
beq .9
lda #0
sta K.IOBuf,y
>PUSHWI K.IOBuf
ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHWI K.IOBuf
jsr K.FPutS
bcc K.PutS.RTS
cmp #E.NODATA
sec
tay
bne K.PutS.RTS
inc 0 = BLOCKING
>LDYA .1+1 CS,A=0:BLOCKING, restore Y,A
K.PutS.RET2 >POP 2 pop K.IOBuf
K.PutS.RET3 >POP 3 pop StdOut & buffer
K.PutS.RTS rts
*/--------------------------------------
* # fputs (BLOCKING)
@ -124,30 +124,33 @@ K.PutS.RTS rts
* `int fputs (hFILE stream, const char * str );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHW str`
* `lda stream`
* `>SYSCALL fputs`
* ## RETURN VALUE
* CC = success
*\--------------------------------------
K.FPutS jsr PFT.CheckNodeA set IO.hFD
bcs K.PutS.RET2
K.FPutS jsr PFT.CheckNode2 set IO.hFD
bcs K.PutS.RET3
lda (pStack)
sta ZPPtr2 Get String
ldy #1
lda (pStack),y
sta ZPPtr2+1
* ldy #0
dey
ldy #0
ldx #0
.1 lda (ZPPtr2),y
beq .2
iny
bne .1
inx
bra .1
.2 txa
>PUSHA push len HI
@ -156,14 +159,15 @@ K.FPutS jsr PFT.CheckNodeA set IO.hFD
>PUSHW ZPPtr2
jsr UNISTD.Write
bcc K.PutS.RET2
bcc K.PutS.RET3
cmp #E.NODATA
sec
bne K.PutS.RET2 IO Error
bne K.PutS.RET3 IO Error
inc FF-> 0 = BLOCKING
* sec
K.FPutS.RTS rts
K.FPutS.RTS rts
*/--------------------------------------
* # fgets (BLOCKING)
* read bytes from stream into the array