Class: SCASM::Register

Inherits:
Value
  • Object
show all
Defined in:
lib/scasm/value.rb

Instance Method Summary collapse

Constructor Details

#initialize(regsym) ⇒ Register

Returns a new instance of Register.



14
15
16
17
# File 'lib/scasm/value.rb', line 14

def initialize regsym
  fail "invalid register #{regsym.inspect}" unless REGISTERS.member? regsym
  @regsym = regsym
end

Instance Method Details

#assembleObject



19
20
21
# File 'lib/scasm/value.rb', line 19

def assemble
  return REGISTERS[@regsym]
end

#to_sObject



23
24
25
# File 'lib/scasm/value.rb', line 23

def to_s
  "reg(#@regsym)"
end