Skip to content

Commit

Permalink
Implement LAX (absolute, X).
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Oct 28, 2020
1 parent 2578a5c commit 4ad4244
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mos6502/cpu_illegal_instructions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ def illegal_instructions
set_nz_flags(@a)
},

# LAX (absolute, X)
0xbf => lambda {
@a = @x = @memory.get(absolute(@x))
set_nz_flags(@a)
},

# NOP (zero page, X)
0xd4 => lambda {
zero_page(@x)
Expand Down
9 changes: 9 additions & 0 deletions test/cpu_illegal_instructions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,13 @@ def test_0xb7
assert_equal(0x80, @cpu.a)
assert_equal(0x80, @cpu.x)
end

# LAX (absolute, X)
def test_0xbf
@cpu.load!([0xa2, 0x01, 0xbf, 0x01, 0x06])
@cpu.step
@cpu.step
assert_equal(0xbf, @cpu.a)
assert_equal(0xbf, @cpu.x)
end
end

0 comments on commit 4ad4244

Please sign in to comment.