Class: Amaterasu::GameBoy::Cpu::Instructions::Base

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

Overview

Defines the mnemonic, bytes and logic for the NOP instruction.

Direct Known Subclasses

Adc, Add16, Add8, And, Call, CbBit, CbRes, CbRl, CbRlc, CbRr, CbRrc, CbSet, CbSla, CbSra, CbSrl, CbSwap, Cp, Daa, Dec, Di, Ei, Halt, Inc, Jp, Jr, Ld16, Ld8, Ldh, Misc, Nop, Or, Pop, Push, Ret, Rotate, Rst, Sbc, Stop, Sub, Xor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cpu:) ⇒ Base

Returns a new instance of Base.



11
12
13
14
# File 'lib/amaterasu/game_boy/cpu/instructions/base.rb', line 11

def initialize(cpu:)
  @cpu = cpu
  @registers = cpu.registers
end

Instance Attribute Details

#mnemonicObject (readonly)

Returns the value of attribute mnemonic.



9
10
11
# File 'lib/amaterasu/game_boy/cpu/instructions/base.rb', line 9

def mnemonic
  @mnemonic
end

Instance Method Details

#executeObject



16
17
18
# File 'lib/amaterasu/game_boy/cpu/instructions/base.rb', line 16

def execute
  @logic.call
end