class Directive
Defines basic assembler directives.
Public Class Methods
new(template)
click to toggle source
# File directive.rb, line 22 def initialize(template) @template = template end
Public Instance Methods
align(value, fill_with=-1)
click to toggle source
# File directive.rb, line 26 def align(value, fill_with=-1) factory = @template.template.getDirectiveFactory factory.newAlign(value, 2 ** value, fill_with) end
ascii(text, term, strings)
click to toggle source
# File directive.rb, line 112 def ascii(text, term, strings) factory = @template.template.getDirectiveFactory factory.newStrings(text, term, strings) end
balign(value, fill_with=-1)
click to toggle source
# File directive.rb, line 31 def balign(value, fill_with=-1) factory = @template.template.getDirectiveFactory factory.newAlignByte(value, fill_with) end
comment(text)
click to toggle source
# File directive.rb, line 85 def comment(text) factory = @template.template.getDirectiveFactory factory.newComment(text) end
data(type, values, align)
click to toggle source
¶ ↑
The following directives are configured via data_config
¶ ↑
# File directive.rb, line 94 def data(type, values, align) factory = @template.template.getDirectiveFactory dataBuilder = factory.getDataValueBuilder type.to_s, align values.each do |value| if value.is_a?(Float) then dataBuilder.addDouble value else dataBuilder.add value end end dataBuilder.build end
method_missing(meth, *args, &block)
click to toggle source
option(value)
click to toggle source
# File directive.rb, line 75 def option(value) factory = @template.template.getDirectiveFactory factory.newOption(value) end
org(origin, is_absolute=false)
click to toggle source
# File directive.rb, line 55 def org(origin, is_absolute=false) factory = @template.template.getDirectiveFactory if origin.is_a?(Integer) if is_absolute factory.newOriginAbsolute origin # Absolute else # Section-Based factory.newOrigin origin end elsif origin.is_a?(Hash) delta = get_attribute origin, :delta if !delta.is_a?(Integer) raise "delta (#{delta}) must be an Integer" end factory.newOriginRelative delta # Relative else raise "origin (#{origin}) must be an Integer or a Hash" end end
org_text(origin, text="")
click to toggle source
# File directive.rb, line 41 def org_text(origin, text="") factory = @template.template.getDirectiveFactory if origin.is_a?(Integer) # Section-Based if text.is_a?(String) then factory.newOriginText(origin, text) else raise "text (#{text}) must be an String" end else raise "origin (#{origin}) must be an Integer" end end
p2align(value, fill_with=-1)
click to toggle source
# File directive.rb, line 36 def p2align(value, fill_with=-1) factory = @template.template.getDirectiveFactory factory.newAlignPower2(value, 2 ** value, fill_with) end
space(text, data, length)
click to toggle source
# File directive.rb, line 107 def space(text, data, length) factory = @template.template.getDirectiveFactory factory.newSpace(text, data, length) end
text(text)
click to toggle source
# File directive.rb, line 80 def text(text) factory = @template.template.getDirectiveFactory factory.newText(text) end