Class: Amaterasu::GameBoy::Cpu::Instructions::Add16

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

Overview

Handles the logic related to all possible ADD 16-bit instructions.

  • ADD HL, BC

  • ADD HL, DE

  • ADD HL, HL

  • ADD HL, SP

  • ADD SP, sig8

Instance Attribute Summary

Attributes inherited from Base

#mnemonic

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

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

Returns a new instance of Add16.



15
16
17
18
19
20
# File 'lib/amaterasu/game_boy/cpu/instructions/add16.rb', line 15

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

  @mnemonic = "ADD #{format_operand(source)}, #{format_operand(target)}"
  @logic    = build_logic(source, target)
end