mirror of
https://github.com/digarok/MiniMemoryTester.git
synced 2025-01-17 19:31:32 +00:00
fix for memory detection
This commit is contained in:
parent
07e635e613
commit
8601f35783
47
src/mmt.s
47
src/mmt.s
@ -1745,10 +1745,6 @@ MainMenuStrs
|
|||||||
hex 00,00
|
hex 00,00
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* Creates a 256 byte map of each bank, "BankRam"
|
* Creates a 256 byte map of each bank, "BankRam"
|
||||||
* The map shows whether it's Built-in RAM, ROM, Expansion RAM, etc.
|
* The map shows whether it's Built-in RAM, ROM, Expansion RAM, etc.
|
||||||
DetectRam
|
DetectRam
|
||||||
@ -1775,18 +1771,35 @@ DetectRam
|
|||||||
sta BankMap+$FC ;
|
sta BankMap+$FC ;
|
||||||
sta BankMap+$FD ;
|
sta BankMap+$FD ;
|
||||||
ldx #$10 ;ROM3 starts scan at bank 10
|
ldx #$10 ;ROM3 starts scan at bank 10
|
||||||
bra :detectloop
|
txy
|
||||||
|
bra :writeloop
|
||||||
|
|
||||||
:rom0or1 ;no additional mappings
|
:rom0or1 ;no additional mappings
|
||||||
lda #$FE ;ROM1 end bank FE
|
lda #$FE ;ROM1 end bank FE
|
||||||
sta :endbankscan+1 ;but change our max scan bank
|
sta :endbankscan+1 ;but change our max scan bank
|
||||||
|
sta :endbankscan2+1 ;but change our max scan bank
|
||||||
ldx #$02 ;ROM0/1 starts scan at bank 02
|
ldx #$02 ;ROM0/1 starts scan at bank 02
|
||||||
|
txy
|
||||||
|
|
||||||
:detectloop txa ;we'll store the bank number
|
|
||||||
|
:writeloop txa ;we'll store the bank number
|
||||||
sta :writer+3 ;overwrite bank address
|
sta :writer+3 ;overwrite bank address
|
||||||
sta :reader+3
|
|
||||||
sta :compare+1
|
eor #$FF ;INVERT
|
||||||
:writer stal $000000 ;should overwrite first byte
|
:writer stal $000000 ;should overwrite first byte
|
||||||
|
inx
|
||||||
|
cpx #$E0
|
||||||
|
bne :endbankscan
|
||||||
|
ldx #$F0 ;skip to bank F0 (skip banks E0-EF)
|
||||||
|
:endbankscan cpx #$FC ;ROM3 end bank (default)
|
||||||
|
bcc :writeloop ;blt
|
||||||
|
|
||||||
|
|
||||||
|
tyx ;restore start bank
|
||||||
|
:detectloopread txa
|
||||||
|
sta :reader+3
|
||||||
|
eor #$FF
|
||||||
|
sta :compare+1
|
||||||
:reader ldal $000000
|
:reader ldal $000000
|
||||||
:compare cmp #$00
|
:compare cmp #$00
|
||||||
bne :notused
|
bne :notused
|
||||||
@ -1794,15 +1807,17 @@ DetectRam
|
|||||||
lda #BankRAMFastExpansion ;store mapping
|
lda #BankRAMFastExpansion ;store mapping
|
||||||
sta BankMap,x
|
sta BankMap,x
|
||||||
:continue inx
|
:continue inx
|
||||||
cpx #$E0 ;skip banks $E0-$EF
|
cpx #$E0
|
||||||
bcc :endbankscan ; <E0
|
bne :endbankscan2
|
||||||
cpx #$F0
|
ldx #$F0 ;skip to bank F0 (skip banks E0-EF)
|
||||||
bcs :endbankscan ; >= F0 (>EF)
|
|
||||||
ldx #$F0 ;skip to bank F0
|
|
||||||
bra :detectloop
|
|
||||||
:endbankscan cpx #$FC ;ROM3 end bank (default)
|
|
||||||
bcc :detectloop ;blt
|
|
||||||
|
|
||||||
|
:endbankscan2 cpx #$FC ;ROM3 end bank (default)
|
||||||
|
bcc :detectloopread ;blt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This part looks for the lowest and highest banks to pre-populate
|
||||||
|
* the Start Bank and End Bank for the tests.
|
||||||
;let's find low/high to simplify things
|
;let's find low/high to simplify things
|
||||||
ldx #$ff
|
ldx #$ff
|
||||||
:lowloop lda BankMap,x
|
:lowloop lda BankMap,x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user