class N65::Segment

This directive instruction can include a binary file

Public Class Methods

new(segment, bank) click to toggle source

Initialize with filename

# File lib/n65/directives/segment.rb, line 23
def initialize(segment, bank)
  @bank = bank
  @segment = segment
end
parse(line) click to toggle source

Try to parse a dw directive

# File lib/n65/directives/segment.rb, line 11
def self.parse(line)
  match_data = line.match(/^.segment (prog|char) (\d+)$/i)
  unless match_data.nil?
    _, segment, bank = match_data.to_a
    return Segment.new(segment, bank.to_i)
  end
  nil
end

Public Instance Methods

exec(assembler) click to toggle source

Execute the segment and bank change on the assembler

# File lib/n65/directives/segment.rb, line 31
def exec(assembler)
  assembler.current_segment = @segment
  assembler.current_bank = @bank
end
to_s() click to toggle source

Display

# File lib/n65/directives/segment.rb, line 39
def to_s
  ".segment #{@segment} #{@bank}"
end