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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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