mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
119 lines
2.2 KiB
Plaintext
119 lines
2.2 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* Setup MainLC ($3FE)
|
||
*
|
||
*
|
||
* Setup AuxLC $FFFE->Kernel IRQ Handler
|
||
* if irq not handled, jmp (S.IrqMgrOldFFFE)
|
||
*--------------------------------------
|
||
S.IrqMgrInit php
|
||
sei
|
||
>LDYA $FFFE
|
||
cpy #S.IrqHandlerAuxLC
|
||
bne .1
|
||
cmp /S.IrqHandlerAuxLC
|
||
beq .2
|
||
|
||
.1 >STYA S.IrqMgrOldFFFE
|
||
>LDYAI S.IrqHandlerAuxLC
|
||
>STYA $FFFE
|
||
|
||
.2 >LDYAI $BE0C
|
||
>STYA $3F0
|
||
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
S.IrqMgrQuit php
|
||
sei
|
||
>LDYA S.IrqMgrOldFFFE
|
||
>STYA $FFFE
|
||
plp
|
||
cli
|
||
.8 rts
|
||
*--------------------------------------
|
||
S.BrkHandlerAuxLC
|
||
bra *
|
||
*--------------------------------------
|
||
* 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
|
||
*--------------------------------------
|
||
S.IrqHandlerAuxLC
|
||
sta S.IrqMgr.A
|
||
pla
|
||
pha
|
||
and #$10 BRK?
|
||
beq .10
|
||
lda S.IrqMgr.A
|
||
.82 jmp (S.IrqMgrOldFFFE)
|
||
|
||
.10 stx S.IrqMgr.X
|
||
sty S.IrqMgr.Y
|
||
lda $fe
|
||
pha
|
||
lda $ff
|
||
pha
|
||
lda RDREADAUX
|
||
pha
|
||
sta CLRREADAUX Make sure we can access DevMgr.Table
|
||
|
||
>LDYAI DevMgr.Table
|
||
>STYA $fe
|
||
|
||
.1 lda ($fe) End Of Table ?
|
||
sec
|
||
beq .8
|
||
|
||
ldy #S.DEV.F
|
||
lda ($fe),y
|
||
and #S.DEV.F.IRQ
|
||
beq .2
|
||
|
||
jsr S.IrqHandlerJMP
|
||
bcc .8 CC, IRQ cleared by device
|
||
|
||
.2 lda $fe CS,
|
||
adc #S.DEV.SIZE-1
|
||
sta $fe
|
||
bcc .1
|
||
inc $ff
|
||
bra .1
|
||
|
||
.8 pla Must keep Carry
|
||
bpl .81
|
||
sta SETREADAUX
|
||
.81 pla
|
||
sta $ff
|
||
pla
|
||
sta $fe
|
||
ldy S.IrqMgr.Y
|
||
ldx S.IrqMgr.X
|
||
lda S.IrqMgr.A
|
||
bcs .82
|
||
rti
|
||
|
||
S.IrqHandlerJMP ldx #DEVMGR.IRQ
|
||
jmp ($fe)
|
||
*--------------------------------------
|
||
S.IrqMgrOldFFFE .BS 2
|
||
S.IrqMgr.A .BS 1
|
||
S.IrqMgr.X .BS 1
|
||
S.IrqMgr.Y .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.IRQ
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|