mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-24 13:32:11 +00:00
Kernel 0.9.2
This commit is contained in:
parent
006a952ac3
commit
17a6e2cb8f
@ -62,10 +62,17 @@ X = DevID
|
||||
**Out:**
|
||||
|
||||
# MKDev
|
||||
Create a hDEV
|
||||
|
||||
## C
|
||||
`hDEV mkdev (S.FD * fd)`
|
||||
|
||||
## ASM
|
||||
**In:**
|
||||
Y,A = Ptr to FD.DEV
|
||||
`>LDYA FD.DEV`
|
||||
`>SYSCALL mkdev
|
||||
**Out:**
|
||||
A = DEVID
|
||||
A = hDEV
|
||||
|
||||
# OpenDir
|
||||
|
||||
@ -660,7 +667,7 @@ Prints C-Style String
|
||||
|
||||
## ASM
|
||||
**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`
|
||||
`...`
|
||||
`>PUSHBI bytecount`
|
||||
|
Binary file not shown.
Binary file not shown.
118
BIN/LSOF.S.txt
Normal file
118
BIN/LSOF.S.txt
Normal 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
|
@ -318,10 +318,17 @@ AUTO 4,1
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA PUSHW
|
||||
.DO ]#=2
|
||||
lda ]1+1,]2
|
||||
>PUSHA
|
||||
lda ]1,]2
|
||||
>PUSHA
|
||||
.ELSE
|
||||
lda ]1+1
|
||||
>PUSHA
|
||||
lda ]1
|
||||
>PUSHA
|
||||
.FIN
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA PULLW
|
||||
|
@ -306,9 +306,10 @@ note : '$VAR' does NOT expand Variable
|
||||
| Name | Status | Comment | K.Ver |
|
||||
| ---- | ------ | ------- | ----- |
|
||||
| MEM | Working | Old dump behavior is now MEMDUMP. New MEM command displays MEMSTAT (Main, Aux & Kernel Memory) | 0.92 |
|
||||
| LSDEV | Working | | 0.92 |
|
||||
| PS | Working | | 0.92 |
|
||||
| MD | Working | | 0.92 |
|
||||
| LSDEV | Working | Dump device Drivers | 0.92 |
|
||||
| LSOF | Working | List Open Files | 0.92 |
|
||||
| PS | Working | List Processes| 0.92 |
|
||||
| MD | Working | Make Directory| 0.92 |
|
||||
| LS | Working | -A : Do Not Print . & .. | 0.92 |
|
||||
| | | -L : long listing with size/date... | |
|
||||
| | | -R : Recurse subdirectories | |
|
||||
|
@ -49,12 +49,12 @@ CS.RUN ldy #S.PS.ARGC
|
||||
cmp #2
|
||||
bcc .90
|
||||
|
||||
>PUSHBI 0
|
||||
|
||||
>PUSHWI 0 auxtype
|
||||
>PUSHBI 0 type
|
||||
>PUSHBI O.RDWR
|
||||
lda #1
|
||||
>SYSCALL GetArg get /dev/xxx
|
||||
|
||||
>SYSCALL open
|
||||
>SYSCALL fopen
|
||||
bcs .9
|
||||
|
||||
ldy #S.PS.hStdIn
|
||||
@ -80,7 +80,7 @@ CS.RUN.LOOP0 >LDYA L.ENV.TERM
|
||||
>PUSHW L.TELNETOPTS
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
>SYSCALL write
|
||||
>SYSCALL fwrite
|
||||
bcc .2 sent!
|
||||
|
||||
tay
|
||||
@ -161,7 +161,7 @@ CS.RUN.IAC.CMD cmp #WILL
|
||||
|
||||
.7 ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
>SYSCALL write
|
||||
>SYSCALL fwrite
|
||||
|
||||
.8 jmp CS.RUN.LOOP1
|
||||
*--------------------------------------
|
||||
@ -233,7 +233,7 @@ CS.DOEVENT lda (pEvent)
|
||||
CS.QUIT >LDA.G hDEV
|
||||
beq .8
|
||||
|
||||
>SYSCALL close
|
||||
>SYSCALL fclose
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
@ -248,14 +248,6 @@ Wait.TimeOut sec
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
*PrintHEX pha
|
||||
* >PUSHA
|
||||
* >PUSHBI 1
|
||||
* >LDYA L.MSG.DEBUG
|
||||
* >SYSCALL printf
|
||||
* pla
|
||||
* rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
MSG.USAGE .AZ "Usage : GETTY <DEV> <PROGRAM>"
|
||||
MSG.GREETINGS .AZ "\r\nA2osX-GeTTY %d.%d\r\n"
|
||||
|
@ -36,7 +36,7 @@ L.MSG.HELP .DA MSG.HELP
|
||||
L.MSG.LOAD .DA MSG.LOAD
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT ldy #S.PS.ARGC
|
||||
CS.RUN ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
beq .9
|
||||
|
||||
@ -64,13 +64,14 @@ CS.INIT ldy #S.PS.ARGC
|
||||
sec we do not want to stay in memory
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
CS.RUN
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
CS.INIT
|
||||
*--------------------------------------
|
||||
CS.QUIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
MSG.HELP .AZ "Usage: insdrv file.drv <args>"
|
||||
MSG.LOAD .AZ "INSDRV:Loading %s...\r\n"
|
||||
|
@ -100,10 +100,15 @@ K.GetDevStatus.I
|
||||
jmp (pDrv)
|
||||
*/--------------------------------------
|
||||
* # MKDev
|
||||
* Create a hDEV
|
||||
* ## C
|
||||
* `hDEV mkdev (S.FD * fd)`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* Y,A = Ptr to FD.DEV
|
||||
* `>LDYA FD.DEV`
|
||||
* `>SYSCALL mkdev
|
||||
* **Out:**
|
||||
* A = DEVID
|
||||
* A = hDEV
|
||||
*\--------------------------------------
|
||||
K.MKDev >STYA .1+1
|
||||
|
||||
@ -128,7 +133,7 @@ K.MKDev >STYA .1+1
|
||||
ldy #S.FD.DEV-1
|
||||
|
||||
.1 lda $ffff,y SELF MODIFIED
|
||||
.2 sta (pFD),y
|
||||
sta (pFD),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
|
@ -168,8 +168,9 @@ Kernel.Init3 sta SETALTZP
|
||||
pla
|
||||
jsr K.FreeMem ...discard...
|
||||
|
||||
>PUSHBI 1
|
||||
>LDYAI MSG.Init3.OK
|
||||
>SYSCALL puts
|
||||
>SYSCALL printf
|
||||
|
||||
>DEBUGOA
|
||||
|
||||
@ -1031,9 +1032,9 @@ MSG.FLT .AZ "Path Filter..."
|
||||
MSG.TSK .AZ "Task Manager..."
|
||||
MSG.Prefix .AZ "Root:%s\r\n"
|
||||
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.Init3.OK .AZ "A2osX[Stage3]:Complete."
|
||||
MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n"
|
||||
*--------------------------------------
|
||||
MSG.CPU .AZ "Checking CPU..."
|
||||
MSG.CPUTYPE .DA MSG.6502
|
||||
|
@ -31,17 +31,17 @@ IO.Open.I jsr STDIO.SetMLIPathYA
|
||||
|
||||
ldx #5 $/DEV/
|
||||
cpx K.MLI.PATH
|
||||
bcs .2
|
||||
bcs IO.OPEN.REG
|
||||
|
||||
.1 lda K.MLI.PATH,x
|
||||
cmp IO.DEVDIR,x
|
||||
bne .2
|
||||
bne IO.OPEN.REG
|
||||
dex
|
||||
bne .1
|
||||
*--------------------------------------
|
||||
* CDEV,BDEV,DSOCK,SSOCK,PIPE
|
||||
*--------------------------------------
|
||||
.2 >LDYAI K.MLI.PATH+6 skip $/DEV/
|
||||
>LDYAI K.MLI.PATH+6 skip $/DEV/
|
||||
|
||||
jsr K.GetDevByName
|
||||
bcs IO.OPEN.RTS
|
||||
@ -52,9 +52,9 @@ IO.Open.I jsr STDIO.SetMLIPathYA
|
||||
lda (pFD) #S.FD.T
|
||||
tax
|
||||
pla
|
||||
jmp (.3,x)
|
||||
jmp (.2,x)
|
||||
|
||||
.3 .DA STDIO.IOERR REG
|
||||
.2 .DA STDIO.IOERR REG
|
||||
.DA STDIO.IOERR DIR
|
||||
.DA IO.OPEN.CDEV
|
||||
.DA STDIO.IOERR BDEV
|
||||
|
@ -758,15 +758,13 @@ K.GetChar ldy #S.PS.hStdIn
|
||||
* **Out:**
|
||||
* CC = success
|
||||
* A = char
|
||||
*\-----------a---------------------------
|
||||
*\--------------------------------------
|
||||
K.GetC jsr STDIO.GetHFile
|
||||
bcs K.GetC.9
|
||||
|
||||
K.GetC.I >LDYAI K.IOBuf
|
||||
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
|
||||
lda #1
|
||||
sta K.S.IOCTL+S.IOCTL.BYTECNT
|
||||
stz K.S.IOCTL+S.IOCTL.BYTECNT+1
|
||||
K.GetC.I >PUSHWI 1
|
||||
>PUSHWI K.IOBuf
|
||||
|
||||
jsr IO.READ.I
|
||||
bcs K.GetC.9
|
||||
lda K.IOBuf
|
||||
@ -1012,7 +1010,6 @@ K.FOpen.RTS rts
|
||||
* **Out:**
|
||||
*\--------------------------------------
|
||||
K.FClose jsr PFT.CheckNodeA
|
||||
sta .8+1 save hFILE
|
||||
tax
|
||||
|
||||
lda Nod.Table.hPath,x
|
||||
@ -1021,18 +1018,13 @@ K.FClose jsr PFT.CheckNodeA
|
||||
stz Nod.Table.hPath,x
|
||||
jsr K.FreeMem discard filename
|
||||
|
||||
.1 lda Nod.Table.hFD,x
|
||||
jsr K.Close
|
||||
|
||||
.8 ldx #$ff SELF MODIFIED
|
||||
lda Nod.Table.hFD,x
|
||||
|
||||
stz Nod.Table.hFD,x
|
||||
jmp K.FreeMem discard filename
|
||||
jmp K.Close
|
||||
|
||||
.9 lda #K.E.INVH
|
||||
sec
|
||||
rts
|
||||
K.FClose.RTS rts
|
||||
*/--------------------------------------
|
||||
* # FRead
|
||||
* Read bytes from file
|
||||
@ -1049,11 +1041,9 @@ K.FClose jsr PFT.CheckNodeA
|
||||
*\--------------------------------------
|
||||
K.FRead jsr PFT.CheckNodeA
|
||||
jsr STDIO.GetHFile
|
||||
bcs .9
|
||||
bcs K.FClose.RTS
|
||||
|
||||
jmp K.Read
|
||||
|
||||
.9 rts
|
||||
jmp IO.Read.I
|
||||
*/--------------------------------------
|
||||
* # FWrite
|
||||
* Write bytes to file
|
||||
@ -1070,11 +1060,9 @@ K.FRead jsr PFT.CheckNodeA
|
||||
*\--------------------------------------
|
||||
K.FWrite jsr PFT.CheckNodeA
|
||||
jsr STDIO.GetHFile
|
||||
bcs .9
|
||||
bcs K.FClose.RTS
|
||||
|
||||
jmp K.Write
|
||||
|
||||
.9 rts
|
||||
jmp IO.Write.I
|
||||
*/--------------------------------------
|
||||
* # FFlush
|
||||
* ## C
|
||||
|
Loading…
Reference in New Issue
Block a user