1
0
mirror of https://github.com/cc65/cc65.git synced 2026-01-27 04:16:12 +00:00

Apple2: Setup IRQ/RST vectors in LC if needed

Programs running under DOS3.3 need to setup correct
reset and IRQ vectors in the language card.
This commit is contained in:
Colin Leroy-Mira
2025-06-12 08:51:55 +02:00
committed by Oliver Schmidt
parent 2470851bfd
commit 990d65e4e4
4 changed files with 27 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ DOSWARM := $03D0 ; DOS warmstart vector
BRKVec := $03F0 ; Break vector
SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
ROM_RST := $FFFC ; 6502 reset vector
ROM_IRQ := $FFFE ; 6502 IRQ vector
;-----------------------------------------------------------------------------
; 80 column firmware

View File

@@ -87,7 +87,7 @@ several useful settings:
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
2 at all.
<tag>LC address: &dollar;D000, LC size: &dollar;3000</tag>
<tag>LC address: &dollar;D000, LC size: &dollar;2FFC</tag>
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
</descrip><p>

View File

@@ -88,7 +88,7 @@ several useful settings:
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
2 at all.
<tag>LC address: &dollar;D000, LC size: &dollar;3000</tag>
<tag>LC address: &dollar;D000, LC size: &dollar;2FFC</tag>
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
</descrip><p>

View File

@@ -58,6 +58,7 @@ init: ldx #zpspace-1
; Check for ProDOS.
ldy $BF00 ; MLI call entry point
cpy #$4C ; Is MLI present? (JMP opcode)
php ; Remember whether we're running ProDOS
bne basic
; Check the ProDOS system bit map.
@@ -99,7 +100,20 @@ basic: lda HIMEM
bit $C081
bit $C081
; Set the source start address.
plp ; Are we running ProDOS?
beq :+ ; Yes, no need to patch vectors
lda #<reset_6502
ldx #>reset_6502
sta ROM_RST
stx ROM_RST+1
lda #<irq_6502
ldx #>irq_6502
sta ROM_IRQ
stx ROM_IRQ+1
: ; Set the source start address.
; Aka __LC_LOAD__ iff segment LC exists.
lda #<(__ONCE_LOAD__ + __ONCE_SIZE__)
ldy #>(__ONCE_LOAD__ + __ONCE_SIZE__)
@@ -144,6 +158,14 @@ quit: jsr $BF00 ; MLI call entry point
.byte $65 ; Quit
.word q_param
reset_6502: ; Used with DOS3.3 programs
bit $C082 ; Switch in ROM
jmp (ROM_RST) ; Jump to ROM's RESET vector
irq_6502: ; Used with DOS3.3 programs
bit $C082 ; Switch in ROM
jmp (ROM_IRQ) ; Jump to ROM's IRQ/BRK vector
; ------------------------------------------------------------------------
.rodata