Kernel 0.9.1 : New IRQ manager, supporting ThunderClock Plus

This commit is contained in:
Rémy GIBERT 2017-10-11 17:37:41 +02:00
parent 33a96ed69a
commit 3022b08c89
10 changed files with 259 additions and 106 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -347,7 +347,7 @@ OptionList >PSTR "CRcr"
OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse
*--------------------------------------
MSG.USAGE >CSTR "Usage : CHTYP [File *,? wildcards allowed] [File type : 0xx (Hexadecimal byte),SYS,TXT....]\r\n -C : Continue on error\r\n -R : Recurse subdirectories\r\n"
MSG.OK >CSTR "[Ok]\r\n"
MSG.OK >CSTR "[OK]\r\n"
MSG.ERR >CSTR "[%h]\r\n"
MSG.FILE >CSTR "CHTYP File:%S..."

View File

@ -66,27 +66,6 @@ A2osX.SLOTS.XY .EQ $E1
A2osX.SLOTS.NET .EQ $E2
A2osX.SLOTS.DISABLE .EQ $FF
*--------------------------------------
H.BIN.HEADER .EQ 0
H.BIN.HEADER.DRV65 .EQ $4CD8 6502:cld,jmp abs
H.BIN.HEADER.LIB65 .EQ $7CD8 6502:cld,jmp (abs,x)
H.BIN.HEADER.BIN65 .EQ $7CD8 6502:cld,jmp (abs,x)
*H.BIN.HEADER.LIB80 .EQ $A28D Z80:
*H.BIN.HEADER.BIN80 .EQ $A28D Z80:
H.BIN.JMP .EQ 2
*H.BIN.CODE.TYPE .EQ 4
*H.BIN.VERSION .EQ 5
H.BIN.CODE.LEN .EQ 8
*
H.BIN.EXE.DS.SIZE .EQ 10
H.BIN.EXE.SS.SIZE .EQ 12
H.BIN.EXE.ZP.SIZE .EQ 13
H.BIN.EXE.REL.TABLE .EQ 16
*
H.BIN.DRV.HEADER.O .EQ 10
H.BIN.DRV.CODE.O .EQ 12
H.BIN.DRV.CODE.LEN .EQ 14
H.BIN.DRV.REL.TABLE .EQ 0
*--------------------------------------
* A2osX.SYSCALL Functions Indexes
*--------------------------------------
* .EQ $00

View File

@ -13,6 +13,27 @@ K.EVT.MAX .EQ 8
K.DEV.MAX .EQ 32
K.PS.MAX .EQ 32
*--------------------------------------
H.BIN.HEADER .EQ 0
H.BIN.HEADER.DRV65 .EQ $4CD8 6502:cld,jmp abs
H.BIN.HEADER.LIB65 .EQ $7CD8 6502:cld,jmp (abs,x)
H.BIN.HEADER.BIN65 .EQ $7CD8 6502:cld,jmp (abs,x)
*H.BIN.HEADER.LIB80 .EQ $A28D Z80:
*H.BIN.HEADER.BIN80 .EQ $A28D Z80:
H.BIN.JMP .EQ 2
*H.BIN.CODE.TYPE .EQ 4
*H.BIN.VERSION .EQ 5
H.BIN.CODE.LEN .EQ 8
*
H.BIN.EXE.DS.SIZE .EQ 10
H.BIN.EXE.SS.SIZE .EQ 12
H.BIN.EXE.ZP.SIZE .EQ 13
H.BIN.EXE.REL.TABLE .EQ 16
*
H.BIN.DRV.HEADER.O .EQ 10
H.BIN.DRV.CODE.O .EQ 12
H.BIN.DRV.CODE.LEN .EQ 14
H.BIN.DRV.REL.TABLE .EQ 0
*--------------------------------------
* Kernel ZP Aux
*--------------------------------------
ZPKERNEL .EQ $0

View File

@ -114,7 +114,7 @@ CORE.Events jsr CORE.GetEvents
clc
adc #S.EVT
sta pEvent
lda EVTMGR.COUNT
lda CORE.EvtCount
bne .1
*--------------------------------------
.4 lda A2osX.ASCREEN
@ -157,59 +157,72 @@ CORE.Events jsr CORE.GetEvents
CORE.GetEvents lda #EvtMgr.Table
sta pEvent point to start of event list
stz EvtMgr.Count reset Size
stz CORE.EvtCount reset Size
lda K.IrkMgr.VBL do we have IRQ enabled for VBL ?
bpl .10 no, regular poll
bit CORE.IRQMode do we have IRQ enabled for Ticks ?
bpl .1 no, regular poll
lda K.IrkMgr.VBLINT
beq .3 no
lda CORE.IRQTick a Tick ?
beq .8 no, no event
dec K.IrkMgr.VBLINT
bra .11
.10 lda VBL get VLINE status
dec CORE.IRQTick
bra .2
.1 lda VBL get VLINE status
tax
eor EvtMgr.VBLState
bpl .3 no change,no tick
eor CORE.VBLState
bpl .8 no change,no tick
txa
sta EvtMgr.VBLState save new
bpl .3 Up2down transition,no tick
sta CORE.VBLState save new
bpl .8 Up2down transition,no tick
.11 inc A2osX.TIMER16
bne .1
lda SYS.BASL0+37
eor #$80
sta SYS.BASL0+37
.2 inc A2osX.TIMER16
bne .3
inc A2osX.TIMER16+1
.1 dec EvtMgr.HZ.CNT
bne .3 not yet 100ms
ldx A2osX.HZ
stx EvtMgr.HZ.CNT
lda #S.EVT.F.T10TH
dec EvtMgr.10TH.CNT
bne .2
.3 lda #0
ldx #10
stx EvtMgr.10TH.CNT
dec CORE.TickSec
bne .4 not yet One Sec
ldx CORE.TickPerSec
stx CORE.TickSec
ora #S.EVT.F.T1SEC
.4 dec CORE.Tick10t
bne .5
.2 sta (pEvent)
inc EvtMgr.Count Add one event to Queue
ldx CORE.TickPer10t
stx CORE.Tick10t
lda pEvent
clc
adc #S.EVT
sta pEvent if CS, EVT queue full!!! ($100)
ora #S.EVT.F.T10TH
.5 tax Finally, do we have an event ?
beq .8 no....
sta (pEvent)
inc CORE.EvtCount Add one event to Queue
.3 sec
lda EvtMgr.Count if 0, exit with CS (from cmp), and A=0 "no event"
* lda pEvent
* clc
* adc #S.EVT
* sta pEvent if CS, EVT queue full!!! ($100)
* MORE EVENT PROCESSING HERE
.8 lda CORE.EvtCount if 0, exit with CS (from cmp), and A=0 "no event"
beq .9
.8 clc
.9 rts
clc
rts
.9 sec
rts
*--------------------------------------
* CORE.DispatchEvents
* IN:
@ -243,7 +256,7 @@ CORE.DispatchEvents
lda #EvtMgr.Table
sta pEvent Select first event in list
lda EVTMGR.COUNT
lda CORE.EvtCount
sta TSKMGR.EVENTCNT
.2 lda (pEvent) Empty event, select next
@ -254,7 +267,7 @@ CORE.DispatchEvents
bcs .3 not for this PS, try next event in list
jsr CORE.DestroyEvent this PS handled the EVT, destroy it...
lda EVTMGR.COUNT
lda CORE.EvtCount
beq .8 no more event, exit
.3 dec TSKMGR.EVENTCNT
@ -407,7 +420,7 @@ CORE.DestroyEvent
.2 lda #0
sta (pEvent)
dec EvtMgr.Count
dec CORE.EvtCount
.9 rts
*--------------------------------------
CORE.PSSelect0 >LDYAI CORE.S.PS0 Select PS0
@ -480,10 +493,17 @@ DevMgr.Free .DA DevMgr.FreeMem
.DA DevMgr.HiMem
DevMgr.Count .DA #2 NUL,SYS
*--------------------------------------
EvtMgr.VBLState .BS 1
EvtMgr.10TH.CNT .BS 1
EvtMgr.HZ.CNT .BS 1
EvtMgr.Count .BS 1
CORE.EvtCount .BS 1
CORE.VBLState .BS 1
CORE.IRQMode .BS 1
CORE.IRQTick .BS 1
CORE.TickPerSec .BS 1
CORE.TickPer10t .BS 1
CORE.TickSec .BS 1
CORE.Tick10t .BS 1
*--------------------------------------
CORE.CPULoadI .BS 1
CORE.CPULoadC .AS -"/-\|"

View File

@ -464,7 +464,68 @@ IrqMgrInit >LDYAI MSG.IRQ
lda K.MLI.PARAMS+1
sta ProDOS.INTNUM
plp
jsr IrqMgrInit.Mouse
bcs .1
lda #'v'
sta SYS.BASL0+37
>LDYAI K.IrqHandler.VBL
>STYA K.IrqHandler+1
>LDYAI MSG.IRQ.VBL
>SYSCALL PrintF.YA
clc
rts
.1 jsr IrqMgrInit.TClock
bcs .8
lda #'c'
sta SYS.BASL0+37
>LDYAI K.IrqHandler.TClock
>STYA K.IrqHandler+1
>LDYAI MSG.IRQ.CLOCK
>SYSCALL PrintF.YA
clc
rts
.8 jsr IrqMgrInit.HZ2Tick
lda #'p'
sta SYS.BASL0+37
>LDYAI MSG.IRQ.POLL
>SYSCALL PrintF.YA
clc
rts
.9 plp
sec
rts
*--------------------------------------
IrqMgrInit.HZ2Tick
ldx #50
lda A2osX.HZ
sta CORE.TickPer10t
sta CORE.Tick10t
cmp #5
beq .1
ldx #60
.1 stx CORE.TickPerSec
stx CORE.TickSec
rts
*--------------------------------------
IrqMgrInit.Mouse
stz ZPPtr1 Try finding a Mouse Card...
lda #$C1
sta ZPPtr1+1
@ -484,11 +545,6 @@ IrqMgrInit >LDYAI MSG.IRQ
cmp #$C8
bne .1
plp
clc
rts
.9 plp
sec
rts
@ -524,27 +580,85 @@ IrqMgrInit >LDYAI MSG.IRQ
stx .7+2
ldy K.IrqMgrVBL.n0
php
sei
bit RROMBNK2 Renable ROM to allow MOUSE II firmware works properly
.7 jsr $ffff self Modified, CALL SETMOUSE
bcs *
bcs .9
bit RRAMWRAMBNK1 Back To LC Ram
bit RRAMWRAMBNK1
inc K.IrkMgr.VBL set=1 awaiting IrqMgr confirmation
jsr IrqMgrInit.HZ2Tick
dec CORE.IRQMode
plp
lda #"V"
sta SYS.BASL0+37
>LDYAI MSG.IRQ.VBL
>SYSCALL PrintF.YA
clc
clc
rts
*--------------------------------------
.9 plp
sec
rts
Mouse.OFS .HS 05070B0CFB
Mouse.SIG .HS 38180120D6
*--------------------------------------
IrqMgrInit.TClock
stz ZPPtr1 Try finding a Mouse Card...
lda #$C1
sta ZPPtr1+1
.1 ldy #31
.2 lda (ZPPtr1),y
cmp TClock.SIG,y
bne .3
dey
bpl .2
bra .4
.3 inc ZPPtr1+1 no match, try next slot....
lda ZPPtr1+1
cmp #$C8
bne .1
.4 lda ZPPtr1+1 get $Cn
and #$f
tax get $0n
asl
asl
asl
asl
tay get $n0
sty K.IrqMgrVBL.n0
lda #$40 Enable interrupt
sta $c080,y
sta $478,x
sta $7f8,x
lda #64
sta CORE.TickPerSec
sta CORE.TickSec
lda #11
sta CORE.TickPer10t
sta CORE.Tick10t
dec CORE.IRQMode
clc
rts
.9 sec
rts
TClock.SIG .HS 0878282c58ff700538b00118b8087848
.HS 8a489848adffcf201ac86868ba8df807
*--------------------------------------
DevMgrInit >LDYAI MSG.DEV
>SYSCALL PrintF.YA
@ -805,7 +919,9 @@ MSG.Init2.OK >CSTR "A2osX[Stage2]:Complete.\n"
MSG.Init3 >CSTR "A2osX[Stage3]:Init\r\n"
MSG.DEV >CSTR "-Device Manager...\r\n"
MSG.IRQ >CSTR "-Interrupt Manager...\r\n"
MSG.IRQ.VBL >CSTR " (VBL IRQ Activated)\r\n"
MSG.IRQ.VBL >CSTR " (Mouse VBL IRQ Activated)\r\n"
MSG.IRQ.CLOCK >CSTR " (Clock Card IRQ Activated)\r\n"
MSG.IRQ.POLL >CSTR " (Polling Mode)\r\n"
MSG.EVT >CSTR "-Event Manager...\r\n"
MSG.FLT >CSTR "-Path Filter...\r\n"
MSG.TSK >CSTR "-Task Manager...\r\n"

View File

@ -14,17 +14,14 @@ AUTO 6
* must call regular System Handler
*--------------------------------------
K.IrqHandlerAuxLC
sta K.IrqMgr.A
sta .12+1
pla
pha
and #$10 BRK?
beq .10
bra *
lda K.IrqMgr.A
.82 jmp (K.IrqMgrOldFFFE)
bne .2
.10 stx K.IrqMgr.X
sty K.IrqMgr.Y
stx .11+1
sty .10+1
lda $fe
pha
lda $ff
@ -36,32 +33,54 @@ K.IrqHandlerAuxLC
jsr K.IrqHandler
pla Must keep Carry
bpl .81
bpl .1
sta SETREADAUX
.81 pla
.1 pla
sta $ff
pla
sta $fe
ldy K.IrqMgr.Y
ldx K.IrqMgr.X
lda K.IrqMgr.A
bcs .82
.10 ldy #$ff Self Modified
.11 ldx #$ff Self Modified
.12 lda #$ff Self Modified
bcs .8
rti
.2
* bra * BRK
lda .12+1
.8 jmp (K.IrqMgrOldFFFE)
*--------------------------------------
K.IrqMgrOldFFFE .BS 2
K.IrqMgr.A .BS 1
K.IrqMgr.X .BS 1
K.IrqMgr.Y .BS 1
K.IrkMgr.VBL .BS 1
K.IrkMgr.VBLINT .BS 1
*--------------------------------------
* Called by :
* Kernel IrqHandlerAuxLC
* ProDOS IRQ Manager (GP)
*--------------------------------------
K.IrqHandler lda K.IrkMgr.VBL
beq K.IrqHandler.DEV 0, totally disabled....
K.IrqHandler jmp K.IrqHandler.DEV Modified by INIT
*--------------------------------------
K.IrqHandler.TCLOCK
ldy K.IrqMgrVBL.n0
lda $c080,y
and #$20
beq K.IrqHandler.DEV
lda $c080,y
lda $c088,y
inc CORE.IRQTick
lda SYS.BASL0+37
eor #$80
sta SYS.BASL0+37
clc
rts
*--------------------------------------
K.IrqHandler.VBL
jsr K.IrqMgrVBL.MSM SERVEMOUSE
bcs K.IrqHandler.DEV Not From Mouse
@ -74,14 +93,12 @@ K.IrqHandler.VBL
ldx K.IrqMgrVBL.MRM+2 $Cn
ldy K.IrqMgrVBL.n0
jsr K.IrqMgrVBL.MRM READMOUSE
inc K.IrkMgr.VBLINT
inc CORE.IRQTick
lda SYS.BASL0+37
eor #$80
sta SYS.BASL0+37
sec
ror K.IrkMgr.VBL Confirm VBL signal valid for EvtMgr
clc
rts