Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-10-05 16:58:38 +02:00
parent 006a952ac3
commit 17a6e2cb8f
13 changed files with 181 additions and 61 deletions

View File

@ -62,10 +62,17 @@ X = DevID
**Out:** **Out:**
# MKDev # MKDev
Create a hDEV
## C
`hDEV mkdev (S.FD * fd)`
## ASM
**In:** **In:**
Y,A = Ptr to FD.DEV `>LDYA FD.DEV`
`>SYSCALL mkdev
**Out:** **Out:**
A = DEVID A = hDEV
# OpenDir # OpenDir
@ -660,7 +667,7 @@ Prints C-Style String
## ASM ## ASM
**In:** **In:**
PrintF : (example is for printing Y,A as integer : format="Y,A= %I", 2 bytes) PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
`>PUSHYA` `>PUSHYA`
`...` `...`
`>PUSHBI bytecount` `>PUSHBI bytecount`

Binary file not shown.

Binary file not shown.

118
BIN/LSOF.S.txt Normal file
View File

@ -0,0 +1,118 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/LSOF
*--------------------------------------
.INB INC/MACROS.I
.INB INC/MLI.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
*--------------------------------------
pPD .EQ ZPBIN
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #4 ZP
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
L.FD.T .DA FD.T.REG
.DA FD.T.DIR
.DA FD.T.CDEV
.DA FD.T.BDEV
.DA FD.T.LNK
.DA FD.T.DSOCK
.DA FD.T.SSOCK
.DA FD.T.PIPE
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN >LDYA L.MSG0
>SYSCALL puts
>LDA.G FILE.ID
.1 tax
lda Nod.Table.hPath,x
beq .7
>SYSCALL GetMemPtr
>PUSHYA
>LDA.G FILE.ID
tax
lda Nod.Table.hFD,x
>SYSCALL GetMemPtr
>STYA pFD
lda (pFD)
tax
>PUSHW L.FD.T,x
>LDA.G FILE.ID
tax
lda Nod.Table.hFD,x
>PUSHA
txa
>PUSHA
>PUSHBI 6
>LDYA L.MSG1
>SYSCALL printf
.7 >INC.G FILE.ID
cmp #K.NOD.MAX
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
.9 rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "ID hFD Type Filepath"
MSG1 .AZ "%03d $%h %5s %s\r\n"
FD.T.REG .AZ "REG"
FD.T.DIR .AZ "DIR"
FD.T.CDEV .AZ "CDEV"
FD.T.BDEV .AZ "BDEV"
FD.T.LNK .AZ "LNK"
FD.T.DSOCK .AZ "DSOCK"
FD.T.SSOCK .AZ "SSOCK"
FD.T.PIPE .AZ "PIPE"
*--------------------------------------
.DUMMY
.OR 0
DS.START
FILE.ID .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/LSOF.S
ASM

View File

@ -318,10 +318,17 @@ AUTO 4,1
.EM .EM
*-------------------------------------- *--------------------------------------
.MA PUSHW .MA PUSHW
.DO ]#=2
lda ]1+1,]2
>PUSHA
lda ]1,]2
>PUSHA
.ELSE
lda ]1+1 lda ]1+1
>PUSHA >PUSHA
lda ]1 lda ]1
>PUSHA >PUSHA
.FIN
.EM .EM
*-------------------------------------- *--------------------------------------
.MA PULLW .MA PULLW

View File

@ -306,9 +306,10 @@ note : '$VAR' does NOT expand Variable
| Name | Status | Comment | K.Ver | | Name | Status | Comment | K.Ver |
| ---- | ------ | ------- | ----- | | ---- | ------ | ------- | ----- |
| MEM | Working | Old dump behavior is now MEMDUMP. New MEM command displays MEMSTAT (Main, Aux & Kernel Memory) | 0.92 | | MEM | Working | Old dump behavior is now MEMDUMP. New MEM command displays MEMSTAT (Main, Aux & Kernel Memory) | 0.92 |
| LSDEV | Working | | 0.92 | | LSDEV | Working | Dump device Drivers | 0.92 |
| PS | Working | | 0.92 | | LSOF | Working | List Open Files | 0.92 |
| MD | Working | | 0.92 | | PS | Working | List Processes| 0.92 |
| MD | Working | Make Directory| 0.92 |
| LS | Working | -A : Do Not Print . & .. | 0.92 | | LS | Working | -A : Do Not Print . & .. | 0.92 |
| | | -L : long listing with size/date... | | | | | -L : long listing with size/date... | |
| | | -R : Recurse subdirectories | | | | | -R : Recurse subdirectories | |

View File

@ -49,12 +49,12 @@ CS.RUN ldy #S.PS.ARGC
cmp #2 cmp #2
bcc .90 bcc .90
>PUSHBI 0 >PUSHWI 0 auxtype
>PUSHBI 0 type
>PUSHBI O.RDWR
lda #1 lda #1
>SYSCALL GetArg get /dev/xxx >SYSCALL GetArg get /dev/xxx
>SYSCALL fopen
>SYSCALL open
bcs .9 bcs .9
ldy #S.PS.hStdIn ldy #S.PS.hStdIn
@ -80,7 +80,7 @@ CS.RUN.LOOP0 >LDYA L.ENV.TERM
>PUSHW L.TELNETOPTS >PUSHW L.TELNETOPTS
ldy #S.PS.hStdOut ldy #S.PS.hStdOut
lda (pPs),y lda (pPs),y
>SYSCALL write >SYSCALL fwrite
bcc .2 sent! bcc .2 sent!
tay tay
@ -161,7 +161,7 @@ CS.RUN.IAC.CMD cmp #WILL
.7 ldy #S.PS.hStdOut .7 ldy #S.PS.hStdOut
lda (pPs),y lda (pPs),y
>SYSCALL write >SYSCALL fwrite
.8 jmp CS.RUN.LOOP1 .8 jmp CS.RUN.LOOP1
*-------------------------------------- *--------------------------------------
@ -233,7 +233,7 @@ CS.DOEVENT lda (pEvent)
CS.QUIT >LDA.G hDEV CS.QUIT >LDA.G hDEV
beq .8 beq .8
>SYSCALL close >SYSCALL fclose
.8 clc .8 clc
rts rts
@ -248,14 +248,6 @@ Wait.TimeOut sec
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
*PrintHEX pha
* >PUSHA
* >PUSHBI 1
* >LDYA L.MSG.DEBUG
* >SYSCALL printf
* pla
* rts
*--------------------------------------
CS.END CS.END
MSG.USAGE .AZ "Usage : GETTY <DEV> <PROGRAM>" MSG.USAGE .AZ "Usage : GETTY <DEV> <PROGRAM>"
MSG.GREETINGS .AZ "\r\nA2osX-GeTTY %d.%d\r\n" MSG.GREETINGS .AZ "\r\nA2osX-GeTTY %d.%d\r\n"

View File

@ -36,7 +36,7 @@ L.MSG.HELP .DA MSG.HELP
L.MSG.LOAD .DA MSG.LOAD L.MSG.LOAD .DA MSG.LOAD
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT ldy #S.PS.ARGC CS.RUN ldy #S.PS.ARGC
lda (pPs),y lda (pPs),y
beq .9 beq .9
@ -64,13 +64,14 @@ CS.INIT ldy #S.PS.ARGC
sec we do not want to stay in memory sec we do not want to stay in memory
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
CS.RUN CS.INIT
CS.DOEVENT sec
rts
*-------------------------------------- *--------------------------------------
CS.QUIT clc CS.QUIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.END CS.END
MSG.HELP .AZ "Usage: insdrv file.drv <args>" MSG.HELP .AZ "Usage: insdrv file.drv <args>"
MSG.LOAD .AZ "INSDRV:Loading %s...\r\n" MSG.LOAD .AZ "INSDRV:Loading %s...\r\n"

View File

@ -100,10 +100,15 @@ K.GetDevStatus.I
jmp (pDrv) jmp (pDrv)
*/-------------------------------------- */--------------------------------------
* # MKDev * # MKDev
* Create a hDEV
* ## C
* `hDEV mkdev (S.FD * fd)`
* ## ASM
* **In:** * **In:**
* Y,A = Ptr to FD.DEV * `>LDYA FD.DEV`
* `>SYSCALL mkdev
* **Out:** * **Out:**
* A = DEVID * A = hDEV
*\-------------------------------------- *\--------------------------------------
K.MKDev >STYA .1+1 K.MKDev >STYA .1+1
@ -128,7 +133,7 @@ K.MKDev >STYA .1+1
ldy #S.FD.DEV-1 ldy #S.FD.DEV-1
.1 lda $ffff,y SELF MODIFIED .1 lda $ffff,y SELF MODIFIED
.2 sta (pFD),y sta (pFD),y
dey dey
bpl .1 bpl .1

View File

@ -168,8 +168,9 @@ Kernel.Init3 sta SETALTZP
pla pla
jsr K.FreeMem ...discard... jsr K.FreeMem ...discard...
>PUSHBI 1
>LDYAI MSG.Init3.OK >LDYAI MSG.Init3.OK
>SYSCALL puts >SYSCALL printf
>DEBUGOA >DEBUGOA
@ -1031,9 +1032,9 @@ MSG.FLT .AZ "Path Filter..."
MSG.TSK .AZ "Task Manager..." MSG.TSK .AZ "Task Manager..."
MSG.Prefix .AZ "Root:%s\r\n" MSG.Prefix .AZ "Root:%s\r\n"
MSG.MMode .AZ "Ctrl-D Pressed, entering Maintenance mode..." MSG.MMode .AZ "Ctrl-D Pressed, entering Maintenance mode..."
MSG.Startup .AZ "Executing Kernel Startup Script...\r\nCommand Line:%s\r\n" MSG.Startup .AZ "Executing Startup Script:%s "
MSG.StartupErr .AZ "Failed : [$%h]\r\n" MSG.StartupErr .AZ "Failed : [$%h]\r\n"
MSG.Init3.OK .AZ "A2osX[Stage3]:Complete." MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n"
*-------------------------------------- *--------------------------------------
MSG.CPU .AZ "Checking CPU..." MSG.CPU .AZ "Checking CPU..."
MSG.CPUTYPE .DA MSG.6502 MSG.CPUTYPE .DA MSG.6502

View File

@ -31,17 +31,17 @@ IO.Open.I jsr STDIO.SetMLIPathYA
ldx #5 $/DEV/ ldx #5 $/DEV/
cpx K.MLI.PATH cpx K.MLI.PATH
bcs .2 bcs IO.OPEN.REG
.1 lda K.MLI.PATH,x .1 lda K.MLI.PATH,x
cmp IO.DEVDIR,x cmp IO.DEVDIR,x
bne .2 bne IO.OPEN.REG
dex dex
bne .1 bne .1
*-------------------------------------- *--------------------------------------
* CDEV,BDEV,DSOCK,SSOCK,PIPE * CDEV,BDEV,DSOCK,SSOCK,PIPE
*-------------------------------------- *--------------------------------------
.2 >LDYAI K.MLI.PATH+6 skip $/DEV/ >LDYAI K.MLI.PATH+6 skip $/DEV/
jsr K.GetDevByName jsr K.GetDevByName
bcs IO.OPEN.RTS bcs IO.OPEN.RTS
@ -52,9 +52,9 @@ IO.Open.I jsr STDIO.SetMLIPathYA
lda (pFD) #S.FD.T lda (pFD) #S.FD.T
tax tax
pla pla
jmp (.3,x) jmp (.2,x)
.3 .DA STDIO.IOERR REG .2 .DA STDIO.IOERR REG
.DA STDIO.IOERR DIR .DA STDIO.IOERR DIR
.DA IO.OPEN.CDEV .DA IO.OPEN.CDEV
.DA STDIO.IOERR BDEV .DA STDIO.IOERR BDEV

View File

@ -758,15 +758,13 @@ K.GetChar ldy #S.PS.hStdIn
* **Out:** * **Out:**
* CC = success * CC = success
* A = char * A = char
*\-----------a--------------------------- *\--------------------------------------
K.GetC jsr STDIO.GetHFile K.GetC jsr STDIO.GetHFile
bcs K.GetC.9 bcs K.GetC.9
K.GetC.I >LDYAI K.IOBuf K.GetC.I >PUSHWI 1
>STYA K.S.IOCTL+S.IOCTL.BUFPTR >PUSHWI K.IOBuf
lda #1
sta K.S.IOCTL+S.IOCTL.BYTECNT
stz K.S.IOCTL+S.IOCTL.BYTECNT+1
jsr IO.READ.I jsr IO.READ.I
bcs K.GetC.9 bcs K.GetC.9
lda K.IOBuf lda K.IOBuf
@ -1012,7 +1010,6 @@ K.FOpen.RTS rts
* **Out:** * **Out:**
*\-------------------------------------- *\--------------------------------------
K.FClose jsr PFT.CheckNodeA K.FClose jsr PFT.CheckNodeA
sta .8+1 save hFILE
tax tax
lda Nod.Table.hPath,x lda Nod.Table.hPath,x
@ -1021,18 +1018,13 @@ K.FClose jsr PFT.CheckNodeA
stz Nod.Table.hPath,x stz Nod.Table.hPath,x
jsr K.FreeMem discard filename jsr K.FreeMem discard filename
.1 lda Nod.Table.hFD,x
jsr K.Close
.8 ldx #$ff SELF MODIFIED
lda Nod.Table.hFD,x lda Nod.Table.hFD,x
stz Nod.Table.hFD,x stz Nod.Table.hFD,x
jmp K.FreeMem discard filename jmp K.Close
.9 lda #K.E.INVH .9 lda #K.E.INVH
sec sec
rts K.FClose.RTS rts
*/-------------------------------------- */--------------------------------------
* # FRead * # FRead
* Read bytes from file * Read bytes from file
@ -1049,11 +1041,9 @@ K.FClose jsr PFT.CheckNodeA
*\-------------------------------------- *\--------------------------------------
K.FRead jsr PFT.CheckNodeA K.FRead jsr PFT.CheckNodeA
jsr STDIO.GetHFile jsr STDIO.GetHFile
bcs .9 bcs K.FClose.RTS
jmp K.Read jmp IO.Read.I
.9 rts
*/-------------------------------------- */--------------------------------------
* # FWrite * # FWrite
* Write bytes to file * Write bytes to file
@ -1070,11 +1060,9 @@ K.FRead jsr PFT.CheckNodeA
*\-------------------------------------- *\--------------------------------------
K.FWrite jsr PFT.CheckNodeA K.FWrite jsr PFT.CheckNodeA
jsr STDIO.GetHFile jsr STDIO.GetHFile
bcs .9 bcs K.FClose.RTS
jmp K.Write jmp IO.Write.I
.9 rts
*/-------------------------------------- */--------------------------------------
* # FFlush * # FFlush
* ## C * ## C