Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-07-18 17:55:43 +02:00
parent e1ed4f68a2
commit 526167522f
9 changed files with 73 additions and 92 deletions

View File

@ -28,17 +28,18 @@ ZPLIB .EQ $40 32 bytes
CORE.PSIndex .EQ $D0
CORE.PSCount .EQ $D1
pSession .EQ $D2
pPs .EQ $D2
pEvent .EQ $D4
pPs .EQ $D6
*--------------------------------------
pSession .EQ $D6
pCode .EQ $D8
pData .EQ $DA
pStack .EQ $DC
pLocal .EQ $DE 8 Bytes
pLocal .EQ $DE 10 Bytes
ZPBIN .EQ $E0 32 bytes
ZPBIN.SIZE .EQ 40 8+32
ZPBIN.SIZE .EQ 32
PSCTX.SIZE .EQ $100-pSession
*--------------------------------------
* A2osX GLOBAL PAGE
* $BD00->$BD0F : Public Vetors
@ -528,14 +529,13 @@ S.PS.P .EQ 20
S.PS.PC .EQ 21 WORD
S.PS.ZP.SIZE .EQ 23
S.PS.ZP .EQ 24
S.PS.ZP.CODE .EQ 24
S.PS.ZP.DATA .EQ 26
S.PS.ZP.STACK .EQ 28
S.PS.ZP.LOCAL .EQ 30
S.PS.ZP.SESSION .EQ 24
S.PS.ZP.CODE .EQ 26
S.PS.ZP.DATA .EQ 28
S.PS.ZP.STACK .EQ 30
S.PS.ZP.LOCAL .EQ 32
*
S.PS .EQ 64
S.PS .EQ 66
*--------------------------------------
* LIB Function Indexes
*--------------------------------------
@ -548,7 +548,6 @@ PS.INIT .EQ 0
PS.RUN .EQ 2
PS.DOEVENT .EQ 4
PS.QUIT .EQ 6
PS.RESUME .EQ 8
*--------------------------------------
* EVENT STRUCT
*--------------------------------------

View File

@ -48,9 +48,7 @@ K.UnloadLib pha
jsr K.GetMemPtr
>STYA .2+1
ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
dec
jsr Mem.DecRefCnt
bne .8
.1 ldx #LIBMGR.UNLOAD
@ -58,9 +56,7 @@ K.UnloadLib pha
pla
jmp K.FreeMem
.8 sta (ZPMemMgrSPtr),y
pla
.8 pla
* clc
rts
*/--------------------------------------
@ -156,10 +152,7 @@ BIN.Load >STYA BIN.CmdLine
txa
jsr MEM.GetMemByID
ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
inc
sta (ZPMemMgrSPtr),y
jsr Mem.IncRefCnt
clc
jmp MEM.GetMEMPTR

View File

@ -159,6 +159,7 @@ CORE.UpdateParentPS
eor #S.PS.F.HOLD release Parent PS HOLD...
sta (ZPPtr1)
* clc
.8 rts
*--------------------------------------
* CORE.GetEvents :
@ -381,28 +382,21 @@ CORE.DestroyEvent
dec CORE.EvtCount
.9 rts
*--------------------------------------
CORE.PSSelect ldy #S.PS.ZP+ZPBIN.SIZE-1
ldx #ZPBIN.SIZE-1
CORE.PSSelect ldy #S.PS.ZP.SESSION+PSCTX.SIZE-1
ldx #PSCTX.SIZE-1
.1 lda (pPs),y
sta pCode,x
sta pSession,x
dey
dex
bpl .1
ldy #S.PS.hSID
lda (pPs),y
tax
lda S.Table.hSession-1,x
jsr K.GetmemPtr
>STYA pSession
rts
*--------------------------------------
CORE.PSLeave ldy #S.PS.ZP+ZPBIN.SIZE-1
ldx #ZPBIN.SIZE-1
CORE.PSLeave ldy #S.PS.ZP.SESSION+PSCTX.SIZE-1
ldx #PSCTX.SIZE-1
.1 lda pCode,x
.1 lda pSession,x
sta (pPs),y
dey
dex
@ -420,13 +414,14 @@ CORE.PSExec lda (pPS)
bit #S.PS.F.QUIT
bne .2
ldx #31
ldx #ZPBIN.SIZE
.1 stz ZPBIN,x
.1 stz ZPBIN-1,x
dex
bpl .1
bne .1
ldx #PS.INIT
* ldx #PS.INIT X=0
.HS 2C BIT ABS
.2 ldx #PS.QUIT
.HS 2C BIT ABS

View File

@ -743,7 +743,7 @@ ENV.Dup.A sta .8+1 Store target page Count
>STYA .2+1 Target Buffer
phx save hMem
jsr PS.SetMemOwner Set Ownership
jsr Mem.SetOwner Set Ownership
ldy #S.PS.hENV
lda (pPs),y

View File

@ -473,13 +473,6 @@ K.SYSCALL2.BANK sta .7+1
K.SYSCALL.JMP jmp (K.SYSCALL,x)
*--------------------------------------
K.GUIOSD.JMP sta SETREADAUX
sta SETWRITEAUX
jsr X.GUIOSD
sta CLRREADAUX
sta CLRWRITEAUX
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.JMP
LOAD USR/SRC/SYS/KERNEL.S

View File

@ -290,10 +290,7 @@ K.FreeMem tay
lda (ZPMemMgrSPtr) In use ?
bpl K.FreeMem.ERR
ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
dec
sta (ZPMemMgrSPtr),y only one left ?
jsr MEM.DecRefCnt only one left ?
bne .8 no, must be a code segment loaded several times
lda (ZPMemMgrSPtr)
@ -305,8 +302,8 @@ K.FreeMem tay
lda (ZPMemMgrSPtr),y
jsr MEM.GetMemByID X unmodified
lda (ZPMemMgrSPtr)
bpl * ***MUST BE ALLOCATED***
* lda (ZPMemMgrSPtr)
* bpl * ***MUST BE ALLOCATED***
lda #0 mark BINPATH slot as free
sta (ZPMemMgrSPtr)
@ -380,6 +377,23 @@ MEM.GetMemByID sta ZPMemMgrSPtr
sta ZPMemMgrSPtr+1
rts
*--------------------------------------
Mem.SetOwner ldy #S.MEM.OWNERPID
lda CORE.LastPSID
sta (ZPMemMgrSPtr),y
rts
*--------------------------------------
Mem.IncRefCnt ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
inc
sta (ZPMemMgrSPtr),y
rts
*--------------------------------------
Mem.DecRefCnt ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
dec
sta (ZPMemMgrSPtr),y
rts
*--------------------------------------
ZPSListKeyID .EQ ZPMEMMGR+6
ZPSListDataPtr .EQ ZPMEMMGR+8
ZPSListDataLen .EQ ZPMEMMGR+10

View File

@ -12,29 +12,19 @@ ZPTmpPtr .EQ ZPDRV+14
* YA =Ptr to S.CB in MAIN
* X = DstBM hMem
*--------------------------------------
X.GUIOSD >STYA ZPCmdPtr
>STYA A1L Src Start Address (MAIN)
pha
tya
clc
adc #S.CB-1
sta A2L Src End Address (MAIN)
pla
adc /S.CB-1
sta A2L+1
>LDYAI CB.Cache
>STYA A4L Dst Address (AUX)
sec Main To Aux
jsr AuxMove
X.GUIOSD >STYA TXTPTR
ldy #S.CB-1
.10 jsr MEM.TXTPTR.GetY
sta CB.Cache,y
dey
bpl .10
txa
beq .3
jsr GO.GetMemPtr
jsr K.GetMemPtr
>STYA ZPDstBMPtr
@ -149,7 +139,7 @@ BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
bne BITBLT.1
tya
jsr GO.GetMemPtr
jsr K.GetMemPtr
BITBLT.1 >STYA ZPSrcBMPtr
@ -189,7 +179,7 @@ GETTEXTSIZE clc
php
lda CB.Cache+S.CB.hFONT
jsr GO.GetMemPtr
jsr K.GetMemPtr
>STYA ZPFontPtr
ldy #S.FON-1
@ -565,7 +555,7 @@ BM.Create lda DstBM.Cache+S.BM.W
tay
pla
adc /S.BM
jsr GO.GetMem
jsr K.GetMem
bcs .9
>STYA ZPDstBMPtr
@ -651,11 +641,6 @@ CB.Update >LDYA ZPCmdPtr
clc Aux To Main
jmp AuxMove
*--------------------------------------
GO.GetMem ldx #SYS.GetMem
.HS 2C BIT ABS
GO.GetMemPtr ldx #SYS.GetMemPtr
jmp (K.SYSCALL,x)
*--------------------------------------
CB.Cache .BS S.CB
FON.Cache .BS S.FON
SrcBM.Cache .BS S.BM

View File

@ -130,7 +130,7 @@ PS.CreateChild ldx #0
plx
sta PS.Table.hPS,x
jsr PS.SetMemOwner Set Ownership
jsr Mem.SetOwner Set Ownership
lda CORE.LastPSID
ldy #S.PS.PID
@ -159,7 +159,7 @@ PS.CreateChild ldx #0
jsr K.StrDup
bcs .9
jsr PS.SetMemOwner Set Ownership
jsr Mem.SetOwner Set Ownership
txa
ldy #S.PS.hPREFIX
@ -186,6 +186,13 @@ PS.CreateChild ldx #0
ldy #S.PS.hSID
lda (ZPPtr1),y
sta (PS.NewPSPtr),y
jsr K.GetMemPtr
phy
ldy #S.PS.ZP.SESSION+1
sta (PS.NewPSPtr),y
dey
pla
sta (PS.NewPSPtr),y
lda #S.PS.F.HOLD
bit PS.Flags
@ -199,7 +206,6 @@ PS.CreateChild ldx #0
sta (ZPPtr1),y
.8 lda #S.PS.F.INIT
ora (PS.NewPSPtr)
sta (PS.NewPSPtr) Make this PS Init....
lda CORE.LastPSID Exit with A=PSID
@ -326,7 +332,7 @@ PS.LoadBIN >LDYAI K.Buf256
sta (PS.NewPSPtr),y save CS hMem in S.PS
* jsr MEM.GetMemByID
* jsr PS.SetMemOwner Set Ownership
* jsr Mem.SetOwner Set Ownership
ldy #H.BIN.F Get Bin S.PS.F
lda (ZPPtr4),y
@ -362,7 +368,7 @@ PS.LoadBIN >LDYAI K.Buf256
ldy #S.PS.hDS
sta (PS.NewPSPtr),y save DS hMem in S.PS
jsr PS.SetMemOwner Set Ownership
jsr Mem.SetOwner Set Ownership
.2 ldy #H.BIN.SS.SIZE
lda (ZPPtr4),y Load SS.SIZE
@ -391,7 +397,7 @@ PS.LoadBIN >LDYAI K.Buf256
ldy #S.PS.hSS
sta (PS.NewPSPtr),y save SS hMem in S.PS
jsr PS.SetMemOwner Set Ownership
jsr Mem.SetOwner Set Ownership
ldy #H.BIN.ZP.SIZE
lda (ZPPtr4),y
@ -549,11 +555,6 @@ PS.AddYAp12ArgSize
adc PS.ArgSize+1
sta PS.ArgSize+1
rts
*--------------------------------------
PS.SetMemOwner lda CORE.LastPSID
ldy #S.MEM.OWNERPID
sta (ZPMemMgrSPtr),y
rts
*/--------------------------------------
* # ExecL
* ## C

View File

@ -469,7 +469,8 @@ PrintF.B jsr PrintF.LocalGetByte
pla
dey
bne .1
rts
.9 ply
PrintF.B.RTS
rts