Class: GBRb::InstructionSet::Pop
- Inherits:
-
Instruction
- Object
- Instruction
- GBRb::InstructionSet::Pop
- Defined in:
- lib/gbrb/instruction_set/stack.rb
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
- #call(r, mem) ⇒ Object
-
#initialize(target, m = 3, t = 12) ⇒ Pop
constructor
A new instance of Pop.
Methods inherited from Instruction
Constructor Details
#initialize(target, m = 3, t = 12) ⇒ Pop
Returns a new instance of Pop.
6 7 8 9 |
# File 'lib/gbrb/instruction_set/stack.rb', line 6 def initialize target, m=3, t=12 super m, t @targets = target.to_s.chars.map{|a| a.to_sym}.reverse end |
Instance Method Details
#call(r, mem) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/gbrb/instruction_set/stack.rb', line 11 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 r.f.store r.f.read & 0xf0 if @targets.include? :f end |