fake_bios: detects the model type

or at least detects II,II+,IIe,IIc,or IIgs
This commit is contained in:
Vince Weaver 2023-08-28 21:21:28 -04:00
parent 2fd1508f01
commit 5b6cb448eb
4 changed files with 107 additions and 2 deletions

View File

@ -26,6 +26,7 @@ FAKE_BIOS: fake_bios.o
fake_bios.o: fake_bios.s \
hgr_clear_screen.s \
font_console_1x8.s fonts/a2_cga_thin.inc \
pt3_lib_detect_model.s \
zx02_optim.s graphics/a2_energy.hgr.zx02
ca65 -o fake_bios.o fake_bios.s -l fake_bios.lst

View File

@ -18,6 +18,41 @@ bios_test:
jsr build_tables
;===================
; Hardware Detect
;===================
jsr detect_appleii_model
lda APPLEII_MODEL
cmp 'g'
bne not_iigs
is_a_iigs:
; set background color to black instead of blue
lda NEWVIDEO
and #%00011111 ; bit 7 = 0 -> IIgs Apple II-compat video modes
; bit 6 = 0 -> IIgs 128K memory map same as IIe
; bit 5 = 0 -> IIgs DHGR is color, not mono
; bits 0-4 unchanged
sta NEWVIDEO
lda #$F0
sta TBCOLOR ; white text on black background
lda #$00
sta CLOCKCTL ; black border
sta CLOCKCTL ; set twice for VidHD
lda 's'
sta model_patch_1+9
not_iigs:
; update text printed
lda APPLEII_MODEL
sta model_patch_1+8 ; patch to ' ' '+' 'e' 'c' or 'g'
;===================
; Load graphics
;===================
@ -77,7 +112,7 @@ done_memcount:
; TODO: drive2 as well?
ldx #100
ldx #200
jsr long_wait
bit $C0E8 ; turn off drive motor (slot6)
@ -184,7 +219,8 @@ end:
bios_message_1:
.byte "Apple II Modular BIOS",13,0
.byte "Copyright (C) 1977-1991",13,13,0
.byte "Apple IIe ",13,13,0
model_patch_1: ;+8
.byte "Apple II ",13,13,0
.byte "65C02 CPU at 1.023MHz",13,0
.byte "Memory Test: 0B OK",13,0
bios_message_1a:
@ -524,3 +560,5 @@ early_out:
.include "hgr_clear_screen.s"
.include "pt3_lib_detect_model.s"

View File

@ -0,0 +1,63 @@
;===========================
; Check Apple II model
;===========================
; this is mostly for IIc support
; as it does interrupts differently
; ' ' ($20) = Apple II
; '+' ($2B) = Apple II+
; 'e' ($45) = Apple IIe
; 'c' ($43) = Apple IIc
; 'g' ($47) = Apple IIgs
detect_appleii_model:
lda #' '
ldx $FBB3
; II is $38
; J-plus is $C9
; II+ is $EA (so is III)
; IIe and newer is $06
cpx #$38
beq done_apple_detect
lda #'+'
cpx #$EA
beq done_apple_detect
; TODO: check for J-plus or III?
cpx #$06
bne done_apple_detect
apple_iie_or_newer:
ldx $FBC0 ; $EA on a IIe
; $E0 on a IIe enhanced
; $00 on a IIc/IIc+
; $FE1F = $60, IIgs
beq apple_iic
lda #'e'
cpx #$EA
beq done_apple_detect
cpx #$E0
beq done_apple_detect
; assume GS?
lda #'g'
bne done_apple_detect
apple_iic:
lda #'c'
done_apple_detect:
sta APPLEII_MODEL
rts

View File

@ -25,6 +25,9 @@ GBASL = $26
GBASH = $27
CURSOR_X = $62
CURSOR_Y = $63
APPLEII_MODEL = $8B
HGR_COLOR = $E4
P0 = $F1
P1 = $F2