Kernel version 0.8 : Kernel OK, now fixing DRV,BIN...

This commit is contained in:
Rémy GIBERT 2016-10-03 17:59:36 +02:00
parent e30dfc0eb4
commit 00f9fe267e
16 changed files with 134 additions and 86 deletions

Binary file not shown.

Binary file not shown.

View File

@ -32,14 +32,14 @@ PP.RxCFG.LID .EQ %00000000.00000011
PP.RxCTL .EQ $0104 Receiver Control (RW)
PP.RxCTL.LID .EQ %00000000.00000101
PP.RxCTL.IAHashA .EQ %00000000.01000000
PP.RxCTL.PromisA .EQ %00000000.10000000
*PP.RxCTL.PromisA .EQ %00000000.10000000
PP.RxCTL.RxOKA .EQ %00000001.00000000
PP.RxCTL.MulticastA .EQ %00000010.00000000
PP.RxCTL.IA .EQ %00000100.00000000
PP.RxCTL.BroadcastA .EQ %00001000.00000000
PP.RxCTL.CRCerrorA .EQ %00010000.00000000
PP.RxCTL.RuntA .EQ %00100000.00000000
PP.RxCTL.ExtradataA .EQ %01000000.00000000
*PP.RxCTL.CRCerrorA .EQ %00010000.00000000
*PP.RxCTL.RuntA .EQ %00100000.00000000
*PP.RxCTL.ExtradataA .EQ %01000000.00000000
PP.TxCFG .EQ $0106 Transmit Configuration (RW)
PP.TxCMD .EQ $0108 Receiver Control (RW)
PP.TxCMD.LID .EQ %00000000.00001001
@ -63,12 +63,12 @@ PP.SelfCTL .EQ $0114 Self Control (RW)
PP.SelfCTL.LID .EQ %00000000.00010101
PP.SelfCTL.RESET .EQ %00000000.01000000
PP.SelfCTL.SWSuspnd .EQ %00000000.10000000
PP.SelfCTL.HWSleepE .EQ %00000001.00000000
PP.SelfCTL.HWStndby .EQ %00000010.00000000
*PP.SelfCTL.HWSleepE .EQ %00000001.00000000
*PP.SelfCTL.HWStndby .EQ %00000010.00000000
PP.BufCTL .EQ $0116
PP.TestCTL .EQ $0118
PP.TestCTL.LID .EQ %00000000.00011001
PP.TestCTL.DisLT .EQ %00000000.10000000
*PP.TestCTL.LID .EQ %00000000.00011001
*PP.TestCTL.DisLT .EQ %00000000.10000000
PP.TestCTL.FDX .EQ %01000000.00000000
PP.ISQ .EQ $0120
PP.RxEvent .EQ $0124 Receiver Event (RO)

View File

@ -285,7 +285,7 @@ S.MEM.BIN .EQ 3
S.MEM.PTR .EQ 4
S.MEM.LEN .EQ 6
*
S.MEM.SIZE .EQ 8
S.MEM .EQ 8
*--------------------------------------
* DEV STRUCT
*--------------------------------------
@ -303,7 +303,7 @@ S.DEV.F.BLOCK .EQ %00000010
S.DEV.F.CHAR .EQ %00000001
S.DEV.NAME .EQ 6 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx
*
S.DEV.SIZE .EQ 16
S.DEV .EQ 16
*--------------------------------------
S.DEVINFO.TYPE .EQ 0
S.DEVINFO.TYPE.CHAR .EQ %00000001
@ -369,7 +369,7 @@ S.PS.CID .EQ 12
S.PS.LASTERROR .EQ 13
S.PS.PC .EQ 14
*
S.PS.SIZE .EQ 16
S.PS .EQ 16
*--------------------------------------
* LIB Function Indexes
*--------------------------------------

View File

@ -111,9 +111,10 @@ CS.DOEVENT sec
*--------------------------------------
CS.QUIT ldy #hBinName
lda (pData),y
beq .1
>SYSCALL SYS.FreeMemA
ldx #DEVMGR.CLOSE
.1 ldx #DEVMGR.CLOSE
* jsr pDevJmp
clc

View File

@ -226,7 +226,7 @@ BIN.MoveDRV ldy #H.BIN.DRV.DEVCTRLBLK.O
jsr K.GetDevByIDA
>STYA pDev
ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0
ldy #S.DEV Make sure DevMgr.Table Ends with 0
lda #0
sta (pDev),y

View File

@ -72,7 +72,7 @@ K.GetDevByNameYA
.3 lda ZPQuickPtr2
clc
adc #S.DEV.SIZE
adc #S.DEV
sta ZPQuickPtr2
bcc .4

View File

@ -114,7 +114,7 @@ EVT.GetEvents.DEV
.2 lda pDev
clc
adc #S.DEV.SIZE
adc #S.DEV
sta pDev
bcc .3
inc pDev+1

View File

@ -15,7 +15,7 @@ AUTO 6
*--------------------------------------
K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
>PULLYA Get Search list
jsr K.ExpandPStrYA Expand it
>SYSCALL SYS.ExpandPStrYA Expand it (SYSCALL to BNK1)
bcs .99
stx K.FileSearch.hSrch
@ -64,7 +64,9 @@ K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
lda K.FileSearch.hSrch Discard Expanded hSrch list
jsr K.FreeMemA
>LDYAI KrnBuf256
jmp K.NewPStrYA
>SYSCALL SYS.NewPStrYA
clc
rts
.98 lda K.FileSearch.hSrch Discard Expanded hSrch list
jsr K.FreeMemA

View File

@ -77,13 +77,13 @@ Kernel.Init3 jsr K.DevMgrInit
*--------------------------------------
* K.DevMgrInit
*--------------------------------------
K.DevMgrInit ldx #S.DEV.SIZE*DevMgr.Count
K.DevMgrInit ldx #S.DEV*DevMgr.Count
.1 lda DevMgr.NUL-1,x
sta DevMgr.Table-1,x
dex
bne .1
stz DevMgr.Table+S.DEV.SIZE*DevMgr.Count+1
stz DevMgr.Table+S.DEV*DevMgr.Count+1
lda #DevMgr.Count-1
sta DevMgr.LastDevID
@ -198,7 +198,7 @@ K.TskMgrInit stz TSKMGR.LASTID
ldx #K.PS.MAX
.1 lda #0
ldy #S.PS.SIZE-1
ldy #S.PS-1
.2 sta (pPs),y
dey
@ -206,7 +206,7 @@ K.TskMgrInit stz TSKMGR.LASTID
lda pPs
clc
adc #S.PS.SIZE
adc #S.PS
sta pPs
bcc .3

View File

@ -52,7 +52,7 @@ K.IrqHandlerAuxLC
bcc .8 CC, IRQ cleared by device
.2 lda $fe CS,
adc #S.DEV.SIZE-1
adc #S.DEV-1
sta $fe
bcc .1
inc $ff

View File

@ -5,7 +5,6 @@ INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* !!!!!!!! DO NOT USE VCPU16 !!!!!!!!
* !!!!!! DO NOT USE ZPQuickPTRs !!!!!
*--------------------------------------
ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected
@ -19,6 +18,10 @@ ZPMemMgrTmp3 .EQ ZPMEMMGR+6
* Garbage collector move blocks
* - mem.ID=0 always used! useful to test if hMem=0
*--------------------------------------
MemMgr.SlotCnt .BS 1
MemMgr.ReqFlags .BS 1 store requested Flags
MemMgr.ReqSize .BS 2 store requested Size
*--------------------------------------
* PUBLIC
*--------------------------------------
* K.GetMem
@ -155,26 +158,24 @@ MemMgr.AddSlot >STYA ZPMemMgrTmp1 save req size
lda MemMgr.Free Compute base PTR=FREE-REQ size
sec
sbc ZPMemMgrTmp1
sta ZPMemMgrTmp2 store new MemMgr.Free in ZPMemMgrTmp2
tay save new MemMgr.Free LO
lda MemMgr.Free+1
sbc ZPMemMgrTmp1+1
sta ZPMemMgrTmp2+1
pha save new MemMgr.Free HI
lda ZPMemMgrTmp2 ensure new MemMgr.Free is not lower
sec than LoMem
sbc MemMgr.LoMem
lda ZPMemMgrTmp2+1
cpy MemMgr.LoMem
sbc MemMgr.LoMem+1
bcc .98 ERR out of mem
jsr MemMgr.NextSlot
jsr MemMgr.NextSlot X,Y unmodified
tya get back MemMgr.Free LO
ldy #S.MEM.PTR
lda ZPMemMgrTmp2 get new MemMgr.Free
sta MemMgr.Free set as system MemMgr.Free value
sta (ZPMemMgrSPtr),y store is as base address of new slot
iny
lda ZPMemMgrTmp2+1
pla get back MemMgr.Free HI
sta MemMgr.Free+1
sta (ZPMemMgrSPtr),y
@ -189,7 +190,8 @@ MemMgr.AddSlot >STYA ZPMemMgrTmp1 save req size
clc
rts
.98 lda #MemMgr.ERROOM
.98 pla discard new MemMgr.Free HI
lda #MemMgr.ERROOM
sec
rts
@ -199,7 +201,7 @@ MemMgr.AddSlot >STYA ZPMemMgrTmp1 save req size
*--------------------------------------
MemMgr.NextSlot lda ZPMemMgrSPtr
clc
adc #S.MEM.SIZE
adc #S.MEM
sta ZPMemMgrSPtr
bcc .8
inc ZPMemMgrSPtr+1
@ -237,10 +239,6 @@ MemMgr.Init0 ldy #S.MEM.PTR
.8 rts
*--------------------------------------
MemMgr.SlotCnt .BS 1
MemMgr.ReqFlags .BS 1 store requested Flags
MemMgr.ReqSize .BS 2 store requested Size
*--------------------------------------
* K.FreeMemA
* In:
* A = hMem To Free
@ -248,13 +246,13 @@ MemMgr.ReqSize .BS 2 store requested Size
* X,Y unmodified
*--------------------------------------
K.FreeMemA phy
phx
tax
beq .8 Slot=0, reserved by Kernel
tay
jsr K.GetMemByIDA
beq * Slot=0, reserved by Kernel
jsr K.GetMemByIDA X unmodified
lda (ZPMemMgrSPtr)
bpl * In use ?
bpl .9 In use ?
ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y Get count of those referencing this hMem
@ -269,7 +267,7 @@ K.FreeMemA phy
pha save hMem
>PUSHW ZPMemMgrSPtr
pla
jsr K.GetMemByIDA
jsr K.GetMemByIDA X unmodified
lda (ZPMemMgrSPtr)
bpl * ***MUST BE ALLOCATED***
@ -283,7 +281,7 @@ K.FreeMemA phy
.2 lda MemMgr.LastSlot
beq .8
jsr K.GetMemByIDA
jsr K.GetMemByIDA X unmodified
lda (ZPMemMgrSPtr)
bmi .8
@ -300,11 +298,36 @@ K.FreeMemA phy
dec MemMgr.LastSlot discard last slot
bne .2 no slot left, exit
.8 plx
ply
.8 ply
clc
rts
*--------------------------------------
.9 ply discard saved Y
lda $D000
sta .91+1
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
jsr PS.Select0
pla Get PC and sub 2 for calling address
sec
sbc #2
tay
pla
sbc #0
>PUSHYA
>LDYAI K.FreeMemA.ERR
jsr K.PStrOutYA
.91 ldx #$ff
bit $C000,x
bit $C000,x
bra *
*--------------------------------------
* K.GetMemPtrA
* In:
* A = hMem
@ -327,27 +350,49 @@ K.GetMemPtrA jsr K.GetMemByIDA
* Out:
* Y,A = ZPMemMgrSPtr = PTR to S.MEM
* X unmodified
* *** Optimized for :
* MemMgr.Table is page aligned at $1800
* S.MEM is 8 bytes
*--------------------------------------
K.GetMemByIDA stz ZPMemMgrSPtr+1
asl
rol ZPMemMgrSPtr+1
asl
rol ZPMemMgrSPtr+1
asl
rol ZPMemMgrSPtr+1
* clc IMPLICIT
adc #MemMgr.Table
tay
lda ZPMemMgrSPtr+1
adc /MemMgr.Table
sty ZPMemMgrSPtr
.DO MemMgr.Table=$1800
.ELSE
!!!!!WARNING!!!!!
.FIN
.DO S.MEM=8
.ELSE
!!!!!WARNING!!!!!
.FIN
*--------------------------------------
K.GetMemByIDA sta ZPMemMgrSPtr
lda /MemMgr.Table/8
asl ZPMemMgrSPtr
rol
asl ZPMemMgrSPtr
rol
asl ZPMemMgrSPtr
rol
sta ZPMemMgrSPtr+1
ldy ZPMemMgrSPtr
rts
*--------------------------------------
* OLD CODE
*--------------------------------------
* stz ZPMemMgrSPtr+1
* asl
* rol ZPMemMgrSPtr+1
* asl
* rol ZPMemMgrSPtr+1
* asl
* rol ZPMemMgrSPtr+1
** clc IMPLICIT
* adc #MemMgr.Table
* tay
* lda ZPMemMgrSPtr+1
* adc /MemMgr.Table
* sty ZPMemMgrSPtr
* sta ZPMemMgrSPtr+1
* rts
*--------------------------------------
* In:
* Y,A = BINPATH (PSTR)
* Out:
@ -355,15 +400,16 @@ K.GetMemByIDA stz ZPMemMgrSPtr+1
* X = hMem
*--------------------------------------
K.GetMemByNameYA
ldx MemMgr.LastSlot
beq .9
>STYA ZPMemMgrTmp1 save BINPATH
>LDYAI MemMgr.Table
>STYA ZPMemMgrTmp2
ldx #0
.1 cpx MemMgr.LastSlot
beq .9
lda (ZPMemMgrTmp2)
.1 lda (ZPMemMgrTmp2)
bpl .6 In Use?
ldy #S.MEM.BIN any BIN PATH in this slot?
@ -393,14 +439,14 @@ K.GetMemByNameYA
.6 lda ZPMemMgrTmp2
clc
adc #S.MEM.SIZE
adc #S.MEM
sta ZPMemMgrTmp2
bcc .7
bcc .8
inc ZPMemMgrTmp2+1
.7 inx
bra .1
.8 inx
.81 cpx MemMgr.LastSlot
bne .1
.9 sec
rts
@ -419,6 +465,8 @@ K.GarbageCollector
clc
rts
*--------------------------------------
K.FreeMemA.ERR >PSTRING "***MemMgr:Attempted to Free an already freed hMem at $%H"
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.MEM
LOAD SYS/KERNEL.S

View File

@ -81,7 +81,7 @@ K.GetPSByIDA sta K.GetPSByIDA.PS
.1 inx
lda ZPQuickPtr1
clc
adc #S.PS.SIZE
adc #S.PS
sta ZPQuickPtr1
bcc .2
inc ZPQuickPtr1+1
@ -130,7 +130,7 @@ K.Sleep pla get PC LO
* we cannot use ZPQuickPtrs1 & 2
* because of calling K.NewPStrYA & S.DupEnvA
*--------------------------------------
PS.CreateChild >LDYAI TskMgr.Table+S.PS.SIZE
PS.CreateChild >LDYAI TskMgr.Table+S.PS
>STYA ZPQuickPtr3
ldx #0
@ -143,7 +143,7 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS.SIZE
bpl .3
lda ZPQuickPtr3
clc
adc #S.PS.SIZE
adc #S.PS
sta ZPQuickPtr3
bcc .1
inc ZPQuickPtr3+1
@ -174,7 +174,7 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS.SIZE
.5 sta (ZPQuickPtr3),y Blank Everything in this S.PS
iny
cpy #S.PS.SIZE
cpy #S.PS
bne .5
lda #S.PS.F.ENV

View File

@ -29,10 +29,7 @@ K.NewPStrYA >STYA ZPQuickPtr1
>LDYA ZPQuickPtr2
clc
rts
.9 sec
rts
.9 rts
*--------------------------------------
* K.PStrCpy
* IN:

View File

@ -7,7 +7,7 @@ AUTO 6
*--------------------------------------
* TSK.TskMgrRun
*--------------------------------------
TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS skip PS 0
>STYA pPs
lda TSKMGR.SIZE
@ -78,7 +78,7 @@ TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
.7 lda pPs
clc
adc #S.PS.SIZE
adc #S.PS
sta pPs
bcc .71
inc pPs+1
@ -96,7 +96,7 @@ TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
* CC: Event Cleared
*--------------------------------------
TSK.DispatchEvents
>LDYAI TskMgr.Table+S.PS.SIZE
>LDYAI TskMgr.Table+S.PS
>STYA pPs
lda TSKMGR.SIZE
@ -146,7 +146,7 @@ TSK.DispatchEvents
.4 lda pPs
clc
adc #S.PS.SIZE
adc #S.PS
sta pPs
bcc .1
inc pPs+1