mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
242 lines
4.7 KiB
Plaintext
242 lines
4.7 KiB
Plaintext
NEW
|
||
PREFIX
|
||
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.BRK jmp K.IrqHAuxLC.6
|
||
*--------------------------------------
|
||
K.IrqHAuxLC cld
|
||
|
||
sec
|
||
|
||
sta K.IrqHAuxLC.6+1
|
||
pla
|
||
pha
|
||
and #$10 BRK?
|
||
* bne K.IrqHAuxLC.BRK
|
||
bne *
|
||
stx K.IrqHAuxLC.5+1
|
||
sty K.IrqHAuxLC.4+1
|
||
|
||
lda $fe Save 2 bytes in ZP
|
||
pha
|
||
lda $ff
|
||
pha
|
||
|
||
lda RDPAGE2
|
||
pha
|
||
sta CLRPAGE2
|
||
|
||
lda RDREADAUX
|
||
pha
|
||
sta CLRREADAUX Make sure we can access FD.Table
|
||
|
||
lda RDWRITEAUX
|
||
pha
|
||
sta CLRWRITEAUX Driver may R/W in screen holes
|
||
|
||
lda MSLOT Save MSLOT
|
||
pha
|
||
|
||
lda RDCXROM
|
||
pha
|
||
sta CLRCXROM Enable access to slot C800 space
|
||
|
||
K.IrqHAuxLC.JSR jsr K.IrqH.DEV SELF MODIFIED
|
||
|
||
ldx #CLRCXROM
|
||
|
||
pla Get CXROM State
|
||
bpl .3
|
||
inx
|
||
.3 sta $C000,x
|
||
|
||
pla Get back MSLOT
|
||
sta MSLOT
|
||
sta K.IrqHAuxLC.2+2
|
||
|
||
and #$F0
|
||
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 Must keep Carry
|
||
bpl .1
|
||
|
||
sta SETWRITEAUX
|
||
|
||
.1 pla
|
||
bpl .2
|
||
|
||
sta SETREADAUX
|
||
|
||
.2 pla
|
||
bpl .3
|
||
|
||
sta SETPAGE2
|
||
|
||
.3 pla
|
||
sta $ff
|
||
pla
|
||
sta $fe
|
||
|
||
bvc K.IrqHAuxLC.4 if V, skip task switching
|
||
|
||
bit IRQ.InLib
|
||
bmi K.IrqHAuxLC.4 we are in LIB, no switching
|
||
|
||
tsx
|
||
txa
|
||
eor #$FC Only LO,HI & P on stack
|
||
beq K.IrqHAuxLC.4 we are in kernel CORE.Run
|
||
|
||
php
|
||
php make room for 2 additional bytes
|
||
|
||
tsx
|
||
|
||
lda $104,x get RTI PC LO
|
||
bne .4
|
||
dec $105,x adjust RTI PC HI
|
||
|
||
.4 dec $104,x back one byte, to make it a "RTS" return adddress
|
||
|
||
lda $103,x get IRQ pushed P
|
||
sta $101,x down 2 bytes
|
||
|
||
lda #A2osX.SLEEP make a RTI like "jsr A2osX.SLEEP"
|
||
sta $102,x
|
||
lda /A2osX.SLEEP with RTS=PC IRQ-1
|
||
sta $103,x
|
||
|
||
lda #$A0+'S
|
||
eor SYS.BASL0+39
|
||
sta SYS.BASL0+39
|
||
|
||
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
|
||
K.IrqHAuxLC.JMP jmp $FFFF SELF MODIFIED Not handled, pass to ProDOS
|
||
K.IrqHAuxLC.8 rti
|
||
*--------------------------------------
|
||
* Called by :
|
||
* - Kernel K.IrqHAuxLC
|
||
* - ProDOS IRQ Manager (GP)
|
||
*--------------------------------------
|
||
K.IrqH.TCLOCK ldy IRQ.VBL.n0
|
||
|
||
lda $c080,y
|
||
and #$20
|
||
beq K.IrqH.DEV
|
||
|
||
lda $c088,y
|
||
lda $c080,y
|
||
|
||
bra K.IrqH.Switch
|
||
*--------------------------------------
|
||
K.IrqH.VBL
|
||
K.IrqH.VBL.MSM jsr $FFFF SELF MODIFIED,SERVEMOUSE
|
||
bcs K.IrqH.DEV Not From Mouse
|
||
|
||
ldx IRQ.VBL.0n
|
||
lda MOUSESTSx,x
|
||
and #MOUSESTSx.INTVBL IRQ was caused by VBL ?
|
||
beq K.IrqH.DEV
|
||
|
||
ldx K.IrqH.VBL.MRM+2 $Cn
|
||
ldy IRQ.VBL.n0
|
||
K.IrqH.VBL.MRM jsr $FFFF SELF MODIFIED,READMOUSE
|
||
*--------------------------------------
|
||
K.IrqH.Switch inc IRQ.Tick
|
||
|
||
dec CORE.CPUStatCnt
|
||
bne .2
|
||
|
||
lda #100
|
||
sta CORE.CPUStatCnt
|
||
|
||
ldx #K.PS.MAX-1
|
||
|
||
.1 lda PS.Table.Hits,x
|
||
stz PS.Table.Hits,x
|
||
sta PS.Table.Stats,x
|
||
dex
|
||
bpl .1
|
||
|
||
.2 lda IRQ.InKernel keep V flag set
|
||
bpl .3
|
||
|
||
inc PS.Table.Hits
|
||
|
||
.9 clv
|
||
clc
|
||
rts
|
||
|
||
.3 ldx CORE.PSIndex
|
||
inc PS.Table.Hits,x
|
||
|
||
bit A2osX.F A2osX.F.PMODE .EQ %01000000
|
||
bvc .8
|
||
|
||
lda (pPs)
|
||
and #S.PS.F.DOEVENT
|
||
bne .9
|
||
|
||
.8 clc exit with V flag set
|
||
rts
|
||
*--------------------------------------
|
||
K.IrqH.DEV ldx #0
|
||
|
||
.1 lda IRQ.Vectors+1,x
|
||
beq .9
|
||
|
||
sta $ff
|
||
lda IRQ.Vectors,x
|
||
sta $fe
|
||
|
||
ldy #S.FD.DEV.DRVPTR
|
||
lda ($fe),y
|
||
|
||
sta .10+1
|
||
iny
|
||
lda ($fe),y
|
||
sta .10+2
|
||
|
||
phx
|
||
ldx #IOCTL.IRQ
|
||
.10 jsr $ffff SELF MODIFIED
|
||
|
||
plx
|
||
bcc .8 CC, IRQ cleared by device
|
||
|
||
.2 inx
|
||
inx
|
||
|
||
.3 cpx #K.IRQDEV.MAX*2
|
||
bne .1
|
||
|
||
.9 sec
|
||
|
||
.8 clv clear V (no task switching)
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.IRQ
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|