A2osX/SYS/KERNEL.S.IRQ.txt

194 lines
3.9 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
AUTO 4,1
*--------------------------------------
* called directly by IRQ Vector $FFFE in AuxLC
* Must keep:
* A,X,Y
* SETREADAUX
* if we are here, Aux ZP/Stack already On
* Exit with RTI
* if A2osX Drivers cannot clear IRQ,
* must call regular System Handler
*--------------------------------------
MSLOT .EQ $7f8
*--------------------------------------
K.IrqHAuxLC cld
sec
sta K.IrqHAuxLC.6+1
pla
pha
and #$10 BRK?
bne K.IrqHAuxLC.6
stx K.IrqHAuxLC.5+1
sty K.IrqHAuxLC.4+1
lda $fe Save 2 bytes in ZP
pha
lda $ff
pha
lda MSLOT Save MSLOT
pha
lda RDREADAUX
pha
sta CLRREADAUX Make sure we can access Dev.Table
lda RDWRITEAUX
pha
sta CLRWRITEAUX Driver may R/W in screen holes
K.IrqHAuxLC.JSR jsr K.IrqH.DEV SELF MODIFIED
pla Must keep Carry
bpl K.IrqHAuxLC.10
sta SETWRITEAUX
K.IrqHAuxLC.10 pla
bpl K.IrqHAuxLC.1
sta SETREADAUX
K.IrqHAuxLC.1 pla Get back MSLOT
sta MSLOT
sta K.IrqHAuxLC.2+2
and #$C0
eor #$C0 ....mmm...not looking link Cn....
bne K.IrqHAuxLC.3
sta $CFFF Release $C800
K.IrqHAuxLC.2 lda $ff00 SELF MODIFIED
K.IrqHAuxLC.3 pla
sta $ff
pla
sta $fe
bvc K.IrqHAuxLC.4 no task switching
php
php make room for 2 additional bytes
php keep track of C
tsx
sec
lda $105,x get RTI PC LO
sbc #1 back one byte, to make it a "RTS" return adddress
sta $105,x
bcs .1
dec $106,x adjust RTI PC HI
.1 lda $104,x get IRQ pushed P
sta $102,x down 2 bytes
lda #CORE.Switch make a RTI like "jsr CORE.Sleep"
sta $103,x
lda /CORE.Switch with RTS=PC IRQ-1
sta $104,x
plp
K.IrqHAuxLC.4 ldy #$ff Self Modified
K.IrqHAuxLC.5 ldx #$ff Self Modified
K.IrqHAuxLC.6 lda #$ff Self Modified
bcc K.IrqHAuxLC.8
dec IRQ.SkipA2osX Make regular ProDOS IRQ manager skip A2osX
jmp (K.IRQ.OldFFFE) Not handled, pass to ProDOS
K.IrqHAuxLC.8 rti
*--------------------------------------
* Called by :
2017-10-27 14:56:46 +00:00
* - Kernel K.IrqHAuxLC
* - ProDOS IRQ Manager (GP)
*--------------------------------------
2017-10-27 14:56:46 +00:00
K.IrqH.TCLOCK ldy IRQ.VBL.n0
lda $c080,y
and #$20
2017-10-27 14:56:46 +00:00
beq K.IrqH.DEV
lda $c080,y
lda $c088,y
bra K.IrqH.Switch
*--------------------------------------
2017-11-23 16:51:52 +00:00
K.IrqH.VBL jsr IRQ.VBL.MSM SERVEMOUSE
bcs K.IrqH.DEV Not From Mouse
2017-10-27 14:56:46 +00:00
ldx IRQ.VBL.0n
lda $778,x
and #$08 IRQ was caused by VBL ?
2017-10-27 14:56:46 +00:00
beq K.IrqH.DEV
2017-11-23 16:51:52 +00:00
ldx IRQ.VBL.MRM+2 $Cn
2017-10-27 14:56:46 +00:00
ldy IRQ.VBL.n0
2017-11-23 16:51:52 +00:00
jsr IRQ.VBL.MRM READMOUSE
*--------------------------------------
K.IrqH.Switch inc IRQ.Tick
bit A2osX.F A2osX.F.PMODE .EQ %01000000
bvc .8
lda IRQ.InKernel keep V flag set
bmi .9
lda #$A0+'S
eor SYS.BASL0+37
sta SYS.BASL0+37
ldy #S.PS.STATS
lda (pPs),y
inc
sta (pPs),y
.8 clc exit with V flag set
rts
.9 clv
clc
rts
*--------------------------------------
2017-10-27 14:56:46 +00:00
K.IrqH.DEV >LDYAI Dev.Table
>STYA $fe
ldx DevMgr.Count
.4 ldy #S.DEV.S
lda ($fe),y
and #S.DEV.S.IRQ
beq .6
phx
2017-10-27 14:56:46 +00:00
jsr K.IrqHJMP
plx
bcc .8 CC, IRQ cleared by device
.6 lda $fe
clc
adc #S.DEV
sta $fe
bcc .7
inc $ff
.7 dex
bne .4
sec
.8 clv clear V (no task switching)
rts
*--------------------------------------
K.IRQ.OldFFFE .BS 2
*--------------------------------------
2017-10-27 14:56:46 +00:00
K.IrqHJMP ldx #DEVMGR.IRQ
jmp ($fe)
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.IRQ
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM