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
*--------------------------------------
PAGELEN .EQ 22
FOOTERLEN .EQ 8
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
@ -24,7 +23,7 @@ CS.START cld
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #32 SS
.DA #64 SS
.DA #4 ZP
.DA 0
*--------------------------------------
@ -47,8 +46,8 @@ L.MSG5 .DA MSG5
L.MSG.FREE .DA MSG.FREE
.DA 0
*--------------------------------------
CS.INIT lda #1
>STA.G MEM.COUNT Skip SLOT0
CS.INIT lda #0
>STA.G MEM.COUNT Skip SLOT 0
>LEA.G MemStat
>SYSCALL GetMemStat
@ -77,28 +76,26 @@ CS.RUN >SYSCALL GetChar
.13 >LDA.G bSTOP
bne .8
>INC.G MEM.COUNT
>SYSCALL GetMemByID
>STYA ZPPTR1
>LDA.G MEM.COUNT
>CMP.G MemStat+S.MSTAT.MLast
beq .10
>LDA.G LINE.COUNT
bne .1
>LDYA L.MSG0
>SYSCALL puts
.1 >LDA.G MEM.COUNT
>SYSCALL GetMemByID
>STYA ZPPTR1
lda (ZPPTR1)
.1 lda (ZPPTR1)
bpl .2
>INC.G USED.COUNT
.2 jsr CS.RUN.PRINTMEM
>INC.G MEM.COUNT
>LDA.G MEM.COUNT
>CMP.G MemStat+S.MSTAT.MLast
beq .10
.8 clc
rts
@ -106,22 +103,7 @@ CS.RUN >SYSCALL GetChar
.9 sec
rts
.10 >LDA.G LINE.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
.10 >PUSHB.G MEM.COUNT
>PUSHB.G USED.COUNT
>LDYA L.MSG2
>SYSCALL printf

View File

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

View File

@ -85,7 +85,8 @@ MEM.GetMem.YAX stx Mem.ReqFlags
bne .1 last one, 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 ?
beq .6
@ -240,7 +241,11 @@ K.FreeMem phy
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)
bpl .9 In use ?
@ -250,8 +255,8 @@ K.FreeMem phy
sta (ZPMemMgrSPtr),y
bne .8 no, must be a code segment loaded several times
lda #0 mark this slot as free
sta (ZPMemMgrSPtr)
* lda #0
sta (ZPMemMgrSPtr) mark this slot as free
ldy #S.MEM.BIN
lda (ZPMemMgrSPtr),y Any BINPATH to discard ?