A2osX/SYS/KERNEL.S.IRQ.txt
2023-11-04 15:42:28 +01:00

133 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
* called directly by IRQ Vector $FFFE in AuxLC
* Must keep:
* A,X,Y
* IO.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
*--------------------------------------
*IRQ.BRK jmp IRQ.6
*--------------------------------------
IRQ.Handler cld
sta IRQ.6+1
pla
pha
and #$10 BRK?
* bne IRQ.BRK
bne *
stx IRQ.5+1
sty IRQ.4+1
lda IO.RD80STORE
and IO.RDPAGE2
pha
sta IO.CLRPAGE2
lda IO.RDREADAUX
pha
sta IO.CLRREADAUX Make sure we can access FD.Table
lda IO.RDWRITEAUX
pha
sta IO.CLRWRITEAUX Driver may R/W in screen holes
lda MSLOT Save MSLOT
sta IRQ.2+2
* lda IO.RDCXROM C100-C7ff state
* pha
* sta IO.CLRCXROM Enable access to slot C100-C7ff space
IRQ.JSR jsr CORE.IRQ.DEV SELF MODIFIED
* ldx #IO.CLRCXROM
* pla Get CXROM State
* bpl .3
* inx X = SETCXROM
*.3 sta $C000,x
lda IRQ.2+2 Get back MSLOT
sta MSLOT
and #$F0
eor #$C0 ....mmm...not looking like Cn....
bne IRQ.3
sta IO.CLRC8ROM Release $C800
IRQ.2 lda $ff00 SELF MODIFIED
IRQ.3 pla Must keep Carry
bpl .1
sta IO.SETWRITEAUX
clv coming for AUX.....cancel switch
.1 pla
bpl .2
sta IO.SETREADAUX
clv coming for AUX.....cancel switch
.2 pla
bpl .3
sta IO.SETPAGE2
.3 bvc IRQ.4 if not V, skip task switching
tsx Check Stack if before "dec IRQ.InKernel"
cpx #$fc $1ff-PChi-PClo-P = $1fc
bcs .8 in CORE.Run or CORE.Dispatch
lda $103,x
cmp /A2osX.SYSCALL
bcs .8 we are in kernel GP or LC
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
.8 clc
IRQ.4 ldy #$ff Self Modified
IRQ.5 ldx #$ff Self Modified
IRQ.6 lda #$ff Self Modified
bcc IRQ.8
dec IRQ.Skip Make regular ProDOS IRQ manager skip A2osX
IRQ.JMP jmp $FFFF SELF MODIFIED Not handled, pass to ProDOS
IRQ.8 rti
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.irq
LOAD usr/src/sys/kernel.s
ASM