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 .EQ $0104 Receiver Control (RW)
PP.RxCTL.LID .EQ %00000000.00000101 PP.RxCTL.LID .EQ %00000000.00000101
PP.RxCTL.IAHashA .EQ %00000000.01000000 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.RxOKA .EQ %00000001.00000000
PP.RxCTL.MulticastA .EQ %00000010.00000000 PP.RxCTL.MulticastA .EQ %00000010.00000000
PP.RxCTL.IA .EQ %00000100.00000000 PP.RxCTL.IA .EQ %00000100.00000000
PP.RxCTL.BroadcastA .EQ %00001000.00000000 PP.RxCTL.BroadcastA .EQ %00001000.00000000
PP.RxCTL.CRCerrorA .EQ %00010000.00000000 *PP.RxCTL.CRCerrorA .EQ %00010000.00000000
PP.RxCTL.RuntA .EQ %00100000.00000000 *PP.RxCTL.RuntA .EQ %00100000.00000000
PP.RxCTL.ExtradataA .EQ %01000000.00000000 *PP.RxCTL.ExtradataA .EQ %01000000.00000000
PP.TxCFG .EQ $0106 Transmit Configuration (RW) PP.TxCFG .EQ $0106 Transmit Configuration (RW)
PP.TxCMD .EQ $0108 Receiver Control (RW) PP.TxCMD .EQ $0108 Receiver Control (RW)
PP.TxCMD.LID .EQ %00000000.00001001 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.LID .EQ %00000000.00010101
PP.SelfCTL.RESET .EQ %00000000.01000000 PP.SelfCTL.RESET .EQ %00000000.01000000
PP.SelfCTL.SWSuspnd .EQ %00000000.10000000 PP.SelfCTL.SWSuspnd .EQ %00000000.10000000
PP.SelfCTL.HWSleepE .EQ %00000001.00000000 *PP.SelfCTL.HWSleepE .EQ %00000001.00000000
PP.SelfCTL.HWStndby .EQ %00000010.00000000 *PP.SelfCTL.HWStndby .EQ %00000010.00000000
PP.BufCTL .EQ $0116 PP.BufCTL .EQ $0116
PP.TestCTL .EQ $0118 PP.TestCTL .EQ $0118
PP.TestCTL.LID .EQ %00000000.00011001 *PP.TestCTL.LID .EQ %00000000.00011001
PP.TestCTL.DisLT .EQ %00000000.10000000 *PP.TestCTL.DisLT .EQ %00000000.10000000
PP.TestCTL.FDX .EQ %01000000.00000000 PP.TestCTL.FDX .EQ %01000000.00000000
PP.ISQ .EQ $0120 PP.ISQ .EQ $0120
PP.RxEvent .EQ $0124 Receiver Event (RO) 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.PTR .EQ 4
S.MEM.LEN .EQ 6 S.MEM.LEN .EQ 6
* *
S.MEM.SIZE .EQ 8 S.MEM .EQ 8
*-------------------------------------- *--------------------------------------
* DEV STRUCT * DEV STRUCT
*-------------------------------------- *--------------------------------------
@ -303,7 +303,7 @@ S.DEV.F.BLOCK .EQ %00000010
S.DEV.F.CHAR .EQ %00000001 S.DEV.F.CHAR .EQ %00000001
S.DEV.NAME .EQ 6 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx 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 .EQ 0
S.DEVINFO.TYPE.CHAR .EQ %00000001 S.DEVINFO.TYPE.CHAR .EQ %00000001
@ -369,7 +369,7 @@ S.PS.CID .EQ 12
S.PS.LASTERROR .EQ 13 S.PS.LASTERROR .EQ 13
S.PS.PC .EQ 14 S.PS.PC .EQ 14
* *
S.PS.SIZE .EQ 16 S.PS .EQ 16
*-------------------------------------- *--------------------------------------
* LIB Function Indexes * LIB Function Indexes
*-------------------------------------- *--------------------------------------

View File

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

View File

@ -226,7 +226,7 @@ BIN.MoveDRV ldy #H.BIN.DRV.DEVCTRLBLK.O
jsr K.GetDevByIDA jsr K.GetDevByIDA
>STYA pDev >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 lda #0
sta (pDev),y sta (pDev),y

View File

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

View File

@ -24,7 +24,7 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray
jsr K.FileSearch find libname in $DRV jsr K.FileSearch find libname in $DRV
bcs .99 bcs .99
stx K.LoadDrv.hFullName stx K.LoadDrv.hFullName
jsr K.LoadExeYA Y,A =filename full path jsr K.LoadExeYA Y,A =filename full path
bcs .98 bcs .98

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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