diff --git a/demos/outline2021/demo/Makefile b/demos/outline2021/demo/Makefile index 07c8f4f2..8af21439 100644 --- a/demos/outline2021/demo/Makefile +++ b/demos/outline2021/demo/Makefile @@ -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 diff --git a/demos/outline2021/demo/outline.s b/demos/outline2021/demo/outline.s index 1cf11073..01107fb9 100644 --- a/demos/outline2021/demo/outline.s +++ b/demos/outline2021/demo/outline.s @@ -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" diff --git a/demos/outline2021/demo/pt3_lib_detect_model.s b/demos/outline2021/demo/pt3_lib_detect_model.s new file mode 100644 index 00000000..c85dced2 --- /dev/null +++ b/demos/outline2021/demo/pt3_lib_detect_model.s @@ -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 diff --git a/demos/outline2021/demo/pt3_lib_mockingboard_detect.s b/demos/outline2021/demo/pt3_lib_mockingboard_detect.s index 706d9407..925be47f 100644 --- a/demos/outline2021/demo/pt3_lib_mockingboard_detect.s +++ b/demos/outline2021/demo/pt3_lib_mockingboard_detect.s @@ -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 diff --git a/demos/outline2021/demo/pt3_lib_mockingboard_setup.s b/demos/outline2021/demo/pt3_lib_mockingboard_setup.s index c79c5dad..815d9422 100644 --- a/demos/outline2021/demo/pt3_lib_mockingboard_setup.s +++ b/demos/outline2021/demo/pt3_lib_mockingboard_setup.s @@ -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 $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: ;========================= diff --git a/demos/outline2021/demo/zp.inc b/demos/outline2021/demo/zp.inc index cfc3197b..3a31bab4 100644 --- a/demos/outline2021/demo/zp.inc +++ b/demos/outline2021/demo/zp.inc @@ -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