class N65::Inc
This directive instruction can include another asm file
Constants
- SystemInclude
System include directory
Public Class Methods
new(filename)
click to toggle source
Initialize with filename
# File lib/n65/directives/inc.rb, line 41 def initialize(filename) @filename = filename end
parse(line)
click to toggle source
Try to parse an incbin directive
# File lib/n65/directives/inc.rb, line 19 def self.parse(line) ## Do We have a system directory include? match_data = line.match(/^\.inc <([^>]+)>$/) unless match_data.nil? filename = File.join(SystemInclude, match_data[1]) return Inc.new(filename) end ## Do We have a project relative directory include? match_data = line.match(/^\.inc "([^"]+)"$/) unless match_data.nil? filename = File.join(Dir.pwd, match_data[1]) return Inc.new(filename) end ## Nope, not an inc directive nil end
Public Instance Methods
exec(assembler)
click to toggle source
Execute on the assembler
# File lib/n65/directives/inc.rb, line 48 def exec(assembler) unless File.exists?(@filename) fail(FileNotFound, ".inc can't find #{@filename}") end File.read(@filename).split(/\n/).each do |line| assembler.assemble_one_line(line) end end
to_s()
click to toggle source
Display
# File lib/n65/directives/inc.rb, line 60 def to_s ".inc \"#{@filename}\"" end