Kernel 0.92

This commit is contained in:
Rémy GIBERT 2018-12-18 15:37:07 +01:00
parent c3e396238a
commit be8d29bc45
24 changed files with 195 additions and 226 deletions

View File

@ -50,14 +50,6 @@ none
## RETURN VALUE
Y,A = Ptr to installed driver
# GetDevByID
A = DevID
## RETURN VALUE
CC = OK, CS = ERROR
Y,A = FD
X = hFD
# GetDevByName
Y,A = Ptr to device name (C-String)
@ -552,13 +544,6 @@ Load a file in AUX memory (Stock Objects)
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# GetPSStat
**In:**
Y,A = Ptr to K.PS.MAX*2+1 bytes buffer
## RETURN VALUE
Buffer filled with PS stats
# ExecL
## C
@ -598,13 +583,6 @@ A = Child PSID
## RETURN VALUE
A = Child PSID
# GetPSStatus
**In:**
A = PID
## RETURN VALUE
A = Status Byte
# Stat
Return information about a file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,11 +8,16 @@ AUTO 4,1
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/LIBBLKDEV.I
*--------------------------------------
ZPPtr1 .EQ ZPBIN
ZPPtr2 .EQ ZPBIN+2
ZPPtrFD .EQ ZPBIN+4
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZS.END
.ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -20,11 +25,12 @@ 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 #32 SS
.DA #6 ZP
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #32 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
@ -82,17 +88,17 @@ CS.INIT ldy #S.PS.ARGC
sta (pData),y
bra .1
.4 >LDA.G hDevFD
.4 >LDA.G hDevID
bne .5 Already have a dev...go get VolName
>LDYA ZPPtr1
>SYSCALL GetDevByName
bcs .99
>STYA ZPPtrFD
txa
>SYSCALL GetDevByID
txa
>STA.G hDevID
lda Dev.Table.hFD,x
>STA.G hDevFD
bra .1
.5 ldy #$ff
@ -205,20 +211,19 @@ CS.RUN.InitCat >LDA.G CatSize
*--------------------------------------
CS.RUN.BuildCat >PUSHEA.G DIB
>LDA.G hDevFD
>SYSCALL GetDevStatus
bcs .99
lda ZPPtrFD
* clc
adc #S.FD.DEV.NAME
sta ZPPtr2
lda ZPPtrFD+1
adc /S.FD.DEV.NAME
sta ZPPtr2+1
>PUSHEA.G VolName
>PUSHW.G DIB+S.DIB.SIZE
>PUSHW ZPPtr2
>LDA.G hDevID
tax
lda Dev.Table.hPath,x
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI 6
>LDYA L.MSG.INIT
>SYSCALL printf
@ -259,6 +264,7 @@ CS.RUN.BuildCat >PUSHEA.G DIB
CS.RUN.WriteCat >PUSHEA.G IOCTL
>PUSHBI IOCTL.WRITEBLOCK
>LDA.G hDevFD
>SYSCALL IOCTL
bcs .9
@ -333,7 +339,8 @@ DS.START
ArgIndex .BS 1
bLL .BS 1
VolName .BS 16
hDevFD .BS 5
hDevID .BS 1
hDevFD .BS 1
CatSize .BS 1
CatOptions .BS 1
BlkCnt .BS 1

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF SBIN/IPCONFIG2
.TF BIN/DEV/IPCONFIG2
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I

View File

@ -8,11 +8,18 @@ AUTO 4,1
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
*--------------------------------------
PAGELEN .EQ 22
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
.DUMMY
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZPPTR2 .BS 2
ZPPSPtr .BS 2
ZS.END
.ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -20,11 +27,12 @@ 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 #64 SS
.DA #4 ZP
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #32 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
@ -182,7 +190,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
ldy #S.MEM.OWNERPID
lda (ZPPTR1),y
>SYSCALL GetPSStatus
jsr CS.RUN.CHECKPS
bcc .12
>PUSHBI 0
@ -260,6 +268,18 @@ CS.RUN.PRINTMEM.EXIT
rts
*--------------------------------------
CS.RUN.CHECKPS ldx #0
.1 cmp PS.Table.PID,x
beq .8
inx
cpx K.PS.MAX
bne .1
rts CS
.8 clc
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------

View File

@ -10,7 +10,13 @@ AUTO 4,1
.INB INC/A2OSX.I
.INB INC/KERNEL.I
*--------------------------------------
ZPPtr .EQ ZPBIN
.DUMMY
.OR ZPBIN
ZS.START
ZPPSPtr .BS 2
ZPArgV .BS 2
ZS.END
.ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -18,11 +24,12 @@ 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 #64 SS
.DA #2 ZP
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
@ -32,74 +39,73 @@ CS.START cld
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSGK .DA MSGK
L.MSG1 .DA MSG1
L.MSG2 .DA MSG2
L.MSG3 .DA MSG3
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN >LDYA pData
>SYSCALL GetPSStat
>LDYA L.MSG0
CS.RUN >LDYA L.MSG0
>SYSCALL puts
>PUSHB.G PS.KCPU
>PUSHBI 1
>LDYA L.MSGK
>SYSCALL printf
lda #1
>STA.G PS.Index
>LDA.G PS.Index
.1 >INC.G PS.Index
tay
lda (pData),y PID
.1 tax
lda PS.Table.PID,x
beq .7
lda PS.Table.hPS,x
>SYSCALL GetMemPtr
>STYA ZPPtr
>STYA ZPPSPtr
ldy #S.PS.hARGV
lda (ZPPtr),y
lda (ZPPSPtr),y
>SYSCALL GetMemPtr
>PUSHYA
>STYA ZPArgV
ldy #S.PS.PPID
lda (ZPPtr),y
lda (ZPPSPtr),y
>PUSHA Parent PID
ldy #S.PS.UID
lda (ZPPtr),y
lda (ZPPSPtr),y
>PUSHA
jsr CS.RUN.DecodeFlags
>PUSHEA.G PS.FLAGS
>INC.G PS.Index
tay
lda (pData),y
>LDA.G PS.Index
tax
lda PS.Table.Stats,x
>PUSHA CPU%
ldy #S.PS.PID
lda (ZPPtr),y
lda (ZPPSPtr),y
>PUSHA
>PUSHBI 8
>LDYA L.MSG1
>SYSCALL printf
bcs .9
.7 >DEC.G PS.COUNT
jsr CS.RUN.PrintArgs
bcs .9
>SLEEP
.7 >INC.G PS.Index
cmp #K.PS.MAX
bne .1
.8
* lda #0 tell Kernel that all done ok, but
.8 lda #0 tell Kernel that all done ok, but
sec we do not want to stay in memory
rts
.9 rts
*--------------------------------------
CS.RUN.DecodeFlags
lda (ZPPtr) Get flags
lda (ZPPSPtr) Get flags
ldy #PS.FLAGS+7
ldx #7
@ -117,6 +123,35 @@ CS.RUN.DecodeFlags
bpl .2
rts
*--------------------------------------
CS.RUN.PrintArgs
.1 lda (ZPArgV)
beq .8
>PUSHW ZPArgV
>PUSHBI 2
>LDYA L.MSG2
>SYSCALL printf
bcs .9
.2 inc ZPArgV
bne .3
inc ZPArgV+1
.3 lda (ZPArgV)
bne .2
inc ZPArgV
bne .1
inc ZPArgV+1
bra .1
.8 >PUSHBI 0
>LDYA L.MSG3
>SYSCALL printf
.9 rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
@ -125,16 +160,14 @@ CS.QUIT clc
*--------------------------------------
CS.END
MSG0 .AZ "ID CPU% Flags UID PID Command Line"
MSGK .AZ "000 %03d\% -------- 000 --- *KERNEL*\r\n"
MSG1 .AZ "%03d %03d\% %s %03d %03d %s\r\n"
MSG1 .AZ "\e[7l%03d %03d\% %s %03d %03d"
MSG2 .AZ " %s"
MSG3 .AZ "\r\n"
MSG.FLAGS .AS "IRQDHSed"
*--------------------------------------
.DUMMY
.OR 0
DS.START
PS.COUNT .BS 1
PS.KCPU .BS 1
PS.DATA .BS K.PS.MAX*2
PS.Index .BS 1
PS.FLAGS .BS 9
DS.END

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF DRV/DHGR.DRV
.TF DRV/GUI/DHGR.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF DRV/MOUSE.DRV
.TF DRV/GUI/MOUSE.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I

View File

@ -4,8 +4,10 @@ AUTO 4,1
#!/BIN/SHELL
ECHO *** A2osX INIT Script ***
SET PS1 = '$PWD'
SET PATH = ${PATH}BIN/DEV/
# Main Screen
SET PATH = ${PATH}:${ROOT}BIN/DEV/
SET DRV = ${DRV}:${ROOT}DRV/GUI/
SET LIB = ${LIB}:${ROOT}LIB/GUI/
# Main Screens
GETTY /DEV/TTY1 ${ROOT}SBIN/LOGIN &
GETTY /DEV/TTY2 ${ROOT}SBIN/LOGIN &
GETTY /DEV/TTY3 ${ROOT}SBIN/LOGIN &

View File

@ -4,9 +4,11 @@ AUTO 4,1
#!/BIN/SHELL
ECHO *** A2osX INIT Script ***
SET PS1 = '$PWD'
# Main Screen
INSDRV CONSOLE.DRV
STARTPROC GETTY /DEV/CON ${ROOT}SBIN/LOGIN
# Main Screens
GETTY /DEV/TTY1 ${ROOT}SBIN/LOGIN &
GETTY /DEV/TTY2 ${ROOT}SBIN/LOGIN &
GETTY /DEV/TTY3 ${ROOT}SBIN/LOGIN &
GETTY /DEV/TTY4 ${ROOT}SBIN/LOGIN &
# Serial Login
#INSDRV SSC.DRV 9600,N,8,1,X
#INSDRV SSC.I.DRV 9600,N,8,1,X

View File

@ -170,7 +170,7 @@ SYS.Rename .EQ $42
* .EQ $44
* .EQ $46
SYS.GetDevByID .EQ $48
* .EQ $48
SYS.GetDevByName .EQ $4A
SYS.GetDevStatus .EQ $4C
SYS.MKDev .EQ $4E
@ -229,8 +229,8 @@ SYS.Kill .EQ $A6
* .EQ $A8
SYS.GetMemStat .EQ $AA
SYS.GetPSStatus .EQ $AC
SYS.GetPSStat .EQ $AE
* .EQ $AC
* .EQ $AE
SYS.Args2ArgV .EQ $B0
SYS.ArgV .EQ $B2

View File

@ -12,7 +12,12 @@ AUTO 4,1
*--------------------------------------
TIMEOUT.MAX .EQ 100 10 sec.
*--------------------------------------
ZPPtr1 .EQ ZPBIN
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZS.END
.ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -22,10 +27,10 @@ CS.START cld
.DA #1 BIN Layout Version 1
.DA #S.PS.F.EVENT S.PS.F
.DA #0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #64 SS
.DA #2 ZP
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #32 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table

View File

@ -9,7 +9,12 @@ AUTO 4,1
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
.DUMMY
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZS.END
.ED
*--------------------------------------
INPUT.BufPtr.SIZE .EQ 16
*--------------------------------------
@ -21,10 +26,10 @@ CS.START cld
.DA #1 BIN Layout Version 1
.DA #S.PS.F.EVENT S.PS.F
.DA #0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #64 SS
.DA #2 ZP SS
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table

View File

@ -387,14 +387,12 @@ CORE.ScrSel and #$0F
cmp A2osX.ASCREEN Same as active screen...nothing to do
beq .8
jsr K.GetDevByID
bcs .8
phx
tax
>PUSHWI 0 Param
>PUSHBI IOCTL.CONTROL request
pla ID
lda Dev.Table.hFD,x
jsr K.IOCTL

View File

@ -2,24 +2,6 @@ NEW
PREFIX
AUTO 4,1
*/--------------------------------------
* # GetDevByID
* A = DevID
* ## RETURN VALUE
* CC = OK, CS = ERROR
* Y,A = FD
* X = hFD
*\--------------------------------------
K.GetDevByID cmp DevMgr.DevCnt
bcs K.GetDev.NODEV
tax
lda Dev.Table.hFD,x
beq K.GetDev.NODEV
pha
jsr K.GetMemPtr
plx
rts
*/--------------------------------------
* # GetDevByName
* Y,A = Ptr to device name (C-String)
* ## RETURN VALUE
@ -159,7 +141,7 @@ K.MKDev jsr MEM.SPtr1PPtr2 ptr1=fd, ptr2=name
txa
inc DevMgr.DevCnt
clc
* clc
rts
*--------------------------------------
MAN

View File

@ -203,7 +203,6 @@ DRV.NULL cld
.DA DRV.NULL.CLOSE
.DA DRV.NULL.READ
.DA DRV.NULL.WRITE
.DA A2osX.BADCALL IRQ
*--------------------------------------
DRV.NULL.STATUS >LDYAI DRV.NULL.DIB
jmp DRV.STATUS.YA

View File

@ -109,6 +109,12 @@ Kernel.Init3 sta SETALTZP
jsr MemMgrInit
>LDYAI CORE.S.PS0 Select Process 0 (Kernel)
>STYA pPs
>LDYAI K.STACKTOP
>STYA pStack
>PUSHWI FD.NULL.NAME
>LDYAI FD.NULL
>SYSCALL MKDev
@ -355,13 +361,7 @@ SysScrInit.TTYPtrs
rts
*--------------------------------------
PS0.Init >LDYAI CORE.S.PS0 Select Process 0 (Kernel)
>STYA pPs
>LDYAI K.STACKTOP
>STYA pStack
>PUSHWI 0 Aux type
PS0.Init >PUSHWI 0 Aux type
>PUSHBI S.FI.T.TXT
>PUSHBI O.RDWR

View File

@ -46,7 +46,7 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.Rename
.DA 0
.DA 0
.DA K.GetDevByID
.DA 0
.DA K.GetDevByName
.DA K.GetDevStatus
.DA K.MKDev
@ -104,8 +104,8 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.Kill
.DA 0
.DA K.GetMemStat
.DA K.GetPSStatus
.DA K.GetPSStat
.DA 0
.DA 0
.DA K.Args2ArgV $B0
.DA K.ArgV

View File

@ -748,43 +748,6 @@ MEM.PutCharPtr2 sta (ZPPtr2)
bne .8
inc ZPPtr2+1
.8 rts
*/--------------------------------------
* # GetPSStat
* **In:**
* Y,A = Ptr to K.PS.MAX*2+1 bytes buffer
* ## RETURN VALUE
* Buffer filled with PS stats
*\--------------------------------------
K.GetPSStat >STYA ZPPtr1
ldx #0
ldy #1
lda CORE.InKernelStats
sta (ZPPtr1),y
iny
.1 lda PS.Table.PID,x
beq .2
lda PS.Table.hPS,x
sta (ZPPtr1),y
iny
lda PS.Table.Stats,x
sta (ZPPtr1),y
iny
.2 inx
cpx #K.PS.MAX
bne .1
.9 tya
lsr
dec
sta (ZPPtr1)
rts
*--------------------------------------
* 6502/65C02/65816 OPCODES
* Bit 3 : 1 = absolute addressing

View File

@ -565,10 +565,6 @@ K.Kill cmp #0
rts
.99 >RET 1
*--------------------------------------
K.Kill.0 clc
rts
*--------------------------------------
K.Kill.1 lda (ZPPtr1)
@ -576,21 +572,9 @@ K.Kill.1 lda (ZPPtr1)
ora #S.PS.F.QUIT
sta (ZPPtr1)
K.Kill.0
clc
rts
*/--------------------------------------
* # GetPSStatus
* **In:**
* A = PID
* ## RETURN VALUE
* A = Status Byte
*\--------------------------------------
K.GetPSStatus jsr CORE.GetPSByID
bcs .9
>STYA ZPPtr1
lda (ZPPtr1)
.9 rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.PS

View File

@ -544,7 +544,7 @@ PrintF.F clc
rts
.9 sec
rts
PrintF.H.9 rts
*--------------------------------------
PrintF.HH jsr PrintF.GetByte
bcs PrintF.H.9
@ -559,7 +559,6 @@ PrintF.H.1 pha
jsr PrintF.NN.1
pla
bra PrintF.N.1
PrintF.H.9 rts
*--------------------------------------
PrintF.N jsr PrintF.GetByte
bcs PrintF.H.9

View File

@ -709,36 +709,34 @@ DRV.TERM.IAC ldy #S.DCB.TTY.INBUFFER
bne Csi.Home.8 wait for ending SE....keep bIACMode
.1 cmp #IAC
beq .9
beq COUT.IAC.SB.9
sec
sbc #SB
bcc .9
bcc COUT.IAC.SB.9
asl
tax
ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y Get SUBCMD in A
cpx #10
bcc .8
.9 bra RESET.MODE
bcs COUT.IAC.SB.9
.8 jmp (.80,x)
jmp (.8,x)
.80 .DA COUT.IAC.SB
.8 .DA COUT.IAC.SB
.DA COUT.IAC.WILL
.DA COUT.IAC.WONT
.DA COUT.IAC.DO
.DA COUT.IAC.DONT
*--------------------------------------
COUT.IAC.SB cmp #TELOPT.TTYPE
bne .9
bne COUT.IAC.SB.9
ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y
cmp #SB.SEND
bne .9
bne COUT.IAC.SB.9
ldx #0
@ -748,7 +746,7 @@ COUT.IAC.SB cmp #TELOPT.TTYPE
cpx #SB.IS.TTYPE.LEN
bne .1
.9 bra RESET.MODE
COUT.IAC.SB.9 bra COUT.IAC.EXIT
*--------------------------------------
COUT.IAC.WILL ldx #WILLDO.CNT-1
@ -764,7 +762,7 @@ COUT.IAC.WILL ldx #WILLDO.CNT-1
dex
bpl .2
bra .9
bra COUT.IAC.EXIT
.7 ldx #DO
.HS 2C BIT ABS
@ -772,11 +770,6 @@ COUT.IAC.WILL ldx #WILLDO.CNT-1
.8 ldx #DONT
bra COUT.IAC.SendAX
.9 bra RESET.MODE
*--------------------------------------
COUT.IAC.WONT
bra RESET.MODE
*--------------------------------------
COUT.IAC.DO ldx #DOWILL.CNT-1
@ -792,7 +785,7 @@ COUT.IAC.DO ldx #DOWILL.CNT-1
dex
bpl .2
bra COUT.IAC.SendAX.9
bra COUT.IAC.EXIT
.7 ldx #WILL
.HS 2C BIT ABS
@ -809,11 +802,10 @@ COUT.IAC.SendAX
pla
jsr Char.Out.Put
COUT.IAC.SendAX.9
bra RESET.MODE
*--------------------------------------
COUT.IAC.WONT
COUT.IAC.DONT
bra RESET.MODE
COUT.IAC.EXIT
*--------------------------------------
RESET.MODE lda #0