passing some breaking specs

This commit is contained in:
Colby Swandale 2016-09-18 23:02:01 +10:00
parent af1cecef44
commit d305150b05
2 changed files with 24 additions and 8 deletions

View file

@ -41,12 +41,12 @@ describe Waterfoul::MMU do
describe '#read_word' do
before do
subject.write_byte 0xFFFF, 0x1
subject.write_byte 0xFFFE, 0x1
subject.write_byte 0xC001, 0x1
subject.write_byte 0xC000, 0x1
end
it 'reads two bytes from memory into a word' do
expect(subject.read_word(0xFFFE)).to eq 0x2
expect(subject.read_word(0xC000)).to eq 0x101
end
end
@ -57,8 +57,4 @@ describe Waterfoul::MMU do
expect(subject[0xFF41]).to eq 0xFF
end
end
context 'DMA transfer' do
end
end

View file

@ -3,7 +3,27 @@ require 'spec_helper'
describe Waterfoul::CPU do
subject { Waterfoul::CPU.new }
[[:a, :f], [:b, :c], [:d, :e], [:h, :l]].each do |i|
describe '#af=' do
it 'doesnt overwrite the F register' do
subject.af = 0x101
expect(subject.f).to eq 0
end
it 'writes values into A register' do
subject.af = 0x101
expect(subject.a).to eq 0x1
end
end
describe '#af' do
it 'pairs the A, F register to form a 16 bit register' do
subject.set_register :a, 0x5
subject.set_register :f, 0x3
expect(subject.af).to eq 0x503
end
end
[[:b, :c], [:d, :e], [:h, :l]].each do |i|
read_register_method = i.join
write_register_method = i.join + '='