Kernel 0.92

This commit is contained in:
Rémy GIBERT 2019-01-21 14:51:10 +00:00
parent eea4fb0809
commit d962d7b6ef
6 changed files with 58 additions and 30 deletions

Binary file not shown.

View File

@ -273,7 +273,7 @@ CL.PrintCmdBuf >LDYA ZPCLBuf
rts rts
*-------------------------------------- *--------------------------------------
CL.GetLine >LDYA ZPFileBufPtr CL.GetLine >LDYA ZPFileBufPtr
>STYA.G ZPFileBufPtrBak >STYA ZPFileBufPtrBak
lda (ZPFileBufPtr) lda (ZPFileBufPtr)
beq .9 beq .9

View File

@ -1027,20 +1027,21 @@ CMD.IsSwitch >STYA ZPPtr1
sec sec
rts rts
*-------------------------------------- *--------------------------------------
CMD.StkPushPtr >LDA.G ZPFileBufPtrBak CMD.StkPushPtr lda ZPFileBufPtrBak
jsr CMD.StkPush jsr CMD.StkPush
bcs .9 bcs CMD.StkPullPtr.9
>LDA.G ZPFileBufPtrBak+1 lda ZPFileBufPtrBak+1
jmp CMD.StkPush bra CMD.StkPush
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CMD.StkPullPtr jsr CMD.StkPull CMD.StkPullPtr jsr CMD.StkPull
bcs .9 bcs CMD.StkPullPtr.9
sta ZPFileBufPtr+1 sta ZPFileBufPtr+1
jsr CMD.StkPull jsr CMD.StkPull
bcs .9 bcs CMD.StkPullPtr.9
sta ZPFileBufPtr sta ZPFileBufPtr
.9 rts CMD.StkPullPtr.9
rts
*-------------------------------------- *--------------------------------------
CMD.StkGetPtr lda (pData) StackPtr CMD.StkGetPtr lda (pData) StackPtr
beq .9 beq .9

View File

@ -25,7 +25,9 @@ CORE.Run stz CORE.PSIndex
eor #S.PS.F.HOLD unmark as HOLD eor #S.PS.F.HOLD unmark as HOLD
sta (pPs) sta (pPs)
.2 jsr CORE.PSExec INIT/RUN/QUIT/RESUME .2 jsr CORE.PSSelect Restore ZP & Ptrs
.3 jsr CORE.PSExec INIT/RUN/QUIT/RESUME
dec IRQ.InKernel dec IRQ.InKernel
bcc .61 Error ? bcc .61 Error ?
@ -56,7 +58,7 @@ CORE.Run stz CORE.PSIndex
and #$3F $ff^S.PS.F.INIT+S.PS.F.RUN and #$3F $ff^S.PS.F.INIT+S.PS.F.RUN
ora #S.PS.F.QUIT ora #S.PS.F.QUIT
sta (pPs) sta (pPs)
bra .7 bra .3 try executing QUIT now...
.61 lda (pPs) .61 lda (pPs)
bit #S.PS.F.SLEEP bit #S.PS.F.SLEEP
@ -74,7 +76,6 @@ CORE.Run stz CORE.PSIndex
ldy #S.PS.PID ldy #S.PS.PID
lda (pPs),y lda (pPs),y
beq *
jsr CORE.PSFree jsr CORE.PSFree
bra .8 bra .8
@ -452,9 +453,7 @@ CORE.PSLeave ldy #S.PS.ZP+ZPBIN.SIZE-1
rts rts
*-------------------------------------- *--------------------------------------
CORE.PSExec jsr CORE.PSSelect Restore ZP & Ptrs CORE.PSExec lda (pPS)
lda (pPS)
bit #S.PS.F.SLEEP bit #S.PS.F.SLEEP
bne CORE.PSResume bne CORE.PSResume

View File

@ -180,18 +180,16 @@ ENV.Search.DRV ldx #2
.HS 2C BIT ABS .HS 2C BIT ABS
ENV.Search.PATH ldx #4 ENV.Search.PATH ldx #4
sty .1+1 >STYA ZPPtr1
sta .2+1
>LDYA ENV.VARS,x >LDYA ENV.VARS,x
jsr K.GetEnv get value for Search Path jsr ENV.FindVarP1 get value for Search Path
bcs K.FileSearch.RTS bcs K.FileSearch.RTS
>STYA ENV.SearchPath >STYA ENV.SearchPath
.1 ldy #$ff SELF MODIFIED >LDYA ZPPtr1
.2 lda #$ff SELF MODIFIED
ENV.Search.YA >STYA .4+1 ENV.Search.YA >STYA .4+1

View File

@ -20,6 +20,10 @@ ZPSListDataPtr .EQ ZPMEMMGR+14
* CS : * CS :
* A = EC * A = EC
*\-------------------------------------- *\--------------------------------------
MEM.ReqFlags .BS 1 store requested Flags
MEM.BestSlot .BS 1
MEM.BestScore .BS 2
*--------------------------------------
K.GetMem0 ldx #S.MEM.F.INIT0 K.GetMem0 ldx #S.MEM.F.INIT0
.HS 2C bit abs .HS 2C bit abs
*/-------------------------------------- */--------------------------------------
@ -34,7 +38,7 @@ K.GetMem0 ldx #S.MEM.F.INIT0
*\-------------------------------------- *\--------------------------------------
K.GetMem ldx #0 K.GetMem ldx #0
MEM.GetMem.YAX stx Mem.ReqFlags MEM.GetMem.YAX stx MEM.ReqFlags
sta ZPMemMgrSize+1 sta ZPMemMgrSize+1
tya tya
@ -52,6 +56,11 @@ MEM.GetMem.YAX stx Mem.ReqFlags
>LDYAI Mem.Table >LDYAI Mem.Table
>STYA ZPMemMgrSPtr >STYA ZPMemMgrSPtr
stz MEM.BestSlot
ldx #$ff
stx MEM.BestScore
stx MEM.BestScore+1
ldx #0 Current slot=0 ldx #0 Current slot=0
bra .4 skip slot 0, Check if some free slot to reuse first bra .4 skip slot 0, Check if some free slot to reuse first
@ -61,7 +70,7 @@ MEM.GetMem.YAX stx Mem.ReqFlags
lda (ZPMemMgrSPtr) Get Flags lda (ZPMemMgrSPtr) Get Flags
bmi .4 in use ? bmi .4 in use ?
.2 lda Mem.ReqFlags Found an empty slot .2 lda MEM.ReqFlags Found an empty slot
and #S.MEM.F.ALIGN is request needs a page align ? and #S.MEM.F.ALIGN is request needs a page align ?
beq .3 beq .3
@ -70,21 +79,44 @@ MEM.GetMem.YAX stx Mem.ReqFlags
bne .4 not page-aligned bne .4 not page-aligned
.3 ldy #S.MEM.LEN .3 ldy #S.MEM.LEN
sec
lda (ZPMemMgrSPtr),y get LEN of this block lda (ZPMemMgrSPtr),y get LEN of this block
cmp ZPMemMgrSize compare with requested size sbc ZPMemMgrSize compare with requested size
bne .4 pha
iny iny
lda (ZPMemMgrSPtr),y lda (ZPMemMgrSPtr),y
cmp ZPMemMgrSize+1 sbc ZPMemMgrSize+1
beq .7 requested size matches slot size !!! ply Y,A = SlotLen - ReqSize
bcc .4 req size > slot size
cpy MEM.BestScore
pha
sbc MEM.BestScore+1
pla
bcs .4 Delta is >= BestScore
bne .4 Delta is > 255...
sty MEM.BestScore
sta MEM.BestScore+1
stx MEM.BestSlot
.4 cpx Mem.LastSlot any other slot to check? .4 cpx Mem.LastSlot any other slot to check?
bne .1 last one, create a new slot bne .1 last one, create a new slot
lda MEM.BestSlot
beq .5
tax
jsr K.GetMemByID
bra .7
*-------------- Create a New SLOT *-------------- Create a New SLOT
.5 lda Mem.ReqFlags .5 lda MEM.ReqFlags
and #S.MEM.F.ALIGN is request needs a page align ? and #S.MEM.F.ALIGN is request needs a page align ?
beq .6 beq .6
@ -107,7 +139,7 @@ MEM.GetMem.YAX stx Mem.ReqFlags
*-------------- Reuse this SLOT *-------------- Reuse this SLOT
.7 lda Mem.ReqFlags get requested flags .7 lda MEM.ReqFlags get requested flags
ora #S.MEM.F.INUSE mark as in use ora #S.MEM.F.INUSE mark as in use
sta (ZPMemMgrSPtr) sta (ZPMemMgrSPtr)
@ -164,8 +196,6 @@ MEM.GetMem.YAX stx Mem.ReqFlags
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
Mem.ReqFlags .BS 1 store requested Flags
*--------------------------------------
* Mem.AddSlot * Mem.AddSlot
* In: * In:
* Y,A = Requested size * Y,A = Requested size