save memory 0x0F mirroring, default sram to 0xFF, less restrictive save type search

This commit is contained in:
Matthew Berry 2021-02-22 23:24:47 -08:00
parent 7444832159
commit 7679e985d6
3 changed files with 7 additions and 7 deletions

View file

@ -23,8 +23,8 @@ class Bus
when 0x8, 0x9,
0xA, 0xB,
0xC, 0xD then @gba.cartridge.rom[index & 0x01FFFFFF]
when 0xE then @gba.storage[index & 0xFFFF]
else abort "Unmapped read: #{hex_str index.to_u32}"
when 0xE, 0xF then @gba.storage[index & 0xFFFF]
else abort "Unmapped read: #{hex_str index.to_u32}"
end
end
@ -49,8 +49,8 @@ class Bus
when 0x8, 0x9,
0xA, 0xB,
0xC, 0xD then (@gba.cartridge.rom.to_unsafe + (index & 0x01FFFFFF)).as(HalfWord*).value
when 0xE then read_half_slow(index)
else abort "Unmapped read: #{hex_str index.to_u32}"
when 0xE, 0xF then read_half_slow(index)
else abort "Unmapped read: #{hex_str index.to_u32}"
end
end

View file

@ -6,8 +6,8 @@ abstract class Storage
FLASH512
FLASH1M
def regex : Regex
/#{self}_V\d{3}/
def regex : Regex # don't rely on the 3 digits after this string
/#{self}_V/
end
def bytes : Int

View file

@ -1,5 +1,5 @@
class SRAM < Storage
@memory = Bytes.new(Type::SRAM.bytes, 0x00)
@memory = Bytes.new(Type::SRAM.bytes, 0xFF)
def [](index : Int) : Byte
index < @memory.size ? @memory[index] : 0_u8