Kernel 0.9.1 : KERNEL, Preemtive mode, Code cleaning....step by step....#3

This commit is contained in:
Rémy GIBERT 2018-04-28 14:10:58 +02:00
parent a260cfe2eb
commit 62d910288d
8 changed files with 75 additions and 81 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -518,69 +518,6 @@ CORE.PSResume sei
inc IRQ.InKernel
rti
*--------------------------------------
CORE.PSSleep php
sei
phy
ldy #S.PS.A
sta (pPs),y
txa
iny #S.PS.X
sta (pPs),y
pla
iny #S.PS.Y
sta (pPs),y
pla
iny #S.PS.P
sta (pPs),y
pla get PC LO
plx get PC HI
inc Advance one byte because of return by RTI
bne .1
inx
.1 iny #S.PS.PC
sta (pPs),y
txa
iny #S.PS.PC+1
sta (pPs),y
tsx
inx skip P
inx skip PC HI,LO
inx
txa
beq .8
tay Save !Byte count for later
.2 pla
>PUSHA
inx
bne .2
tya
.8 >PUSHA push CPU Stack BC to restore on top of Soft Stack
lda (pPs)
ora #S.PS.F.SLEEP
sta (pPs)
lda #0 cld,clc,cli
pha
rti exit to kernel with CC
*--------------------------------------
DevMgr.Stat .DA DevMgr.FreeMem
DevMgr.Free .DA DevMgr.FreeMem
.DA DevMgr.HiMem

View File

@ -42,7 +42,68 @@ GP.CodeStart jmp GP.SysCall
*--------------------------------------
* SLEEP
*--------------------------------------
jmp CORE.PSSleep
php
sei
phy
ldy #S.PS.A
sta (pPs),y
txa
iny #S.PS.X
sta (pPs),y
pla
iny #S.PS.Y
sta (pPs),y
pla
iny #S.PS.P
sta (pPs),y
pla get PC LO
plx get PC HI
inc Advance one byte because of return by RTI
bne .1
inx
.1 iny #S.PS.PC
sta (pPs),y
txa
iny #S.PS.PC+1
sta (pPs),y
tsx
inx skip P
inx skip PC HI,LO
inx
txa
beq .8
tay Save !Byte count for later
.2 pla
>PUSHA
inx
bne .2
tya
.8 >PUSHA push CPU Stack BC to restore on top of Soft Stack
lda (pPs)
ora #S.PS.F.SLEEP
sta (pPs)
lda #0 cld,clc,cli
pha
rti exit to kernel with CC
*--------------------------------------
* *** MUST BE REINTRANT ***
*--------------------------------------
@ -262,14 +323,11 @@ GP.IrqH.Exit stz IRQ.SkipA2osX reset flag
rts
*--------------------------------------
IRQ.SkipA2osX .BS 1
*--------------------------------------
IRQ.Tick .BS 1
IRQ.InKernel .BS 1
IRQ.IntNum .BS 1
IRQ.VBL.n0 .BS 1
IRQ.VBL.0n .BS 1
IRQ.VBL.MSM jmp $0000
IRQ.VBL.MRM jmp $0000
*--------------------------------------
*GO.Reset jsr GO.A2osX
* jmp CORE.Run
@ -284,8 +342,8 @@ GP.CodeEnd .BS $BEE0-*
*--------------------------------------
* $BEF0->$BEFF : Kernel Config Block
*--------------------------------------
.DA #6 60hz
.BS 7
.DA #6 A2osX.HZ=60hz
.HS 00000000000000
.DA #0 ChRoot/Preemptive Disabled
.HS 00000000000000 All Slots marked as "Free"
*--------------------------------------

View File

@ -573,7 +573,7 @@ IrqMgrInit >LDYAI MSG.IRQ
php
sei
>LDYA $FFFE
>STYA IRQ.OldFFFE
>STYA K.IrqHAuxLC.JMP+1
>LDYAI K.IrqHAuxLC
>STYA $FFFE
@ -719,8 +719,8 @@ IrqMgrInit.Mouse
.4 lda ZPPtr1+1
sta .11+2
sta IRQ.VBL.MSM+2
sta IRQ.VBL.MRM+2
sta K.IrqH.VBL.MSM+2
sta K.IrqH.VBL.MRM+2
and #$0f
sta IRQ.VBL.0n
@ -748,11 +748,11 @@ IrqMgrInit.Mouse
ldy #SERVEMOUSE
lda (ZPPtr1),y
sta IRQ.VBL.MSM+1
sta K.IrqH.VBL.MSM+1
ldy #READMOUSE
lda (ZPPtr1),y
sta IRQ.VBL.MRM+1
sta K.IrqH.VBL.MRM+1
jsr IrqMgrInit.HZ2Tick

View File

@ -104,7 +104,7 @@ K.IrqHAuxLC.6 lda #$ff Self Modified
bcc K.IrqHAuxLC.8
dec IRQ.SkipA2osX Make regular ProDOS IRQ manager skip A2osX
jmp (IRQ.OldFFFE) Not handled, pass to ProDOS
K.IrqHAuxLC.JMP jmp $FFFF SELF MODIFIED Not handled, pass to ProDOS
K.IrqHAuxLC.8 rti
*--------------------------------------
* Called by :
@ -122,7 +122,8 @@ K.IrqH.TCLOCK ldy IRQ.VBL.n0
bra K.IrqH.Switch
*--------------------------------------
K.IrqH.VBL jsr IRQ.VBL.MSM SERVEMOUSE
K.IrqH.VBL
K.IrqH.VBL.MSM jsr $FFFF SELF MODIFIED,SERVEMOUSE
bcs K.IrqH.DEV Not From Mouse
ldx IRQ.VBL.0n
@ -130,9 +131,9 @@ K.IrqH.VBL jsr IRQ.VBL.MSM SERVEMOUSE
and #MOUSESTSx.INTVBL IRQ was caused by VBL ?
beq K.IrqH.DEV
ldx IRQ.VBL.MRM+2 $Cn
ldx K.IrqH.VBL.MRM+2 $Cn
ldy IRQ.VBL.n0
jsr IRQ.VBL.MRM READMOUSE
K.IrqH.VBL.MRM jsr $FFFF SELF MODIFIED,READMOUSE
*--------------------------------------
K.IrqH.Switch inc IRQ.Tick
@ -205,8 +206,6 @@ K.IrqH.DEV >LDYAI Dev.Table
*--------------------------------------
.88 jmp ($fe)
*--------------------------------------
IRQ.OldFFFE .BS 2
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.IRQ
LOAD /A2OSX.SRC/SYS/KERNEL.S

View File

@ -365,7 +365,7 @@ K.FreeMem.A phy
bit $C000,x
bra *
*--------------------------------------
K.FreeMem.A.ERR .AZ "***MemMgr:Attempt to Free an already freed hMem at $%H"
K.FreeMem.A.ERR .AZ "FreeMem:%H:hMem already freed."
*/--------------------------------------
* # GetMemPtr.A
* ## In: