Skip to content

Commit

Permalink
Implement ROR (absolute, X).
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Oct 24, 2020
1 parent b7e6e0a commit 43394ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mos6502/cpu_instructions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def instructions
@status.interupt_disable = true
},

# ROR (absolute, X)
0x7e => lambda {
address = absolute(@x)
@memory.set(address, ror(@memory.get(address)))
},

# STA (indexed indirect)
0x81 => lambda {
@memory.set(indexed_indirect, @a)
Expand Down
12 changes: 12 additions & 0 deletions test/cpu_instructions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,18 @@ def test_0x76
assert_equal([0x3f], @cpu.dump_memory(0x2c, 1))
end

def test_0x7e
@cpu.load!([0xa9, 0x7f, 0xa2, 0x10, 0x9d, 0x0f, 0x70, 0x7e, 0x0f, 0x70])
@cpu.step
@cpu.step
@cpu.step
@cpu.step
assert(@cpu.carry?)
refute(@cpu.negative?)
refute(@cpu.zero?)
assert_equal([0x3f], @cpu.dump_memory(0x701f, 1))
end

def test_0x81
@cpu.load!(
[
Expand Down

0 comments on commit 43394ba

Please sign in to comment.