outline: demo: support Apple IIc

there were multiple things going wrong here

should probably merge changes back to pt3_lib
This commit is contained in:
Vince Weaver 2021-05-19 22:25:18 -04:00
parent 95e9dbfc1d
commit adbd7e2817
6 changed files with 97 additions and 28 deletions

View File

@ -64,6 +64,7 @@ OUTLINE: outline.o
ld65 -o OUTLINE outline.o -C apple2_5000.inc
outline.o: outline.s zp.inc \
pt3_lib_mockingboard_setup.s \
shimmer.s a2_inside.s drops.s wires.s \
rotoplasma_tiny.s rocket_away.s anothermist.s \
flying_dir.inc tfv_flying.s flying_mode7.s credits.s

View File

@ -34,6 +34,8 @@ outline_demo:
lda #1
sta LOOP
jsr detect_appleii_model
jsr mockingboard_detect
bcc mockingboard_not_found
setup_interrupt:
@ -102,6 +104,7 @@ forever:
jmp forever
.include "pt3_lib_detect_model.s"
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "pt3_lib_mockingboard_setup.s"

View File

@ -0,0 +1,37 @@
;===========================
; Check for Apple IIc
;===========================
; ' ' ($20) = Apple II
; '+' ($2B) = Apple II+
; 'E' ($45) = Apple IIe
; 'C' ($43) = Apple IIc
; 'G' ($47) = Apple IIgs
; it does interrupts differently
detect_appleii_model:
lda #' '
sta APPLEII_MODEL
lda $FBB3 ; IIe and newer is $06
cmp #6
beq apple_iie_or_newer
; TODO: check for II+
jmp done_apple_detect
apple_iie_or_newer:
; TODO: check for IIe
lda $FBC0 ; 0 on a IIc
bne done_apple_detect
apple_iic:
lda #'C'
sta APPLEII_MODEL
done_apple_detect:
rts

View File

@ -33,6 +33,24 @@
;------------------------------------------------------------------------------
mockingboard_detect:
; activate IIc mockingboard?
; this might only be necessary to allow detection
; I get the impression the Mockingboard 4c activates
; when you access any of the 6522 ports in Slot 4
lda APPLEII_MODEL
cmp #'C'
bne not_iic
lda #$ff
; don't bother patching these, IIc mockingboard always slot 4?
sta MOCK_6522_DDRA1
sta MOCK_6522_T1CL
not_iic:
lda #$00
sta MB_ADDR_L
ldx #$C7 ; start at slot #7

View File

@ -170,47 +170,56 @@ clear_ay_end:
;=============================
mockingboard_setup_interrupt:
;===========================
; Check for Apple IIc
;===========================
; it does interrupts differently
lda $FBB3 ; IIe and newer is $06
cmp #6
beq apple_iie_or_newer
jmp done_apple_detect
apple_iie_or_newer:
lda $FBC0 ; 0 on a IIc
bne done_apple_detect
apple_iic:
; activate IIc mockingboard?
; this might only be necessary to allow detection
; I get the impression the Mockingboard 4c activates
; when you access any of the 6522 ports in Slot 4
lda #$ff
; don't bother patching these, IIc mockingboard always slot 4?
sta MOCK_6522_DDRA1
sta MOCK_6522_T1CL
lda APPLEII_MODEL
cmp #'C'
bne done_iic_hack
; bypass the firmware interrupt handler
; should we do this on IIe too? probably faster
; first we have to copy the ROM to the language card
sei ; disable interrupts
lda $c08b ; disable ROM (enable language card)
lda $c08b
copy_rom_loop:
lda $c089 ; read ROM, write RAM1
lda $c089
ldy #0
read_rom_loop:
lda $D000,Y
sta $400,Y
iny
bne read_rom_loop
lda $c08B ; read/write RAM1
lda $c08B ;
write_rom_loop:
lda $400,Y
sta $D000,Y
iny
bne write_rom_loop
inc read_rom_loop+2
inc write_rom_loop+5
bne copy_rom_loop
lda #<interrupt_handler
sta $fffe
lda #>interrupt_handler
sta $ffff
lda #$EA ; nop out the "lda $45" in the irq hand
lda #$EA ; nop out the "lda $45" in the irq handler
sta interrupt_smc
sta interrupt_smc+1
done_apple_detect:
done_iic_hack:
;=========================

View File

@ -4,6 +4,7 @@ INTRO_LOOPER = $01
INTRO_LOOPL = $02
INTRO_LOOPH = $03
WHICH_LOAD = $05
APPLEII_MODEL = $08
NIBCOUNT = $09 ; lzsa
; Zero page monitor routines addresses