Kernel 0.93++

This commit is contained in:
Rémy GIBERT 2020-01-31 17:12:25 +01:00
parent ab9d0defe4
commit 4356b020cf
8 changed files with 137 additions and 62 deletions

Binary file not shown.

View File

@ -296,10 +296,10 @@ SYS.FlushEtcPasswd .EQ $D6
* .EQ $D8 * .EQ $D8
* .EQ $DA * .EQ $DA
* .EQ $DC * .EQ $DC
SYS.OSD .EQ $DE * .EQ $DE
*-------------------------------------- *--------------------------------------
SYS.GetMem .EQ $E0 SYS.GetMem .EQ $E0
*SYS.GetMem0 .EQ $E2 SYS.Realloc .EQ $E2
SYS.GetMemPtr .EQ $E4 SYS.GetMemPtr .EQ $E4
SYS.FreeMem .EQ $E6 SYS.FreeMem .EQ $E6

View File

@ -10,7 +10,7 @@ C2 .EQ Mem.XLoMem
C3 .EQ Mem.XHiMem C3 .EQ Mem.XHiMem
*-------------------------------------- *--------------------------------------
C4 .EQ A2osX.GP.SC C4 .EQ A2osX.GP.SC
C5 .EQ A2osX.AUXH.S C5 .EQ A2osX.AUX.S
*-------------------------------------- *--------------------------------------
C6 .EQ A2osX.D1.S C6 .EQ A2osX.D1.S
C7 .EQ A2osX.D2.S C7 .EQ A2osX.D2.S

View File

@ -126,6 +126,7 @@ K.Buf256 .EQ $1100
K.IOBuf .EQ $1200 K.IOBuf .EQ $1200
*-------------------------------------- *--------------------------------------
Mem.MHiMem .EQ A2osX.SYSCALL Mem.MHiMem .EQ A2osX.SYSCALL
Mem.XLoMem .EQ $1000
Mem.XHiMem .EQ $A000 Mem.XHiMem .EQ $A000
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
*-------------------------------------- *--------------------------------------

View File

@ -30,12 +30,6 @@ Kernel.Init2 sei
>LDYA PAKME.AUX >LDYA PAKME.AUX
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI X.OSD
>STYA ZPOutBufPtr
jsr X.Unpak
>LDYA PAKME.AUXH
>STYA ZPInBufPtr
>LDYAI Mem.XHiMem >LDYAI Mem.XHiMem
>STYA ZPOutBufPtr >STYA ZPOutBufPtr
jsr X.Unpak jsr X.Unpak

View File

@ -131,12 +131,12 @@ K.SYSCALL .DA 0 $00
.DA 0 .DA 0
.DA 0 .DA 0
.DA 0 .DA 0
.DA X.OSD .DA 0 X.OSD
*-------------------------------------- *--------------------------------------
* $E000 * $E000
*-------------------------------------- *--------------------------------------
.DA K.GetMem $E0 .DA K.GetMem $E0
.DA K.GetMem0 .DA K.Realloc
.DA K.GetMemPtr .DA K.GetMemPtr
.DA K.FreeMem .DA K.FreeMem

View File

@ -4,23 +4,66 @@ NEW
ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected
ZPMemMgrTmp1 .EQ ZPMEMMGR+2 ZPMemMgrTmp1 .EQ ZPMEMMGR+2
ZPMemMgrSize .EQ ZPMEMMGR+4 ZPMemMgrSize .EQ ZPMEMMGR+4
*/-------------------------------------- *--------------------------------------
* # GetMem0
* Y,A = Size Requested
* ## RETURN VALUE
* CC : success
* YA = PTR to Mem (ZERO Initialised)
* X = hMem
* CS :
* A = EC
*\--------------------------------------
MEM.ReqFlags .BS 1 store requested Flags MEM.ReqFlags .BS 1 store requested Flags
MEM.BestSlot .BS 1 MEM.BestSlot .BS 1
*MEM.BestScore .BS 2 *MEM.BestScore .BS 2
MEM.BestScore .EQ ZPMemMgrTmp1 MEM.BestScore .EQ ZPMemMgrTmp1
*-------------------------------------- */--------------------------------------
K.GetMem0 ldx #S.MEM.F.INIT0 * # Realloc
.HS 2C bit abs * ## C
* `void *realloc(short int hMem, int size);`
* ## ASM
* `>PUSHB hMem`
* `>PUSHW size`
* `>SYSCALL realloc`
* ## RETURN VALUE
* YA = ptr
* X = hMem
*\--------------------------------------
K.Realloc ldy #2 src hMem
lda (pStack),y
tax
jsr MEM.GetMemByID
ldy #S.MEM.LEN
lda (ZPMemMgrSPtr),y
sta .2+1
pha
iny
lda (ZPMemMgrSPtr),y
sta .3+1
ply
jsr MEM.MoveToAux x = Src hMem, YA = LEN
bcs .99
stx .1+1
ldy #1
lda (pStack),y new size HI
pha
lda (pStack) new size LO
tay
jsr K.getmem
bcs .99
stx .8+1 new main hMem
.1 ldx #$ff SELF MODIFIED hMem AUX
.2 ldy #$ff SELF MODIFIED src LEN
.3 lda #$ff SELF MODIFIED src LEN
jsr MEM.MoveToMain
bcs .99
.8 lda #$ff SELF MODIFIED
tax
jsr k.GetMemPtr YA = new ptr
.99 >RET 3
*/-------------------------------------- */--------------------------------------
* # GetMem * # GetMem
* Y,A = Size Requested * Y,A = Size Requested
@ -31,6 +74,8 @@ K.GetMem0 ldx #S.MEM.F.INIT0
* CS : * CS :
* A = EC * A = EC
*\-------------------------------------- *\--------------------------------------
K.GetMem0 ldx #S.MEM.F.INIT0
.HS 2C BIT ABS
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
@ -417,43 +462,25 @@ Mem.DecRefCnt ldy #S.MEM.REFCNT
K.LoadStkObj ldx #SYS.LoadTxtFile To get ending \0 K.LoadStkObj ldx #SYS.LoadTxtFile To get ending \0
jsr K.SYSCALL2 jsr K.SYSCALL2
bcs .99 bcs .99
stx .90+1
sty .81+1 Save File Len sty .81+1 Save File Len
sta .82+1 sta .82+1
stx .8+1 Save MAIN hMem
iny iny
bne .1 bne .1
inc +1 for ending 0 inc +1 for ending 0
.1 >STYA A2L Save LEN temporarly
ldx #SYS.NewStkObj .1 jsr MEM.MoveToAux X = AUX hMem
jsr K.SYSCALL2
bcs .9 bcs .9
stx .80+1
>STYA A4L Save Destination Address in AUX
lda .8+1
jsr K.GetMemPtr
>STYA A1L Save MAIN base Ptr
pha Add Allocated LEN
tya
clc
adc A2L
sta A2L
pla
adc A2L+1
sta A2L+1 to get End address in A2L/H
sec Main To Aux
jsr AuxMove
.8 lda #$ff SELF MODIFIED
jsr K.FreeMem release MAIN memory
.80 ldx #$ff Returns AUX hMem
.81 ldy #$ff and file len in Y,A .81 ldy #$ff and file len in Y,A
.82 lda #$ff .82 lda #$ff
* clc * clc
rts rts
.9 pha .9 pha
jsr .8 .90 lda #$ff SELF MODIFIED
jsr K.freemem
pla pla
sec sec
.99 rts .99 rts
@ -471,6 +498,69 @@ K.LoadStkObj ldx #SYS.LoadTxtFile To get ending \0
* none. * none.
* (X,Y unmodified) * (X,Y unmodified)
*\-------------------------------------- *\--------------------------------------
MEM.MoveToMain stx .1+1 Save AUX hMem
>STYA A2L Save LEN to move
jsr K.GetMem
bcs .9
stx .8+1 Save MAIN hMem
>STYA A4L Save MAIN Ptr
lda .1+1
>SYSCALL2 GetStkObjPtr
>STYA A1L Save AUX base Ptr
pha Add Allocated LEN
tya
clc
adc A2L
sta A2L
pla
adc A2L+1
sta A2L+1 to get End address in A2L/H
clc Aux To Main
jsr AuxMove
.1 lda #$ff SELF MODIFIED
>SYSCALL2 FreeStkObj release AUX memory
.8 ldx #$ff Returns MAIN hMem
* clc
.9 rts
*--------------------------------------
MEM.MoveToAux stx .1+1 Save MAIN hMem
>STYA A2L Save LEN to move
>SYSCALL2 NewStkObj
bcs .9
stx .8+1 Save AUX hMem
>STYA A4L Save AUX Ptr
lda .1+1
jsr K.GetMemPtr
>STYA A1L Save MAIN base Ptr
pha Add Allocated LEN
tya
clc
adc A2L
sta A2L
pla
adc A2L+1
sta A2L+1 to get End address in A2L/H
sec Main To Aux
jsr AuxMove
.1 lda #$ff SELF MODIFIED
jsr K.FreeMem release MAIN memory
.8 ldx #$ff Returns AUX hMem
* clc
.9 rts
*-------------------------------------- *--------------------------------------
MEM.GetKrnlBuf pha MEM.GetKrnlBuf pha
tya tya

View File

@ -14,7 +14,7 @@ NEW
.INB INC/MLI.E.I .INB INC/MLI.E.I
.INB INC/NET.TELNET.I .INB INC/NET.TELNET.I
.INB INC/XY.MOUSE.I .INB INC/XY.MOUSE.I
.INB INC/GFX.I * .INB INC/GFX.I
.INB INC/KERNEL.I .INB INC/KERNEL.I
.INB USR/SRC/SYS/KERNEL.S.DEF .INB USR/SRC/SYS/KERNEL.S.DEF
@ -25,7 +25,6 @@ NEW
PAKME.Table PAKME.Table
PAKME.MAIN .DA A2osX.MAIN PAKME.MAIN .DA A2osX.MAIN
PAKME.AUX .DA A2osX.AUX PAKME.AUX .DA A2osX.AUX
PAKME.AUXH .DA A2osX.AUXH
PAKME.GP .DA A2osX.GP PAKME.GP .DA A2osX.GP
PAKME.D1 .DA A2osX.D1 PAKME.D1 .DA A2osX.D1
PAKME.D2 .DA A2osX.D2 PAKME.D2 .DA A2osX.D2
@ -44,23 +43,14 @@ A2osX.MAIN.S .EQ *-A2osX.MAIN.B
A2osX.AUX .DA #0 A2osX.AUX .DA #0
.DA A2osX.AUX.S .DA A2osX.AUX.S
A2osX.AUX.B .PH $1000 A2osX.AUX.B .PH Mem.XHiMem
.INB USR/SRC/SYS/KERNEL.S.OSDX
Mem.XLoMem .EQ *
.EP
A2osX.AUX.S .EQ *-A2osX.AUX.B
A2osX.AUXH .DA #0
.DA A2osX.AUXH.S
A2osX.AUXH.B .PH Mem.XHiMem
.INB USR/SRC/SYS/KERNEL.S.TERMX .INB USR/SRC/SYS/KERNEL.S.TERMX
.INB USR/SRC/SYS/KERNEL.S.MD5X .INB USR/SRC/SYS/KERNEL.S.MD5X
.INB USR/SRC/SYS/KERNEL.S.PWDX .INB USR/SRC/SYS/KERNEL.S.PWDX
.INB USR/SRC/SYS/KERNEL.S.TIMEX .INB USR/SRC/SYS/KERNEL.S.TIMEX
.INB USR/SRC/SYS/KERNEL.S.SLISTX .INB USR/SRC/SYS/KERNEL.S.SLISTX
.EP .EP
A2osX.AUXH.S .EQ *-A2osX.AUXH.B A2osX.AUX.S .EQ *-A2osX.AUX.B
A2osX.GP .DA #0 A2osX.GP .DA #0
.DA A2osX.GP.S .DA A2osX.GP.S
@ -132,7 +122,7 @@ A2osX.E0.S .EQ *-A2osX.E0.B
.AS "PAKME" TAG .AS "PAKME" TAG
.DA $2000 BIN ORG .DA $2000 BIN ORG
.DA #7 Chunk Count .DA #6 Chunk Count
.DA PAKME.Table Chunks .DA PAKME.Table Chunks
.INB USR/SRC/SYS/KERNEL.S.CTRL .INB USR/SRC/SYS/KERNEL.S.CTRL