fake_bios: detect language card

This commit is contained in:
Vince Weaver 2023-08-28 21:45:35 -04:00
parent 5b6cb448eb
commit 1ead39db6e
3 changed files with 77 additions and 9 deletions

View File

@ -26,7 +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 \
pt3_lib_detect_model.s lc_detect.s \
zx02_optim.s graphics/a2_energy.hgr.zx02
ca65 -o fake_bios.o fake_bios.s -l fake_bios.lst

View File

@ -18,9 +18,9 @@ bios_test:
jsr build_tables
;===================
; Hardware Detect
;===================
;=======================
; Hardware Detect Model
;=======================
jsr detect_appleii_model
@ -52,6 +52,31 @@ not_iigs:
lda APPLEII_MODEL
sta model_patch_1+8 ; patch to ' ' '+' 'e' 'c' or 'g'
;=======================
; Hardware Detect RAM
;=======================
lda #48 ; FIXME: detect less on earlier models?
sta TOTAL_RAM
jsr detect_language_card
bcs ram_no_lc
ram_yes_lc:
; carry clear here
lda #16
adc TOTAL_RAM
sta TOTAL_RAM
; update text string
lda #'1'
sta lang_card_patch+34
lda #'6'
sta lang_card_patch+35
ram_no_lc:
;===================
; Load graphics
@ -91,7 +116,7 @@ not_iigs:
;=========================
; do fake memory count
lda #128
lda TOTAL_RAM
sta MEMCOUNT
memcount_loop:
lda KEYPRESS ; 4
@ -102,7 +127,7 @@ memcount_loop:
jsr increment_memory
dec MEMCOUNT
bpl memcount_loop
bne memcount_loop
done_memcount:
@ -238,9 +263,11 @@ bios_message_2:
.byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E
.byte $1E,$1E,$1E,$1E,$1E,$1E
.byte $1C, 13,0
.byte $1F," CPU Type: 65C02 ",$14," Base Memory: 48K ",$1F,13,0 ; 16
.byte $1F," Co-Proc: NONE ",$14," Lang Card: 16K ",$1F,13,0 ; 24
.byte $1F," Clock: 1.023MHz ",$14," AUX Memory: 64K ",$1F,13,0 ; 32
.byte $1F," CPU Type: 6502 ",$14," Base Memory: 48K ",$1F,13,0 ; 16
lang_card_patch: ; +34
.byte $1F," Co-Proc: NONE ",$14," Lang Card: 0K ",$1F,13,0 ; 24
aux_mem_patch: ; +34
.byte $1F," Clock: 1.023MHz ",$14," AUX Memory: 0K ",$1F,13,0 ; 32
.byte $19 ; 40
.byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E
@ -562,3 +589,4 @@ early_out:
.include "hgr_clear_screen.s"
.include "pt3_lib_detect_model.s"
.include "lc_detect.s"

View File

@ -0,0 +1,40 @@
; Code from TotalReplay by 4am and qkumba
;------------------------------------------------------------------------------
; Has64K
; Checks whether computer has functioning language card (64K)
;
; in: none
; out: C clear if 64K detected
; C set if 64K not detected
; all other flags and registers clobbered
; ROM in memory (not LC RAM bank)
;------------------------------------------------------------------------------
detect_language_card:
; enable language card
; READ_RAM1_WRITE_RAM1
bit $C08B
bit $C08B
lda #$AA ; test #1 for $D0 page
sta $D000
eor $D000
bne no_lc
lsr $D000 ; test #2 for $D0 page
lda #$55
eor $D000
bne no_lc
clc
bcc done_detect
no_lc:
sec
done_detect:
; READ_ROM_NO_WRITE
bit $C08A
rts