add 64K check

This commit is contained in:
4am 2018-08-30 13:07:21 -04:00
parent 7cc325e35b
commit 6d7a8158f3
2 changed files with 43 additions and 4 deletions

View File

@ -5,10 +5,24 @@
!source "src/constants.a"
!source "src/macros.a"
jsr Has64K ; check for 64K (required)
bcc @found64K
jsr $FB2F
jsr $FC58
ldy #@no64Klen
- lda @s_no64K,y
sta $6B6,y
dey
bpl -
@hang bmi @hang
@s_no64K !raw "REQUIRES 64K"
@no64Klen=*-@s_no64K
@found64K
jsr DisableAccelerator ; set to 1 MHz
jsr Has128K ; check for 128K (64K is OK, we just filter out some games)
jsr Has128K ; check for 128K (absence is OK, we just filter out some games)
ror MachineStatus
jsr HasJoystick ; check for joystick (keyboard-only is OK, we just filter out some games)
jsr HasJoystick ; check for joystick (absence is OK, we just filter out some games)
ror MachineStatus
lda LCBANK1WRITE ; read ROM / write LC bank 1

View File

@ -1,3 +1,30 @@
;------------------------------------------------------------------------------
; Has64K
; Checks whether computer has functioning language card (64K)
;
; in: none
; out: C set if 64K detected
; C clear if 64K not detected
; all other flags and registers clobbered
; ROM in memory (not LC RAM bank)
;------------------------------------------------------------------------------
Has64K
lda LCBANK1 ; read/write LC RAM bank 1
lda LCBANK1
lda #$AA ; test #1 for $D0 page
sta $D000
eor $D000
bne @no
lsr $D000 ; test #2 for $D0 page
lda #$55
eor $D000
bne @no
clc
+HIDE_NEXT_BYTE
@no sec
sta ROMONLY
rts
;------------------------------------------------------------------------------
; Has128K
; Checks whether computer has functioning auxiliary memory (128K)
@ -13,7 +40,6 @@
; (c) 1989 Broderbund Software
; https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/master/01%20POP%20Source/Source/BOOT.S#L119
;------------------------------------------------------------------------------
!zone {
Has128K
sta ROMONLY ; need ROM for machine ID byte
lda MACHINEID
@ -49,4 +75,3 @@ Has128K
sta READMAINMEM
rts
@checklen=*-@checker
}