Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-09-20 17:33:05 +02:00
parent 1210f3d810
commit e040a2a11e
8 changed files with 136 additions and 75 deletions

View File

@ -505,7 +505,7 @@ Load a file in AUX memory (Stock Objects)
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# ExecPSNewEnv.
# ExecPSNewEnv
# ExecPS (Blocking Parent PID)
@ -549,29 +549,52 @@ Return information about a file
**Out:**
# MKDir
create a directory
## C
`int mkdir(const char *pathname, int mode);`
## ASM
**In:**
Y,A = DIR name
`>PUSHW mode`
`>LDYA pathname`
`>SYSCALL mkdir`
**Out:**
CC : success
CS : error
A = EC
CC : success
CS : error
A = EC
# MkNod
int mknod(const char *pathname, mode_t mode, dev_t dev);
return a hFile for a given Device Name
return a hFile for a given file descriptor.
(CDEV, BDEV, DSOCKS, SSOCK, PIPE)
## C
`hFILE mknod(const char *pathname, int mode, hFD fd);`
## ASM
**In:**
Y,A=DevName
`>PUSHB fd`
`>PUSHW mode`
`>LDYA pathname`
`>SYSCALL mknod`
**Out:**
CC = OK, CS = ERROR
A = hFILE
CC = OK, CS = ERROR
A = hFILE
# MKFIFO
int mkfifo(const char *pathname, mode_t mode);
return a hFILE to a new FIFO
## C
`hFILE mkfifo(const char *pathname, int mode);`
## ASM
**In:**
`>PUSHW mode`
`>LDYA pathname`
`>SYSCALL mkfifo`
**Out:**
CC = OK, CS = ERROR
A = hFILE
CC = OK, CS = ERROR
A = hFILE
# FPutC
Print A (char) to hFILE

View File

@ -60,7 +60,7 @@ Create a new socket
## ASM
**In:**
`>LDYA template`
`>PUSHW template`
`>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.New`
**Out:**
CC: A = hSOCKET
@ -95,11 +95,11 @@ CS: A = EC
# SKT.MkNod
## C
`hFD skt.mknod(hSOCKET *s);`
`hFD skt.mknod(hSOCKET s);`
## ASM
**In:**
`>LDYA s`
`lda s`
`>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.MkNod`
**Out:**
CC: A = hFD

Binary file not shown.

Binary file not shown.

View File

@ -7,6 +7,7 @@ K.ENV.SIZE .EQ 256
K.FLT.MAX .EQ 4
K.EVT.MAX .EQ 4
K.DEV.MAX .EQ 32
K.NOD.MAX .EQ 64
K.PS.MAX .EQ 32
*--------------------------------------
ZPDRV .EQ $20 32 bytes
@ -431,13 +432,13 @@ S.FD.SSOCK.STATUS .EQ 7
S.FD.SSOCK .EQ 8
*--------------------------------------
S.FD.FIFO.S .EQ 2
S.FD.FIFO.S.Opened .EQ 1
S.FD.FIFO.S.Closed .EQ 2
S.FD.FIFO.S.ROpened .EQ 1
S.FD.FIFO.S.WOpened .EQ 2
S.FD.FIFO.hMem .EQ 3
S.FD.FIFO.Tail .EQ 4
S.FD.FIFO.Head .EQ 5
S.FD.FIFO.Head .EQ 6
*
S.FD.FIFO .EQ 6
S.FD.FIFO .EQ 8
*--------------------------------------
* PS STRUCT
*--------------------------------------
@ -548,12 +549,12 @@ S.STAT.MODE.RU .EQ $0100
S.STAT.MODE.REG .EQ $0000
S.STAT.MODE.DIR .EQ $1000
*S.STAT.MODE.CDEV .EQ $2000
*S.STAT.MODE.BDEV .EQ $3000
S.STAT.MODE.CDEV .EQ $2000
S.STAT.MODE.BDEV .EQ $3000
*S.STAT.MODE.LNK .EQ $4000
*S.STAT.MODE.DSOCK .EQ $5000
*S.STAT.MODE.SSOCK .EQ $6000
*S.STAT.MODE.FIFO .EQ $7000
S.STAT.MODE.DSOCK .EQ $5000
S.STAT.MODE.SSOCK .EQ $6000
S.STAT.MODE.FIFO .EQ $7000
S.STAT.DEV .EQ 2 WORD
S.STAT.UID .EQ 4 WORD

View File

@ -104,6 +104,11 @@ Dev.Table.F .EQ $0C20 K.Dev.MAX
Dev.Table.pFDLO .EQ $0C40 K.Dev.MAX
Dev.Table.pFDHI .EQ $0C60 K.Dev.MAX
*--------------------------------------
* /dev/
*--------------------------------------
Nod.Table.hFD .EQ $0C80 K.NOD.MAX
Nod.Table.hPath .EQ $0CC0 K.NOD.MAX
*--------------------------------------
PS.Table.hMem .EQ $0D00 K.PS.MAX
PS.Table.PID .EQ $0D20 K.PS.MAX
PS.Table.Stat .EQ $0D40 K.PS.MAX

View File

@ -531,7 +531,7 @@ DevMgr.Stat .DA DevMgr.FreeMem
DevMgr.Free .DA DevMgr.FreeMem
.DA DevMgr.HiMem
DevMgr.DevCnt .DA #0
.BS 1
DevMgr.NodCnt .DA #0
*--------------------------------------
CORE.VBLState .BS 1
CORE.IRQMode .BS 1

View File

@ -123,15 +123,22 @@ K.Stat.DST .DA #S.STAT.P.TYPE
.DA #S.STAT.BLOCKS,#S.STAT.BLOCKS+1
*/-------------------------------------
* # MKDir
* create a directory
* ## C
* `int mkdir(const char *pathname, int mode);`
* ## ASM
* **In:**
* Y,A = DIR name
* `>PUSHW mode`
* `>LDYA pathname`
* `>SYSCALL mkdir`
* **Out:**
* CC : success
* CS : error
* A = EC
* CC : success
* CS : error
* A = EC
*\-------------------------------------
K.MKDir jsr PFT.CheckPathYA
jsr STDIO.SetMLIPathYA
lda #S.FI.A.FULL
sta K.MLI.PARAMS+S.FI.A
lda #S.FI.T.DIR
@ -151,66 +158,91 @@ K.MKDir jsr PFT.CheckPathYA
rts
*/--------------------------------------
* # MkNod
* int mknod(const char *pathname, mode_t mode, dev_t dev);
* return a hFile for a given Device Name
* return a hFile for a given file descriptor.
* (CDEV, BDEV, DSOCKS, SSOCK, PIPE)
* ## C
* `hFILE mknod(const char *pathname, int mode, hFD fd);`
* ## ASM
* **In:**
* Y,A=DevName
* `>PUSHB fd`
* `>PUSHW mode`
* `>LDYA pathname`
* `>SYSCALL mknod`
* **Out:**
* CC = OK, CS = ERROR
* A = hFILE
* CC = OK, CS = ERROR
* A = hFILE
*\--------------------------------------
K.MkNod jsr K.GetDevByName Y,A=NAME
bcs .9
>STYA .1+1 pFD
stx .2+1 devID
K.MkNod >STYA ZPPtr1 pathname
ldy #S.FD.T
lda (pFD),y
cmp #S.FD.T.CDEV
bne .99
txa Pass DEV.ID to OPEN
ldx #IOCTL.OPEN
.1 jsr $FFFF SELF MODIFIED
bcs .9
>PULLW K.S.STAT+S.STAT.MODE
>PULLB K.S.STAT+S.STAT.DEV
>LDYAI S.FD.DEV
jsr K.GetMem0
bcs .9
>STYA ZPPtr3 Ptr3=S.FD
jsr K.GetMemPtr
bcs .99
ldy #S.FD.T
lda #S.FD.T.CDEV
sta (ZPPtr3),y
>STYA pFD
ldy #S.FD.DEV.DEVID
ldx DevMgr.NodCnt
cpx #K.NOD.MAX
beq .98
.2 lda #$ff Self Modified
sta (ZPPtr3),y
.1 dex
bpl .
lda
ldy #S.FD.DEV.DRVPTR
lda .1+1
sta (ZPPtr3),y
iny
lda .1+2
sta (ZPPtr3),y
txa
clc
.9 rts
.99 lda #MLI.E.IO
lda (pFD) #S.FD.T
tax
jmp (.8,x)
.8 .DA STDIO.IOERR REG
.DA STDIO.IOERR DIR
.DA STAT.MKNOD.CDEV
.DA STAT.MKNOD.BDEV
.DA STDIO.IOERR LNK
.DA STAT.MKNOD.DSOCK
.DA STAT.MKNOD.SSOCK
.DA STDIO.IOERR FIFO
.98 lda #K.E.OOH
sec
rts
.99 rts
*--------------------------------------
STAT.MKNOD.CDEV
STAT.MKNOD.BDEV
STAT.MKNOD.DSOCK
STAT.MKNOD.SSOCK
ldx #S.STAT
ldy #$ff
.1 inx
iny
lda (ZPPtr1),y
bne .1
txa
tay
lda #0
jsr K.GetMem
bcs .9
>STYA ZPPtr2
.9 rts
*/--------------------------------------
* # MKFIFO
* int mkfifo(const char *pathname, mode_t mode);
* return a hFILE to a new FIFO
* ## C
* `hFILE mkfifo(const char *pathname, int mode);`
* ## ASM
* **In:**
* `>PUSHW mode`
* `>LDYA pathname`
* `>SYSCALL mkfifo`
* **Out:**
* CC = OK, CS = ERROR
* A = hFILE
* CC = OK, CS = ERROR
* A = hFILE
*\--------------------------------------
K.MKFIFO >LDYAI 256
jsr K.GetMem