Method: MicroCisc::Compile::Instruction#validate_effect

Defined in:
lib/micro_cisc/compile/instruction.rb

#validate_effect(component, current) ⇒ Object

Raises:

  • (ArgumentError)


129
130
131
132
133
134
135
# File 'lib/micro_cisc/compile/instruction.rb', line 129

def validate_effect(component, current)
  raise ArgumentError, "Duplicate #{component.last} value" if current
  unless (0..7).include?(component.first)
    raise ArgumentError, "Value of #{component.last} must be between 0x0 and 0x7 instead of 0x#{component.first.to_s(16).upcase}"
  end
  component.first
end