mirror of
https://github.com/colby-swandale/waterfoul
synced 2025-02-05 08:45:52 +01:00
dont crash when ram is not enabled on cartridge memory read
This commit is contained in:
parent
b95a41520c
commit
00eec41f53
1 changed files with 9 additions and 6 deletions
|
@ -23,13 +23,16 @@ module Waterfoul
|
|||
offset = @rom_bank * 0x4000
|
||||
@game_program[offset + addr]
|
||||
when 0xA000...0xC000
|
||||
fail 'trying to read invalid ram' unless @ram_enabled
|
||||
addr = i - 0xA000
|
||||
if @mode == 0
|
||||
@ram[addr]
|
||||
if @ram_enabled
|
||||
addr = i - 0xA000
|
||||
if @mode == 0
|
||||
@ram[addr]
|
||||
else
|
||||
offset = @rom_ram_bank_number * 0x8000
|
||||
@ram[offset + addr]
|
||||
end
|
||||
else
|
||||
offset = @rom_ram_bank_number * 0x8000
|
||||
@ram[offset + addr]
|
||||
0xFF
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue