2016-05-08 17:20:05 +10:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Waterfoul::MBC::ROM do
|
|
|
|
|
2016-09-26 23:01:01 +10:00
|
|
|
let(:game_program) { Array.new 65_536, 0 }
|
|
|
|
subject { Waterfoul::MBC::ROM.new game_program }
|
2016-05-08 17:20:05 +10:00
|
|
|
|
|
|
|
describe '#[]' do
|
2016-09-26 23:01:01 +10:00
|
|
|
before { game_program[0x151] = 0x51 }
|
|
|
|
it 'reads byte at address from the game program' do
|
|
|
|
expect(subject[0x151]).to eq 0x51
|
2016-05-08 17:20:05 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#[]=' do
|
2016-09-26 23:01:01 +10:00
|
|
|
it 'stores byte in external ram' do
|
|
|
|
subject[0xA001] = 0x8F
|
|
|
|
expect(subject.ram[0x1]).to eq 0x8F
|
2016-05-08 17:20:05 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|