mirror of
https://github.com/colby-swandale/waterfoul
synced 2025-02-06 08:46:01 +01:00
passing some breaking specs
This commit is contained in:
parent
af1cecef44
commit
d305150b05
2 changed files with 24 additions and 8 deletions
|
@ -41,12 +41,12 @@ describe Waterfoul::MMU do
|
||||||
|
|
||||||
describe '#read_word' do
|
describe '#read_word' do
|
||||||
before do
|
before do
|
||||||
subject.write_byte 0xFFFF, 0x1
|
subject.write_byte 0xC001, 0x1
|
||||||
subject.write_byte 0xFFFE, 0x1
|
subject.write_byte 0xC000, 0x1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'reads two bytes from memory into a word' do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,8 +57,4 @@ describe Waterfoul::MMU do
|
||||||
expect(subject[0xFF41]).to eq 0xFF
|
expect(subject[0xFF41]).to eq 0xFF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'DMA transfer' do
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,27 @@ require 'spec_helper'
|
||||||
describe Waterfoul::CPU do
|
describe Waterfoul::CPU do
|
||||||
subject { Waterfoul::CPU.new }
|
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
|
read_register_method = i.join
|
||||||
write_register_method = i.join + '='
|
write_register_method = i.join + '='
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue