Class: GBRb::CPU::Pop
- Inherits:
-
Instruction
- Object
- Instruction
- GBRb::CPU::Pop
- Defined in:
- lib/gbrb/cpu/instruction.rb
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
- #call(r, mem) ⇒ Object
-
#initialize(target, m = 1, t = 12) ⇒ Pop
constructor
A new instance of Pop.
Methods inherited from Instruction
Constructor Details
#initialize(target, m = 1, t = 12) ⇒ Pop
Returns a new instance of Pop.
495 496 497 498 |
# File 'lib/gbrb/cpu/instruction.rb', line 495 def initialize target, m=1, t=12 super m, t @targets = target.to_s.chars.map{|a| a.to_sym}.reverse end |
Instance Method Details
#call(r, mem) ⇒ Object
500 501 502 503 504 505 |
# File 'lib/gbrb/cpu/instruction.rb', line 500 def call r, mem @targets.each do |target| r.public_send(target).store mem.read_byte(r.sp.read) r.sp.store r.sp.read + 1 end end |