A2osX/SYS/KERNEL.S.IRQ.txt

226 lines
4.7 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-05-25 19:24:07 +00:00
AUTO 3,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
sta K.IrqHAuxLC.6+1
pla
pha
and #$10 BRK?
2018-07-25 15:26:14 +00:00
* bne K.IrqHAuxLC.BRK
bne *
2019-09-27 14:53:44 +00:00
stx K.IrqHAuxLC.5+1
sty K.IrqHAuxLC.4+1
2018-12-17 07:02:03 +00:00
lda RDPAGE2
pha
sta CLRPAGE2
lda RDREADAUX
pha
2018-07-11 15:13:29 +00:00
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
2019-10-03 06:25:27 +00:00
K.IrqHAuxLC.JSR jsr K.IrqH.DEV SELF MODIFIED
2019-10-03 06:25:27 +00:00
ldx #CLRCXROM
pla Get CXROM State
bpl .3
2019-10-03 06:25:27 +00:00
inx
2019-10-03 06:25:27 +00:00
.3 sta $C000,x
pla Get back MSLOT
sta MSLOT
sta K.IrqHAuxLC.2+2
and #$F0
2019-09-27 14:53:44 +00:00
eor #$C0 ....mmm...not looking like Cn....
bne K.IrqHAuxLC.3
2019-09-27 14:53:44 +00:00
2019-10-03 06:25:27 +00:00
sta $CFFF Release $C800
2019-10-03 06:25:27 +00:00
K.IrqHAuxLC.2 lda $ff00 SELF MODIFIED
K.IrqHAuxLC.3 pla Must keep Carry
bpl .1
2019-10-03 06:25:27 +00:00
sta SETWRITEAUX
2019-10-03 06:25:27 +00:00
clv coming for AUX.....cancel switch
.1 pla
bpl .2
2019-10-03 06:25:27 +00:00
sta SETREADAUX
2019-10-03 06:25:27 +00:00
clv coming for AUX.....cancel switch
.2 pla
2018-12-17 07:02:03 +00:00
bpl .3
sta SETPAGE2
2019-03-27 21:14:40 +00:00
2019-10-03 06:25:27 +00:00
.3 bvc K.IrqHAuxLC.4 if not V, skip task switching
2019-09-27 14:53:44 +00:00
2019-10-03 06:25:27 +00:00
tsx Check Stack if before "dec IRQ.InKernel"
cpx #$fc $1ff-PChi-PClo-P = $1fc
bcs .8 in CORE.Run or CORE.Dispatch
2019-09-27 14:53:44 +00:00
2019-10-03 06:25:27 +00:00
lda $103,x
cmp /A2osX.SYSCALL
bcs .8 we are in kernel GP or LC
php
php make room for 2 additional bytes
tsx
2019-10-03 06:25:27 +00:00
lda $104,x get RTI PC LO
2018-12-17 07:02:03 +00:00
bne .4
2019-10-03 06:25:27 +00:00
dec $105,x adjust RTI PC HI
2018-12-17 07:02:03 +00:00
.4 dec $104,x back one byte, to make it a "RTS" return adddress
lda $103,x get IRQ pushed P
2019-10-03 06:25:27 +00:00
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
2019-10-03 06:25:27 +00:00
.5 lda #$60+'S'
2018-12-17 07:02:03 +00:00
eor SYS.BASL0+39
sta SYS.BASL0+39
2019-10-03 06:25:27 +00:00
.8 clc
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
2019-10-03 06:25:27 +00:00
dec IRQ.SkipA2osX Make regular ProDOS IRQ manager skip A2osX
K.IrqHAuxLC.JMP jmp $FFFF SELF MODIFIED Not handled, pass to ProDOS
2019-10-03 06:25:27 +00:00
K.IrqHAuxLC.8 rti
*--------------------------------------
* Called by :
2017-10-27 14:56:46 +00:00
* - Kernel K.IrqHAuxLC
* - ProDOS IRQ Manager (GP)
*--------------------------------------
2019-10-22 07:52:34 +00:00
K.IrqH.IIGS lda IO.IIGS.INTFLAG
and #$08
beq K.IrqH.DEV
stz IO.IIGS.CLRVBLINT
bra K.IrqH.Switch
*--------------------------------------
2017-10-27 14:56:46 +00:00
K.IrqH.TCLOCK ldy IRQ.VBL.n0
2019-10-03 06:25:27 +00:00
lda $c080,y
and #$20
2017-10-27 14:56:46 +00:00
beq K.IrqH.DEV
2019-10-03 06:25:27 +00:00
lda $c088,y
2018-12-01 19:39:44 +00:00
lda $c080,y
2019-10-03 06:25:27 +00:00
bra K.IrqH.Switch
*--------------------------------------
K.IrqH.VBL
K.IrqH.VBL.MSM jsr $FFFF SELF MODIFIED,SERVEMOUSE
2017-11-23 16:51:52 +00:00
bcs K.IrqH.DEV Not From Mouse
2017-10-27 14:56:46 +00:00
ldx IRQ.VBL.0n
lda MOUSESTSx,x
and #MOUSESTSx.INTVBL IRQ was caused by VBL ?
2017-10-27 14:56:46 +00:00
beq K.IrqH.DEV
ldx K.IrqH.VBL.MRM+2 $Cn
2017-10-27 14:56:46 +00:00
ldy IRQ.VBL.n0
K.IrqH.VBL.MRM jsr $FFFF SELF MODIFIED,READMOUSE
*--------------------------------------
K.IrqH.Switch inc IRQ.Tick
2018-10-17 15:31:29 +00:00
dec CORE.CPUStatCnt
bne .2
2019-10-03 06:25:27 +00:00
lda #100
2018-10-17 15:31:29 +00:00
sta CORE.CPUStatCnt
2018-10-15 15:39:21 +00:00
ldx #K.PS.MAX-1
2019-10-03 06:25:27 +00:00
2019-01-24 13:53:29 +00:00
.1 lda PS.Table.Hits,x
stz PS.Table.Hits,x
sta PS.Table.Stats,x
dex
2018-10-15 15:39:21 +00:00
bpl .1
2019-10-03 06:25:27 +00:00
.2 lda IRQ.InKernel
bpl .3
2019-01-24 13:53:29 +00:00
inc PS.Table.Hits
2019-10-03 06:25:27 +00:00
.9 clv
clc
rts
2019-10-03 06:25:27 +00:00
.3 ldx CORE.PSIndex
2018-10-17 15:31:29 +00:00
inc PS.Table.Hits,x
bit A2osX.F A2osX.F.PMODE .EQ %01000000
bvc .8
2019-07-22 16:28:44 +00:00
ldy #S.PS.S
lda (pPs),y
2019-10-03 06:25:27 +00:00
eor #S.PS.S.RUN
bne .9
2019-09-27 14:53:44 +00:00
lda IRQ.InLib
bmi .9 we are in LIB, no switching
.8 clc exit with V flag set
rts
2019-10-22 07:52:34 +00:00
*--------------------------------------
2018-07-05 15:39:36 +00:00
K.IrqH.DEV ldx #0
2018-10-11 15:23:06 +00:00
.1 lda IRQ.Vectors+1,x
beq .9
2019-07-16 15:42:36 +00:00
sta .10+2
2018-10-11 15:23:06 +00:00
lda IRQ.Vectors,x
2018-07-10 15:33:13 +00:00
sta .10+1
phx
2018-07-05 15:39:36 +00:00
.10 jsr $ffff SELF MODIFIED
plx
bcc .8 CC, IRQ cleared by device
2018-07-05 15:39:36 +00:00
.2 inx
2018-10-11 15:23:06 +00:00
inx
.3 cpx #K.IRQDEV.MAX*2
bne .1
2018-10-11 15:23:06 +00:00
.9 sec
.8 clv clear V (no task switching)
rts
*--------------------------------------
2019-08-01 14:59:15 +00:00
IRQ.Vectors .BS K.IRQDEV.MAX*2
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.IRQ
LOAD USR/SRC/SYS/KERNEL.S
ASM