Class: Amaterasu::GameBoy::Cpu::Instructions::Ldh

Inherits:
Base
  • Object
show all
Defined in:
lib/amaterasu/game_boy/cpu/instructions/ldh.rb

Overview

Holds the logic of all the LDH (Load High RAM) instructions.

Constant Summary collapse

IO_BASE_ADDRESS =
0xFF00

Instance Attribute Summary

Attributes inherited from Base

#mnemonic

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(cpu:, target:, source:) ⇒ Ldh

Returns a new instance of Ldh.



11
12
13
14
15
16
17
18
# File 'lib/amaterasu/game_boy/cpu/instructions/ldh.rb', line 11

def initialize(cpu:, target:, source:)
  super(cpu:)

  @mnemonic = "LDH #{format_operand(target)}, #{format_operand(source)}"
  @bytes    = 2
  @m_cycles = 2
  @logic    = build_logic(target, source)
end