Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-10-17 17:31:29 +02:00
parent 929e47b612
commit 98617e93dc
9 changed files with 65 additions and 65 deletions

Binary file not shown.

Binary file not shown.

View File

@ -105,8 +105,8 @@ Dev.Table.hFD .EQ $0C20 K.Dev.MAX
Nod.Table.hPath .EQ $0C40 K.NOD.MAX
Nod.Table.hFD .EQ $0C60 K.NOD.MAX
*--------------------------------------
PS.Table.hMem .EQ $0C80 K.PS.MAX
PS.Table.PID .EQ $0CA0 K.PS.MAX
PS.Table.PID .EQ $0C80 K.PS.MAX
PS.Table.hPS .EQ $0CA0 K.PS.MAX
PS.Table.Hits .EQ $0CC0 K.PS.MAX
PS.Table.Stats .EQ $0CE0 K.PS.MAX
*--------------------------------------

View File

@ -133,7 +133,8 @@ CS.INIT jsr SetPWD
ldy #S.PS.ARGC
lda (pPs),y
cmp #1
beq .1 no arg, continue starting interactive
jmp CSH.Init
@ -150,7 +151,7 @@ CS.INIT jsr SetPWD
*--------------------------------------
CS.RUN >LDA.G bReadMode READ Command ?
bne CS.RUN.READ
ldy #S.PS.RC
lda (pPs),y
beq .11

View File

@ -6,7 +6,7 @@ CORE.Run stz CORE.PSIndex
ldx #0
.1 lda PS.Table.hMem,x
.1 lda PS.Table.hPS,x
beq .8
jsr K.GetMemPtr
@ -217,7 +217,7 @@ CORE.Dispatch stz CORE.PSIndex
ldx #0
.1 lda PS.Table.hMem,x
.1 lda PS.Table.hPS,x
beq .5
jsr K.GetMemPtr
@ -285,7 +285,7 @@ CORE.Dispatch stz CORE.PSIndex
* In : A = PID to free
*--------------------------------------
CORE.PSFree.A sta .1+1 Save PS ID
jsr CORE.GetPSByID PS in ZPPtr1
jsr CORE.GetPSByID S.PS in ZPPtr1
bcs .9
>STYA ZPPtr1
@ -302,7 +302,7 @@ CORE.PSFree.A sta .1+1 Save PS ID
jsr .8
lda (ZPPtr1) get S.PS.F
and #S.PS.F.DUPENV do we have to discard duplicated env & prefix ?
and #S.PS.F.DUPENV do we have to discard duplicated env & prefix ?
beq .1
ldy #S.PS.hENV
@ -314,17 +314,17 @@ CORE.PSFree.A sta .1+1 Save PS ID
.1 lda #$ff Self Modified
ldx #0
.2 cmp PS.Table.PID,x
beq .3
inx
cpx #K.PS.MAX
bne .2
bra *
beq *
.3 stz PS.Table.PID,x
lda PS.TABLE.hMem,x
stz PS.TABLE.hMem,x
lda PS.TABLE.hPS,x
stz PS.TABLE.hPS,x
.4 jmp K.FreeMem
.8 lda (ZPPtr1),y
@ -337,19 +337,23 @@ CORE.GetPSByID tay
beq .8
jsr CORE.GetPS
bcs .9
bcs CORE.GetPSByID.RTS
lda PS.TABLE.hMem,y
lda PS.TABLE.hPS,y
jmp K.GetMemPtr
.8 >LDYAI CORE.S.PS0 Select PS0
CORE.GetPSByID.8
clc
.9 rts
CORE.GetPSByID.RTS
rts
*--------------------------------------
* X,A unmodified
*--------------------------------------
CORE.GetPS ldy #0
.1 cmp PS.Table.PID,y
beq .8
beq CORE.GetPSByID.8
iny
cpy #K.PS.MAX
bne .1
@ -357,9 +361,6 @@ CORE.GetPS ldy #0
.9 lda #K.E.NSP
* sec
rts
.8 clc
rts
*--------------------------------------
*CORE.DumpEvent ldy #S.EVT-1
@ -536,8 +537,9 @@ CORE.TickPerSec .BS 1
CORE.TickPer10t .BS 1
CORE.TickSec .BS 1
CORE.Tick10t .BS 1
CORE.CPUStat .BS 1
CORE.InKernelStat .BS 1
CORE.CPUStatCnt .DA #100
CORE.InKernelHits .BS 1
CORE.InKernelStats .BS 1
*--------------------------------------
CORE.EvtIndex .BS 1
CORE.EvtCount .BS 1

View File

@ -146,8 +146,9 @@ Kernel.Init3 sta SETALTZP
cmp #$84 CTRL-D for Maintenace mode
bne .1
>PUSHBI 0
>LDYAI MSG.MMode
>SYSCALL puts
>SYSCALL printf
>LDYAI STARTUP.SHELL
bra .8
@ -166,7 +167,7 @@ Kernel.Init3 sta SETALTZP
pla
>SYSCALL Args2ArgV
plx
pla
jsr K.FreeMem
>PUSHBI 0 PS Flags
@ -528,7 +529,7 @@ MemMgrInit >LDYAI Mem.MHiMem
ldx #K.PS.MAX*4-1
.3 stz PS.Table.hMem,x
.3 stz PS.Table.PID,x
dex
bpl .3

View File

@ -152,33 +152,35 @@ K.IrqH.VBL.MRM jsr $FFFF SELF MODIFIED,READMOUSE
*--------------------------------------
K.IrqH.Switch inc IRQ.Tick
dec CORE.CPUStat
dec CORE.CPUStatCnt
bne .2
lda #100
sta CORE.CPUStat
sta CORE.CPUStatCnt
stz CORE.InKernelStat
lda CORE.InKernelHits
stz CORE.InKernelHits
stz CORE.InKernelStats
ldx #K.PS.MAX-1
.1 lda PS.Table.Hits-1,x
stz PS.Table.Hits-1,x
stz PS.Table.Stats-1,x
sta PS.Table.Stats-1,x
dex
bpl .1
.2 lda IRQ.InKernel keep V flag set
bpl .3
inc CORE.InKernelStat
inc CORE.InKernelHits
.9 clv
clc
rts
.3 ldx CORE.PSIndex
inc PS.Table.Hits-1,x
inc PS.Table.Hits,x
bit A2osX.F A2osX.F.PMODE .EQ %01000000
bvc .8

View File

@ -236,13 +236,22 @@ Mem.NextSlot lda ZPMemMgrSPtr
* none.
* (X unmodified)
*\--------------------------------------
K.FreeMem.ERR >PUSHA
>PUSHBI 1
>PUSHWI K.FreeMem.ERR1
lda #DEVID.SYS
>SYSCALL fprintf
sec
rts
K.FreeMem tay
beq * Slot=0, reserved by Kernel
beq K.FreeMem.ERR Slot=0, reserved by Kernel
cmp Mem.LastSlot
bcc .10
bne *
bne K.FreeMem.ERR
.10 jsr K.GetMemByID X unmodified
lda (ZPMemMgrSPtr)
@ -299,33 +308,21 @@ K.FreeMem tay
clc
rts
*--------------------------------------
.9 lda $D000
sta .91+1
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
jsr CORE.PSSelect0 Select PS0 for proper I/O devices
jsr DRV.SYS.Control
pla Get PC and sub 2 for calling address
sec
sbc #2
tay
.9 ply
pla
sbc #0
pha
phy
>PUSHYA
>PUSHBI 2
>LDYAI K.FreeMem.ERR
>SYSCALL printf
.91 ldx #$ff
bit $C000,x
bit $C000,x
bra *
>PUSHWI K.FreeMem.ERR2
lda #DEVID.SYS
>SYSCALL fprintf
sec
rts
*--------------------------------------
K.FreeMem.ERR .AZ "FreeMem:%H:hMem already freed."
K.FreeMem.ERR1 .AZ "FreeMem:Bad hMem:%h."
K.FreeMem.ERR2 .AZ "FreeMem:hMem already freed At $%H."
*/--------------------------------------
* # GetMemPtr
* A = hMem

View File

@ -59,7 +59,7 @@ K.Exec >STYA PS.Args
PS.CreateChild ldx #0
.1 lda PS.Table.PID,x
beq .2 Found an empty slot
beq .4 Found an empty slot
inx
cpx #K.PS.MAX
bne .1
@ -71,18 +71,15 @@ PS.CreateChild ldx #0
.99 plx
rts
.2 phx save PS index
.4 inc CORE.LastPSID Get a PSID not already running
beq .4 not = 0
lda CORE.LastPSID
jsr CORE.GetPSByID
bcc .4
jsr CORE.GetPS Y=PS Index, X,A unmodified
bcc .4 running...loop
plx
lda CORE.LastPSID
sta PS.Table.PID,x
phx
phx save PS Index
>LDYAI S.PS
jsr K.GetMem0 Blank Everything in this S.PS
@ -91,7 +88,7 @@ PS.CreateChild ldx #0
>STYA ZPPtr3
txa
plx
sta PS.Table.hMem,x
sta PS.Table.hPS,x
jsr PS.SetMemOwner Set Ownership
@ -218,7 +215,7 @@ PS.Load jsr BIN.Load Y,A=filename full path
ldy #S.PS.hDS
sta (ZPPtr3),y save DS hMem in S.PS
jsr PS.SetMemOwner Set Ownership
jsr PS.SetMemOwner Set Ownership
.2 ldy #H.BIN.SS.SIZE
lda (ZPPtr4),y Load SS.SIZE
@ -421,7 +418,7 @@ K.GetPSStat >STYA ZPPtr1
ldx #0
ldy #1
lda CORE.InKernelStat
lda CORE.InKernelStats
sta (ZPPtr1),y
iny
@ -429,7 +426,7 @@ K.GetPSStat >STYA ZPPtr1
.1 lda PS.Table.PID,x
beq .2
lda PS.Table.hMem,x
lda PS.Table.hPS,x
sta (ZPPtr1),y
iny