Class: Amaterasu::GameBoy::Cpu::Instructions::Cp

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

Overview

Handles the logic related to all possible CP instructions

  • CP A, r8

  • CP A, [HL]

  • CP A, n8

Instance Attribute Summary

Attributes inherited from Base

#mnemonic

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(cpu:, source:) ⇒ Cp

Returns a new instance of Cp.

Parameters:

  • cpu (Cpu)

    Holds a direct reference to the main Cpu object.

  • source (Symbol)

    Operator, can be a register, :mem_hl, :imm8.



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

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

  @mnemonic = "CP A, #{source}"
  @logic    = build_logic(source)
end