Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-08-20 17:15:37 +02:00
parent 41338d85f7
commit c982c8fb9c
5 changed files with 46 additions and 54 deletions

Binary file not shown.

Binary file not shown.

View File

@ -10,7 +10,6 @@ AUTO 4,1
.INB INC/A2OSX.I .INB INC/A2OSX.I
*-------------------------------------- *--------------------------------------
PAGELEN .EQ 22 PAGELEN .EQ 22
FOOTERLEN .EQ 8
*-------------------------------------- *--------------------------------------
ZPPTR1 .EQ ZPBIN ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2 ZPPTR2 .EQ ZPBIN+2
@ -24,7 +23,7 @@ CS.START cld
.DA 0 .DA 0
.DA CS.END-CS.START CS .DA CS.END-CS.START CS
.DA DS.END-DS.START DS .DA DS.END-DS.START DS
.DA #32 SS .DA #64 SS
.DA #4 ZP .DA #4 ZP
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
@ -47,8 +46,8 @@ L.MSG5 .DA MSG5
L.MSG.FREE .DA MSG.FREE L.MSG.FREE .DA MSG.FREE
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT lda #1 CS.INIT lda #0
>STA.G MEM.COUNT Skip SLOT0 >STA.G MEM.COUNT Skip SLOT 0
>LEA.G MemStat >LEA.G MemStat
>SYSCALL GetMemStat >SYSCALL GetMemStat
@ -77,10 +76,9 @@ CS.RUN >SYSCALL GetChar
.13 >LDA.G bSTOP .13 >LDA.G bSTOP
bne .8 bne .8
>INC.G MEM.COUNT
>LDA.G MEM.COUNT >SYSCALL GetMemByID
>CMP.G MemStat+S.MSTAT.MLast >STYA ZPPTR1
beq .10
>LDA.G LINE.COUNT >LDA.G LINE.COUNT
bne .1 bne .1
@ -88,17 +86,16 @@ CS.RUN >SYSCALL GetChar
>LDYA L.MSG0 >LDYA L.MSG0
>SYSCALL puts >SYSCALL puts
.1 >LDA.G MEM.COUNT .1 lda (ZPPTR1)
>SYSCALL GetMemByID
>STYA ZPPTR1
lda (ZPPTR1)
bpl .2 bpl .2
>INC.G USED.COUNT >INC.G USED.COUNT
.2 jsr CS.RUN.PRINTMEM .2 jsr CS.RUN.PRINTMEM
>INC.G MEM.COUNT >LDA.G MEM.COUNT
>CMP.G MemStat+S.MSTAT.MLast
beq .10
.8 clc .8 clc
rts rts
@ -106,22 +103,7 @@ CS.RUN >SYSCALL GetChar
.9 sec .9 sec
rts rts
.10 >LDA.G LINE.COUNT .10 >PUSHB.G MEM.COUNT
clc
adc #FOOTERLEN
cmp #PAGELEN
bcc .11
lda #$FF
>STA.G bSTOP
inc
>STA.G LINE.COUNT
clc
rts
.11 >PUSHB.G MEM.COUNT
>PUSHB.G USED.COUNT >PUSHB.G USED.COUNT
>LDYA L.MSG2 >LDYA L.MSG2
>SYSCALL printf >SYSCALL printf

View File

@ -150,29 +150,38 @@ BIN.Find.ENV.LIB .AZ "LIB"
BIN.Load >STYA BIN.CmdLine BIN.Load >STYA BIN.CmdLine
>STYA .2+1 >STYA .2+1
ldx Mem.LastSlot
beq BIN.Load.1
>LDYAI Mem.Table >LDYAI Mem.Table
>STYA ZPPtr1 >STYA ZPPtr1
ldx #0 ldx #0 we will skip Slot 0...
.1 lda (ZPPtr1) .1 cpx Mem.LastSlot
bpl .6 In Use? beq BIN.Load.1
inx
lda ZPPtr1
clc
adc #S.MEM
sta ZPPtr1
bcc .11
inc ZPPtr1+1
.11 lda (ZPPtr1)
bpl .1 In Use?
ldy #S.MEM.BIN any BIN PATH in this slot? ldy #S.MEM.BIN any BIN PATH in this slot?
lda (ZPPtr1),y lda (ZPPtr1),y
beq .6 beq .1
jsr K.GetMemPtr get pathname jsr K.GetMemPtr X unmodified, get pathname
>STYA .3+1 >STYA .3+1
ldy #0 ldy #0
.2 lda $ffff,y SELF MODIFIED .2 lda $ffff,y SELF MODIFIED
.3 cmp $ffff,y SELF MODIFIED .3 cmp $ffff,y SELF MODIFIED
bne .6 bne .1
iny iny
ora #0 ora #0
bne .2 bne .2
@ -182,19 +191,15 @@ BIN.Load >STYA BIN.CmdLine
inc inc
sta (ZPPtr1),y sta (ZPPtr1),y
txa ldy #S.MEM.PTR
jmp K.GetMemPtr X=hMem from K.GetMemByNameA lda (ZPPtr1),y
pha
iny
lda (ZPPtr1),y
ply
.6 lda ZPPtr1
clc clc
adc #S.MEM rts X=hMem, Y,A=Ptr
sta ZPPtr1
bcc .7
inc ZPPtr1+1
.7 inx
cpx Mem.LastSlot
bne .1
*-------------------------------------- *--------------------------------------
BIN.Load.1 >PUSHWI K.S.STAT BIN.Load.1 >PUSHWI K.S.STAT
>LDYA BIN.CmdLine >LDYA BIN.CmdLine

View File

@ -85,7 +85,8 @@ MEM.GetMem.YAX stx Mem.ReqFlags
bne .1 last one, create a new slot bne .1 last one, create a new slot
*-------------- Create a New SLOT *-------------- Create a New SLOT
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
@ -240,7 +241,11 @@ K.FreeMem phy
beq * Slot=0, reserved by Kernel beq * Slot=0, reserved by Kernel
jsr K.GetMemByID X unmodified cmp Mem.LastSlot
bcc .10
bne *
.10 jsr K.GetMemByID X unmodified
lda (ZPMemMgrSPtr) lda (ZPMemMgrSPtr)
bpl .9 In use ? bpl .9 In use ?
@ -250,8 +255,8 @@ K.FreeMem phy
sta (ZPMemMgrSPtr),y sta (ZPMemMgrSPtr),y
bne .8 no, must be a code segment loaded several times bne .8 no, must be a code segment loaded several times
lda #0 mark this slot as free * lda #0
sta (ZPMemMgrSPtr) sta (ZPMemMgrSPtr) mark this slot as free
ldy #S.MEM.BIN ldy #S.MEM.BIN
lda (ZPMemMgrSPtr),y Any BINPATH to discard ? lda (ZPMemMgrSPtr),y Any BINPATH to discard ?