mirror of https://github.com/A2osX/A2osX.git
Kernel 0.9.1 : KERNEL, STDIO rewrite....
This commit is contained in:
parent
56e0ebfe4a
commit
d5cae46351
|
@ -454,7 +454,8 @@ return a hFILE to a new FIFO
|
|||
+ A = hFILE
|
||||
|
||||
# FPutC.AY
|
||||
Print A (char) to Node
|
||||
int fputc ( int character, hFILE stream );
|
||||
Print A (char) to hFILE
|
||||
|
||||
## In:
|
||||
+ A : char to print
|
||||
|
@ -464,6 +465,7 @@ Print A (char) to Node
|
|||
+ CC = success
|
||||
|
||||
# PutChar.A
|
||||
int putchar ( int character );
|
||||
Print A (char) to StdOut
|
||||
|
||||
## In:
|
||||
|
@ -472,6 +474,27 @@ Print A (char) to StdOut
|
|||
## Out:
|
||||
+ CC = success
|
||||
|
||||
# FPutS
|
||||
int fputs ( const char * str, hFILE stream );
|
||||
Write Str to FILE
|
||||
|
||||
## In:
|
||||
+ PUSHW : CPtr
|
||||
+ PUSHB : hFILE
|
||||
|
||||
## Out:
|
||||
+ CC = success
|
||||
|
||||
# PutS.YA
|
||||
int puts ( const char * str );
|
||||
Write Str to StdOut, appends '\n'
|
||||
|
||||
## In:
|
||||
+ Y,A : CPtr
|
||||
|
||||
## Out:
|
||||
+ CC = success
|
||||
|
||||
# GetChar
|
||||
Get char from StdIn
|
||||
|
||||
|
@ -486,31 +509,12 @@ Get char from StdIn
|
|||
Get char from Node
|
||||
|
||||
## In:
|
||||
+ A = hFILE
|
||||
+ A = hNODE
|
||||
|
||||
## Out:
|
||||
+ CC = success
|
||||
+ A = char
|
||||
|
||||
# FPutS
|
||||
Write String to FILE
|
||||
|
||||
## In:
|
||||
+ PUSHW : CPtr
|
||||
+ PUSHB : hFILE
|
||||
|
||||
## Out:
|
||||
+ CC = success
|
||||
|
||||
# PutS.YA
|
||||
Write String to StdOut
|
||||
|
||||
## In:
|
||||
+ Y,A : CPtr
|
||||
|
||||
## Out:
|
||||
+ CC = success
|
||||
|
||||
# FOpen
|
||||
Open a file
|
||||
|
||||
|
@ -537,26 +541,8 @@ Close a file
|
|||
|
||||
## Out :
|
||||
|
||||
# FRead.A
|
||||
Read ONE byte (A) from file (Y)
|
||||
|
||||
## In :
|
||||
+ A = hFILE
|
||||
|
||||
## Out :
|
||||
+ A = Byte Read
|
||||
|
||||
# FWrite.AY
|
||||
Write ONE byte (A) To file (Y)
|
||||
|
||||
## In:
|
||||
+ A = hFILE
|
||||
+ Y = char
|
||||
|
||||
# Out:
|
||||
+ Y,A = Bytes Written
|
||||
|
||||
# FRead
|
||||
int fread ( void * ptr, int count, FILE * stream );
|
||||
Read bytes from file
|
||||
|
||||
## In :
|
||||
|
@ -568,6 +554,7 @@ Read bytes from file
|
|||
+ Y,A = Bytes Read
|
||||
|
||||
# FWrite
|
||||
int fwrite ( const void * ptr, int count, FILE * stream );
|
||||
Write bytes to file
|
||||
|
||||
## In:
|
||||
|
|
Binary file not shown.
Binary file not shown.
102
INC/A2osX.I.txt
102
INC/A2osX.I.txt
|
@ -275,6 +275,57 @@ S.MSTAT.DCount .EQ 22
|
|||
*
|
||||
S.MSTAT .EQ 24
|
||||
*--------------------------------------
|
||||
* S.NODE
|
||||
*--------------------------------------
|
||||
S.NODE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
|
||||
S.NODE.T .EQ 1
|
||||
S.NODE.T.REG .EQ 0
|
||||
S.NODE.T.DIR .EQ 1
|
||||
S.NODE.T.CDEV .EQ 2
|
||||
S.NODE.T.BDEV .EQ 3
|
||||
S.NODE.T.LNK .EQ 4
|
||||
S.NODE.T.DSOCK .EQ 5
|
||||
S.NODE.T.SSOCK .EQ 6
|
||||
S.NODE.T.FIFO .EQ 7
|
||||
*--------------------------------------
|
||||
S.NODE.REG.REF .EQ 2
|
||||
S.NODE.REG.IOBUF .EQ 3
|
||||
*
|
||||
S.NODE.REG .EQ 4
|
||||
*--------------------------------------
|
||||
S.NODE.DIR.REF .EQ 2
|
||||
S.NODE.DIR.IOBUF .EQ 3
|
||||
S.NODE.DIR.EL .EQ 4
|
||||
S.NODE.DIR.EPB .EQ 5
|
||||
S.NODE.DIR.FC .EQ 6 word
|
||||
*
|
||||
S.NODE.DIR .EQ 8
|
||||
*--------------------------------------
|
||||
S.NODE.DEV.ID .EQ 2
|
||||
S.NODE.DEV.JMP .EQ 3 word
|
||||
*
|
||||
S.NODE.DEV .EQ 5
|
||||
*--------------------------------------
|
||||
* S.NODE.LNK
|
||||
*--------------------------------------
|
||||
S.NODE.SSOCK.HSKT .EQ 2
|
||||
S.NODE.SSOCK.OPEN .EQ 3
|
||||
S.NODE.SSOCK.CLOSE .EQ 4
|
||||
S.NODE.SSOCK.READ .EQ 5
|
||||
S.NODE.SSOCK.WRITE .EQ 6
|
||||
S.NODE.SSOCK.STATUS .EQ 7
|
||||
*
|
||||
S.NODE.SSOCK .EQ 8
|
||||
*--------------------------------------
|
||||
S.NODE.FIFO.S .EQ 2
|
||||
S.NODE.FIFO.S.Opened .EQ 1
|
||||
S.NODE.FIFO.S.Closed .EQ 2
|
||||
S.NODE.FIFO.hMem .EQ 3
|
||||
S.NODE.FIFO.Tail .EQ 4
|
||||
S.NODE.FIFO.Head .EQ 5
|
||||
*
|
||||
S.NODE.FIFO .EQ 6
|
||||
*--------------------------------------
|
||||
* DEVMGR (new API) = Smartport
|
||||
*--------------------------------------
|
||||
* JMP : (A=Device)
|
||||
|
@ -494,56 +545,5 @@ S.STAT.P.DEVBLOCKS .EQ 59 BYTE
|
|||
*
|
||||
S.STAT .EQ 64
|
||||
*--------------------------------------
|
||||
* S.NODE
|
||||
*--------------------------------------
|
||||
S.NODE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
|
||||
S.NODE.T .EQ 1
|
||||
S.NODE.T.REG .EQ 0
|
||||
S.NODE.T.DIR .EQ 1
|
||||
S.NODE.T.CDEV .EQ 2
|
||||
S.NODE.T.BDEV .EQ 3
|
||||
S.NODE.T.LNK .EQ 4
|
||||
S.NODE.T.DSOCK .EQ 5
|
||||
S.NODE.T.SSOCK .EQ 6
|
||||
S.NODE.T.FIFO .EQ 7
|
||||
*--------------------------------------
|
||||
S.NODE.REG.REF .EQ 2
|
||||
S.NODE.REG.IOBUF .EQ 3
|
||||
*
|
||||
S.NODE.REG .EQ 4
|
||||
*--------------------------------------
|
||||
S.NODE.DIR.REF .EQ 2
|
||||
S.NODE.DIR.IOBUF .EQ 3
|
||||
S.NODE.DIR.EL .EQ 4
|
||||
S.NODE.DIR.EPB .EQ 5
|
||||
S.NODE.DIR.FC .EQ 6 word
|
||||
*
|
||||
S.NODE.DIR .EQ 8
|
||||
*--------------------------------------
|
||||
S.NODE.DEV.ID .EQ 2
|
||||
S.NODE.DEV.JMP .EQ 3 word
|
||||
*
|
||||
S.NODE.DEV .EQ 5
|
||||
*--------------------------------------
|
||||
* S.NODE.LNK
|
||||
*--------------------------------------
|
||||
S.NODE.SSOCK.HSKT .EQ 2
|
||||
S.NODE.SSOCK.OPEN .EQ 3
|
||||
S.NODE.SSOCK.CLOSE .EQ 4
|
||||
S.NODE.SSOCK.READ .EQ 5
|
||||
S.NODE.SSOCK.WRITE .EQ 6
|
||||
S.NODE.SSOCK.STATUS .EQ 7
|
||||
*
|
||||
S.NODE.SSOCK .EQ 8
|
||||
*--------------------------------------
|
||||
S.NODE.FIFO.S .EQ 2
|
||||
S.NODE.FIFO.S.Opened .EQ 1
|
||||
S.NODE.FIFO.S.Closed .EQ 2
|
||||
S.NODE.FIFO.hMem .EQ 3
|
||||
S.NODE.FIFO.Tail .EQ 4
|
||||
S.NODE.FIFO.Head .EQ 5
|
||||
*
|
||||
S.NODE.FIFO .EQ 6
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.BUILD/INC/A2OSX.I
|
||||
|
|
23
README.md
23
README.md
|
@ -7,7 +7,22 @@
|
|||
+ **A2OSX.BUILD.po** : **(0.9.1)** 800k BOOT disk image with S-C MASM 3.0 and all binaries (BOOT+DEV)
|
||||
+ **A2OSX.SRC.po** : **(0.9.1)** 800k disk image with all sources
|
||||
|
||||
## Latest News 2018-04-29
|
||||
## Latest News 2018-05-29
|
||||
|
||||
Time to work on STDIO :
|
||||
|
||||
+ Buffered IO to link TCP/IP stream sockets properly to STDIN,STDOUT,STDERR (TELNETD)
|
||||
+ Implement missing STDIO functions (Puts, FPuts...)
|
||||
+ Faster Console output
|
||||
+ Better 'C-Like' API
|
||||
|
||||
Scope : KERNEL.STDIO, All drivers, CDEV, FIFO,...
|
||||
|
||||
Goal : TELNETD & HTTPD working.
|
||||
|
||||
Wanna play ?
|
||||
|
||||
## News 2018-04-29
|
||||
|
||||
Kernel 0.9.1 is now preemptive.
|
||||
|
||||
|
@ -36,7 +51,7 @@ Roadmap is as follow:
|
|||
+ Add more supported hardware for system clock.
|
||||
+ ...and still hoping finding few contributors.... :-(
|
||||
|
||||
## Latest News 2017-11-08
|
||||
## News 2017-11-08
|
||||
|
||||
Kernel 0.9.1 stable enough to resume building.
|
||||
|
||||
|
@ -50,9 +65,9 @@ Kernel 0.9.1 stable enough to resume building.
|
|||
|
||||
+ Math API (Hacked from APPLESOFT ROM ;-)
|
||||
|
||||
+ CSH Script engine in progress within Shell (In progress)
|
||||
+ CSH Script engine within Shell (In progress)
|
||||
|
||||
## Latest News 2017-09-22
|
||||
## News 2017-09-22
|
||||
|
||||
(once Kernel 0.9.1 stable enough, BOOT & DEV will be updated) __(done!)__
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ ZPPtr3 .EQ ZPKERNEL+4
|
|||
ZPPtr4 .EQ ZPKERNEL+6
|
||||
pDrv .EQ ZPKERNEL+8
|
||||
pDev .EQ ZPKERNEL+10
|
||||
|
||||
pNode .EQ ZPKERNEL+12
|
||||
pIOBuf .EQ ZPKERNEL+14
|
||||
*--------------------------------------
|
||||
SYS.BASL0 .EQ $400
|
||||
*--------------------------------------
|
||||
|
|
|
@ -3,36 +3,31 @@ PREFIX /A2OSX.BUILD
|
|||
AUTO 4,1
|
||||
*/--------------------------------------
|
||||
* # FPutC.AY
|
||||
* Print A (char) to Node
|
||||
* int fputc ( int character, hFILE stream );
|
||||
* Print A (char) to hFILE
|
||||
* ## In:
|
||||
* A : char to print
|
||||
* Y = hFILE
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.FPutC.AY sta K.PutC.Char
|
||||
sty K.PutC.Node
|
||||
K.FPutC.AY sta K.IOBuf
|
||||
|
||||
tya
|
||||
phy
|
||||
bne K.PutChar.A.1
|
||||
K.PutChar.A.8 ply
|
||||
clc
|
||||
rts
|
||||
bra K.PutChar.A.1
|
||||
*/--------------------------------------
|
||||
* # PutChar.A
|
||||
* int putchar ( int character );
|
||||
* Print A (char) to StdOut
|
||||
* ## In:
|
||||
* A : char to print
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.PutChar.A sta K.PutC.Char
|
||||
phy
|
||||
K.PutChar.A sta K.IOBuf
|
||||
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
beq K.PutChar.A.8 NUL
|
||||
|
||||
phx
|
||||
|
||||
K.PutChar.A.1 sta K.PutC.Node
|
||||
jsr K.GetMemPtr.A
|
||||
|
@ -42,11 +37,6 @@ K.PutChar.A.1 sta K.PutC.Node
|
|||
lda (pDev),y
|
||||
asl
|
||||
tax
|
||||
jsr K.PutChar.A.Jmp
|
||||
|
||||
plx
|
||||
ply
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.PutChar.A.Jmp jmp (.1,x)
|
||||
.1 .DA K.PutChar.A.REG
|
||||
|
@ -58,9 +48,8 @@ K.PutChar.A.Jmp jmp (.1,x)
|
|||
.DA K.PutChar.A.SSOCK
|
||||
.DA K.PutChar.A.FIFO
|
||||
*--------------------------------------
|
||||
K.PutChar.A.REG lda K.PutC.Node
|
||||
ldy K.PutC.Char
|
||||
jmp K.FWrite.AY
|
||||
K.PutChar.A.REG jsr K.GetC.REG.1
|
||||
jmp K.FWrite
|
||||
*--------------------------------------
|
||||
K.PutChar.A.CDEV
|
||||
ldy #S.NODE.DEV.JMP
|
||||
|
@ -69,7 +58,7 @@ K.PutChar.A.CDEV
|
|||
iny
|
||||
lda (pDev),y
|
||||
sta .1+2
|
||||
lda K.PutC.Char
|
||||
lda K.IOBuf
|
||||
ldx #DEVMGR.WRITE
|
||||
.1 jmp $ffff
|
||||
*--------------------------------------
|
||||
|
@ -80,7 +69,7 @@ K.PutChar.A.SSOCK
|
|||
|
||||
ldy #S.NODE.SSOCK.HSKT
|
||||
>PUSHB (pDev),y
|
||||
>PUSHB K.PutC.Char
|
||||
>PUSHB K.IOBuf
|
||||
|
||||
ldy #S.NODE.SSOCK.WRITE
|
||||
lda (pDev),y
|
||||
|
@ -108,7 +97,7 @@ K.PutChar.A.FIFO
|
|||
iny
|
||||
sta (pDev),y
|
||||
tay
|
||||
lda K.PutC.Char
|
||||
lda K.IOBuf
|
||||
.1 sta $ffff,y
|
||||
clc
|
||||
rts
|
||||
|
@ -119,9 +108,53 @@ K.PutChar.A.FIFO
|
|||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.PutC.Char .BS 1
|
||||
K.PutC.Node .BS 1
|
||||
*/--------------------------------------
|
||||
* # FPutS
|
||||
* int fputs ( const char * str, hFILE stream );
|
||||
* Write Str to FILE
|
||||
* ## In:
|
||||
* PUSHW : CPtr
|
||||
* PUSHB : hFILE
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.FPutS pha
|
||||
>PULLW pIOBuf
|
||||
pla
|
||||
bra K.PutS.YA.1
|
||||
*/--------------------------------------
|
||||
* # PutS.YA
|
||||
* int puts ( const char * str );
|
||||
* Write Str to StdOut, appends '\n'
|
||||
* ## In:
|
||||
* Y,A : CPtr
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.PutS.YA >STYA pIOBuf
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
jsr K.PutS.YA.1
|
||||
* bcs .9
|
||||
* lda #13
|
||||
* jsr K.PutChar.A
|
||||
* bcs .9
|
||||
* lda #10
|
||||
* jmp K.PutChar.A
|
||||
.9 rts
|
||||
|
||||
K.PutS.YA.1 jsr K.GetMemPtr.A
|
||||
>STYA pNode
|
||||
|
||||
ldy #S.NODE.T
|
||||
lda (pDev),y
|
||||
asl
|
||||
tax
|
||||
|
||||
|
||||
bra *
|
||||
*/--------------------------------------
|
||||
* # GetChar
|
||||
* Get char from StdIn
|
||||
* ## In:
|
||||
|
@ -136,7 +169,7 @@ K.GetChar ldy #S.PS.hStdIn
|
|||
* # GetC.A
|
||||
* Get char from Node
|
||||
* ## In:
|
||||
* A = hFILE
|
||||
* A = hNODE
|
||||
* ## Out:
|
||||
* CC = success
|
||||
* A = char
|
||||
|
@ -160,8 +193,17 @@ K.GetC.A sta K.PutC.Node
|
|||
.DA K.GetC.SSOCK
|
||||
.DA K.GetC.FIFO
|
||||
*--------------------------------------
|
||||
K.GetC.REG lda K.PutC.Node
|
||||
jmp K.FRead.A
|
||||
K.GetC.REG jsr K.GetC.REG.1
|
||||
jsr K.FRead
|
||||
bcs .9
|
||||
lda K.Buf256
|
||||
.9 rts
|
||||
|
||||
K.GetC.REG.1 >PUSHWI K.IOBuf
|
||||
>PUSHWI 1
|
||||
ldy #S.NODE.REG.REF
|
||||
>PUSHB (pDev),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.GetC.CDEV ldx #DEVMGR.READ
|
||||
ldy #S.NODE.DEV.JMP
|
||||
|
@ -186,26 +228,6 @@ K.GetC.SSOCK lda (pDev) #S.NODE.HANDLER
|
|||
*.1 jmp $ffff
|
||||
*--------------------------------------
|
||||
K.GetC.FIFO
|
||||
*/--------------------------------------
|
||||
* # FPutS
|
||||
* Write String to FILE
|
||||
* ## In:
|
||||
* PUSHW : CPtr
|
||||
* PUSHB : hFILE
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.FPutS
|
||||
*/--------------------------------------
|
||||
* # PutS.YA
|
||||
* Write String to StdOut
|
||||
* ## In:
|
||||
* Y,A : CPtr
|
||||
* ## Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.PutS.YA
|
||||
|
||||
bra *
|
||||
*/--------------------------------------
|
||||
* # FOpen
|
||||
|
@ -368,42 +390,8 @@ K.FClose.A.8 lda #$ff Self Modified
|
|||
jmp K.FreeMem.A
|
||||
K.FClose.A.9 rts
|
||||
*/--------------------------------------
|
||||
* # FRead.A
|
||||
* Read ONE byte (A) from file (Y)
|
||||
* ## In :
|
||||
* A = hFILE
|
||||
* ## Out :
|
||||
* A = Byte Read
|
||||
*\--------------------------------------
|
||||
K.FRead.A jsr PFT.CheckNodeA
|
||||
ldx #MLIREAD
|
||||
bra K.FReadWrite.0
|
||||
*/--------------------------------------
|
||||
* # FWrite.AY
|
||||
* Write ONE byte (A) To file (Y)
|
||||
* ## In:
|
||||
* A = hFILE
|
||||
* Y = char
|
||||
* # Out:
|
||||
* Y,A = Bytes Written
|
||||
*\--------------------------------------
|
||||
K.FWrite.AY jsr PFT.CheckNodeA
|
||||
sty K.FWrite.AY.Buf
|
||||
ldx #MLIWRITE
|
||||
K.FReadWrite.0 jsr STDIO.GetRefNum
|
||||
>LDYAI K.FWrite.AY.Buf
|
||||
>STYA K.MLI.PARAMS+2
|
||||
lda #1
|
||||
sta K.MLI.PARAMS+4
|
||||
stz K.MLI.PARAMS+5
|
||||
lda #4 Param Count = 4 for MLIREAD & MLIWRITE
|
||||
jsr GP.MLICall
|
||||
bcs .9
|
||||
lda K.FWrite.AY.Buf
|
||||
.9 rts
|
||||
K.FWrite.AY.Buf .BS 1
|
||||
*/--------------------------------------
|
||||
* # FRead
|
||||
* int fread ( void * ptr, int count, FILE * stream );
|
||||
* Read bytes from file
|
||||
* ## In :
|
||||
* PUSHW = Dest Ptr
|
||||
|
@ -417,6 +405,7 @@ K.FRead jsr PFT.CheckNodeSTK
|
|||
bra K.FReadWrite.1
|
||||
*/--------------------------------------
|
||||
* # FWrite
|
||||
* int fwrite ( const void * ptr, int count, FILE * stream );
|
||||
* Write bytes to file
|
||||
* ## In:
|
||||
* PUSHW = Src Ptr
|
||||
|
@ -1154,8 +1143,12 @@ PrintF.SS ldy #$00 PSTR
|
|||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
STDIO.COut jmp K.PutChar.A
|
||||
|
||||
STDIO.COut phy
|
||||
phx
|
||||
jsr K.PutChar.A
|
||||
plx
|
||||
ply
|
||||
rts
|
||||
*STDIO.COut.Ptr sta $ffff Self modified
|
||||
*--------------------------------------
|
||||
STDIO.PullMLIPath
|
||||
|
|
Loading…
Reference in New Issue