mirror of
https://github.com/colby-swandale/waterfoul
synced 2025-02-14 08:48:07 +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,7 +23,7 @@ module Waterfoul
|
||||||
offset = @rom_bank * 0x4000
|
offset = @rom_bank * 0x4000
|
||||||
@game_program[offset + addr]
|
@game_program[offset + addr]
|
||||||
when 0xA000...0xC000
|
when 0xA000...0xC000
|
||||||
fail 'trying to read invalid ram' unless @ram_enabled
|
if @ram_enabled
|
||||||
addr = i - 0xA000
|
addr = i - 0xA000
|
||||||
if @mode == 0
|
if @mode == 0
|
||||||
@ram[addr]
|
@ram[addr]
|
||||||
|
@ -31,6 +31,9 @@ module Waterfoul
|
||||||
offset = @rom_ram_bank_number * 0x8000
|
offset = @rom_ram_bank_number * 0x8000
|
||||||
@ram[offset + addr]
|
@ram[offset + addr]
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
0xFF
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue