Improvements to IRQBRKHDLR, recommended by Qkumba

This commit is contained in:
Bobbi Webber-Manners 2021-12-06 20:28:23 -05:00
parent 1a662917a3
commit 3d4b476b5a
2 changed files with 13 additions and 5 deletions

Binary file not shown.

View File

@ -558,27 +558,35 @@ GSBRKAUX >>> IENTAUX ; IENTAUX does not do CLI
IRQBRKHDLR PHA IRQBRKHDLR PHA
* Mustn't enable IRQs within the IRQ handler * Mustn't enable IRQs within the IRQ handler
* Do not use WRTMAIN/WRTAUX macros * Do not use WRTMAIN/WRTAUX macros
BIT $C014 ; Set N if aux write active
STA $C004 ; Write to main memory STA $C004 ; Write to main memory
STA $45 ; $45=A for ProDOS IRQ handlers STA $45 ; $45=A for ProDOS IRQ handlers
BPL :S1 ; If aux write wasn't active, skip
STA $C005 ; Write to aux memory STA $C005 ; Write to aux memory
:S1 TXA
TXA
PHA PHA
CLD CLD
TSX TSX
LDA $103,X ; Get PSW from stack PHX
INX
INX
INX
LDA $100,X ; Get PSW from stack
AND #$10 AND #$10
BEQ :IRQ ; IRQ BEQ :IRQ ; IRQ
SEC SEC
LDA $0104,X INX
LDA $0100,X
SBC #$01 SBC #$01
STA FAULT+0 ; FAULT=>error block after BRK STA FAULT+0 ; FAULT=>error block after BRK
LDA $0105,X INX
LDA $0100,X
SBC #$00 SBC #$00
STA FAULT+1 STA FAULT+1
LDA $F4 ; Get current ROM LDA $F4 ; Get current ROM
STA BYTEVARBASE+$BA ; Set ROM at last BRK STA BYTEVARBASE+$BA ; Set ROM at last BRK
PLX
STX OSXREG ; Pass stack pointer STX OSXREG ; Pass stack pointer
LDA #$06 ; Service Call 6 = BRK occured LDA #$06 ; Service Call 6 = BRK occured
JSR SERVICE JSR SERVICE