Avoid allocations in MMU#[]

This commit is contained in:
Benoit Daloze 2017-03-05 18:26:32 +01:00
parent e774ff97be
commit 8bdd6941ad

View file

@ -32,12 +32,12 @@ module Waterfoul
if i == 0xFF00 if i == 0xFF00
Input.read_keyboard @memory[i] Input.read_keyboard @memory[i]
elsif (0x8000...0xA000) === i or (0xC000...0xE000) === i or (0xFE00..0xFFFF) === i elsif i >= 0x8000 && i < 0xA000 or i >= 0xC000 && i < 0xE000 or i >= 0xFE00
@memory[i] @memory[i]
elsif (0xE000...0xFE00) === i elsif i < 0x8000 or i >= 0xA000 && i < 0xC000
@memory[i - 0x2000]
elsif (0x0000...0x8000) === i or (0xA000...0xC000) === i
@cartridge[i] @cartridge[i]
else # if (0xE000...0xFE00) === i
@memory[i - 0x2000]
end end
end end