Skip to content

Commit

Permalink
Fix redundant assignment in stack pointer operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Nov 8, 2020
1 parent fb6fa2d commit 3e4e7d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mos6502/cpu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ def stack_push(value)

# Decrement the stack pointer, and wrap it if it goes below 0.
@sp -= 1
@sp = @sp &= 0xff if @sp < 0 # rubocop:disable Style/NumericPredicate
@sp &= 0xff if @sp < 0 # rubocop:disable Style/NumericPredicate
end

def stack_pop
# Increment the stack pointer, and wrap it if it goes above 255.
@sp += 1
@sp = @sp &= 0xff if @sp > 0xff
@sp &= 0xff if @sp > 0xff

@memory.get((@sp & 0xff) + 0x0100)
end
Expand Down

0 comments on commit 3e4e7d7

Please sign in to comment.