class N65::ASCII

This directive to include bytes

Public Class Methods

new(string) click to toggle source

Initialize with filename

# File lib/n65/directives/ascii.rb, line 22
def initialize(string)
  @string = string
end
parse(line) click to toggle source

Try to parse an incbin directive

# File lib/n65/directives/ascii.rb, line 13
def self.parse(line)
  match_data = line.match(/^\.ascii\s+"([^"]+)"$/)
  return nil if match_data.nil?
  ASCII.new(match_data[1])
end

Public Instance Methods

exec(assembler) click to toggle source

Execute on the assembler

# File lib/n65/directives/ascii.rb, line 29
def exec(assembler)
  assembler.write_memory(@string.bytes)
end
to_s() click to toggle source

Display

# File lib/n65/directives/ascii.rb, line 36
def to_s
  ".ascii \"#{@string}\""
end