This commit is contained in:
4am 2019-10-07 23:20:29 -04:00
commit 10937b140f

View File

@ -32,7 +32,7 @@ Has64K
; out: C set if 128K detected ; out: C set if 128K detected
; C clear if 128K not detected ; C clear if 128K not detected
; all other flags and registers clobbered ; all other flags and registers clobbered
; zp $80-$9F clobbered ; zp $80-$D2 clobbered
; ROM in memory (not LC RAM bank) ; ROM in memory (not LC RAM bank)
; ;
; adapted from "Prince of Persia" by Jordan Mechner ; adapted from "Prince of Persia" by Jordan Mechner
@ -50,6 +50,9 @@ Has128K
ldx #@checklen ldx #@checklen
- lda @checker,x - lda @checker,x
sta $80,x sta $80,x
sta SETAUXZP ; also copy to aux zp in case we pass
sta $80,x
sta CLRAUXZP
dex dex
bpl - bpl -
jmp $80 ; check if auxmem actually works jmp $80 ; check if auxmem actually works
@ -57,21 +60,41 @@ Has128K
lda #$EE lda #$EE
sta WRITEAUXMEM sta WRITEAUXMEM
sta READAUXMEM sta READAUXMEM
sta $0C00 @x1 sta $0C00
sta $0800 sta $0800
lda $0C00 @x2 lda $0C00
cmp #$EE cmp #$EE
bne @no bne @no
asl $0C00 @x3 asl $0C00
asl asl
cmp $0C00 @x4 cmp $0C00
bne @no bne @no
cmp $0800 cmp $0800
bne @yes beq @no
@no clc
+HIDE_NEXT_BYTE ; now test the rest of memory, and bank 2 of LC
clc
lda <($80+(@x1-@checker)+2)
adc #$20
bcs @finish
@x5 sta <($80+(@x1-@checker)+2)
sta <($80+(@x2-@checker)+2)
sta <($80+(@x3-@checker)+2)
sta <($80+(@x4-@checker)+2)
cmp #$CC
bne @checker
sta SETAUXZP
+READ_RAM2_WRITE_RAM2
lda #$D0
bne @x5 ; always
@yes sec @yes sec
+HIDE_NEXT_BYTE
@no clc
@finish sta WRITEMAINMEM @finish sta WRITEMAINMEM
sta READMAINMEM sta READMAINMEM
sta CLRAUXZP
+READ_ROM_NO_WRITE
rts rts
@checklen=*-@checker @checklen=*-@checker