class Rnes::Operation

Constants

RECORDS

Attributes

addressing_mode[R]

@return [Symbol]

cycle[R]

@return [Integer]

full_name[R]

@return [Symbol]

name[R]

@return [Symbol]

Public Class Methods

build(operation_code) click to toggle source

@param [Integer] operation_code @return [Rnes::Operation]

# File lib/rnes/operation.rb, line 9
def build(operation_code)
  record = ::Rnes::Operation::RECORDS[operation_code]
  if record
    new(record)
  else
    raise ::Rnes::InvalidOperationCodeError, "Invalid operation code: #{operation_code}"
  end
end
new(addressing_mode:, cycle:, full_name:, name:) click to toggle source

@param [Symbol] addressing_mode @param [Integer] cycle @param [Symbol] full_name @param [Symbol] name

# File lib/rnes/operation.rb, line 35
def initialize(addressing_mode:, cycle:, full_name:, name:)
  @addressing_mode = addressing_mode
  @cycle = cycle
  @full_name = full_name
  @name = name
end

Public Instance Methods

to_hash() click to toggle source

@return [Hash]

# File lib/rnes/operation.rb, line 43
def to_hash
  {
    addressing_mode: addressing_mode,
    cycle: cycle,
    full_name: full_name,
    name: name,
  }
end