Class: Amaterasu::GameBoy::Cpu::Instructions::CbSet

Inherits:
Base
  • Object
show all
Includes:
Utils::BitOps
Defined in:
lib/amaterasu/game_boy/cpu/instructions/cb_set.rb

Overview

Holds the logic of all the SET instructions.

  • SET u3, r8

  • SET u3, [HL]

Instance Attribute Summary

Attributes inherited from Base

#mnemonic

Instance Method Summary collapse

Methods included from Utils::BitOps

bit, clear_bit, set_bit

Methods inherited from Base

#execute

Constructor Details

#initialize(cpu:, bit_pos:, target:) ⇒ CbSet

Creates a new CbSet object containing the mnemonic (String) and logic (Proc).



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

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

  @mnemonic = "SET #{bit_pos}, #{format_operand(target)}"
  @logic    = build_logic(bit_pos, target)
end