Class: Amaterasu::GameBoy::Cpu::Instructions::Ret

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

Overview

Holds the logic of all the RET + RETI instructions.

Instance Attribute Summary

Attributes inherited from Base

#mnemonic

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(cpu:, condition: nil, enable_ime: false) ⇒ Ret

Creates a Ret instruction object with a mnemonic and logic to be executed.



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

def initialize(cpu:, condition: nil, enable_ime: false)
  super(cpu:)

  @mnemonic = enable_ime ? 'RETI' : "RET #{format_operand(condition)}".strip
  @logic    = build_logic(condition, enable_ime)
end