Class: GBRb::InstructionSet::Ldh
- Inherits:
-
Instruction
- Object
- Instruction
- GBRb::InstructionSet::Ldh
- Defined in:
- lib/gbrb/instruction_set/ld.rb
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
- #call(r, mem, address) ⇒ Object
-
#initialize(destination, target, indirect_dest, indirect_target, m = 3, t = 12, immediates = 1) ⇒ Ldh
constructor
A new instance of Ldh.
Methods inherited from Instruction
Constructor Details
#initialize(destination, target, indirect_dest, indirect_target, m = 3, t = 12, immediates = 1) ⇒ Ldh
Returns a new instance of Ldh.
202 203 204 205 206 207 208 209 210 |
# File 'lib/gbrb/instruction_set/ld.rb', line 202 def initialize destination, target, indirect_dest, indirect_target, m=3, t=12, immediates=1 super m, t, immediates @destination = destination @target = target @indirect_dest = indirect_dest @indirect_target = indirect_target @offset = 0xff00 end |
Instance Method Details
#call(r, mem, address) ⇒ Object
212 213 214 215 216 217 218 219 220 |
# File 'lib/gbrb/instruction_set/ld.rb', line 212 def call r, mem, address if @indirect_dest value = r.public_send(@target.to_sym).read mem.write_byte address + @offset, value elsif @indirect_target value = mem.read_byte address + @offset r.public_send(@destination.to_sym).store value end end |