diff --git a/data/opcodes.yaml b/data/opcodes.yaml index ecbb676..854e69c 100644 --- a/data/opcodes.yaml +++ b/data/opcodes.yaml @@ -1,17 +1,17 @@ --- :adc: :description: "ADd with Carry" - :flags: + :flags: - :s - :v - :z - :c - :immediate: + :immediate: :hex: 0x69 :len: 2 :cycles: 2 :boundry_add: false - :zero_page: + :zero_page: :hex: 0x65 :len: 2 :cycles: 3 @@ -49,7 +49,7 @@ :and: :description: "bitwise AND with accumulator" - :flags: + :flags: - :s - :z :immediate: @@ -95,7 +95,7 @@ :asl: :description: "Arithmetic Shift Left" - :flags: + :flags: - :s - :z - :c @@ -127,7 +127,7 @@ :bit: :description: "test BITs" - :flags: + :flags: - :n - :v - :z @@ -202,9 +202,9 @@ :brk: :description: "BReaK" - :flags: + :flags: - :b - :implied: + :implied: :hex: 0x0 :len: 1 :cycles: 7 @@ -212,7 +212,7 @@ :cmp: :description: "CoMPare accumulator" - :flags: + :flags: - :s - :c - :z @@ -259,7 +259,7 @@ :cpx: :description: "ComPare X register" - :flags: + :flags: - :s - :c - :z @@ -281,7 +281,7 @@ :cpy: :description: "ComPare Y register" - :flags: + :flags: - :s - :c - :z @@ -303,7 +303,7 @@ :dec: description: "DECrement memory" - :flags: + :flags: - :s - :z :zero_page: @@ -329,7 +329,7 @@ :eor: :description: "bitwise Exclusive OR" - :flags: + :flags: - :s - :z :immediate: @@ -375,7 +375,7 @@ :clc: :description: "CLear Carry" - :flags: + :flags: - :c :implied: :hex: 0x18 @@ -383,7 +383,7 @@ :cycles: 2 :sec: :description: "SEt Carry" - :flags: + :flags: - :c :implied: :hex: 0x38 @@ -391,7 +391,7 @@ :cycles: 2 :cli: :description: "CLear Interrupt" - :flags: + :flags: - :i :implied: :hex: 0x58 @@ -399,7 +399,7 @@ :cycles: 2 :sei: :description: "SEt Interrupt" - :flags: + :flags: - :i :implied: :hex: 0x78 @@ -407,7 +407,7 @@ :cycles: 2 :clv: :description: "CLear oVerflow" - :flags: + :flags: - :v :implied: :hex: 0xB8 @@ -415,7 +415,7 @@ :cycles: 2 :cld: :description: "CLear Decimal" - :flags: + :flags: - :d :implied: :hex: 0xD8 @@ -423,7 +423,7 @@ :cycles: 2 :sed: :description: "SEt Decimal" - :flags: + :flags: - :d :implied: :hex: 0xF8 @@ -432,7 +432,7 @@ :inc: :description: "INCrement memory" - :flags: + :flags: - :s - :z :zero_page: @@ -481,7 +481,7 @@ :lda: :description: "LoaD Accumulator" - :flags: + :flags: - :s - :z :immediate: @@ -527,7 +527,7 @@ :ldx: :description: "LoaD X register" - :flags: + :flags: - :s - :z :immediate: @@ -558,7 +558,7 @@ :ldy: :description: "LoaD Y register" - :flags: + :flags: - :s - :z :immediate: @@ -589,7 +589,7 @@ :lsr: :description: "Logical Shift Right" - :flags: + :flags: - :s - :z - :c @@ -630,7 +630,7 @@ :ora: :description: "bitwise OR with Accumulator" - :flags: + :flags: - :s - :z :immediate: @@ -676,7 +676,7 @@ :tax: :description: "Transfer A to X" - :flags: + :flags: - :s - :z :implied: @@ -686,7 +686,7 @@ :boundry_add: false :txa: :description: "Transfer X to A" - :flags: + :flags: - :s - :z :implied: @@ -696,7 +696,7 @@ :boundry_add: false :dex: :description: "DEcrement X" - :flags: + :flags: - :s - :z :implied: @@ -706,7 +706,7 @@ :boundry_add: false :inx: :description: "INcrement X" - :flags: + :flags: - :s - :z :implied: @@ -716,7 +716,7 @@ :boundry_add: false :tay: :description: "Transfer A to Y" - :flags: + :flags: - :s - :z :implied: @@ -726,7 +726,7 @@ :boundry_add: false :tya: :description: "Transfer Y to A" - :flags: + :flags: - :s - :z :implied: @@ -736,7 +736,7 @@ :boundry_add: false :dey: :description: "DEcrement Y" - :flags: + :flags: - :s - :z :implied: @@ -746,7 +746,7 @@ :boundry_add: false :iny: :description: "INcrement Y" - :flags: + :flags: - :s - :z :implied: @@ -757,7 +757,7 @@ :rol: :description: "ROtate Left" - :flags: + :flags: - :s - :z - :c @@ -789,7 +789,7 @@ :ror: :description: "ROtate Right" - :flags: + :flags: - :s - :z - :c @@ -821,7 +821,7 @@ :rti: :description: "ReTurn from Interrupt, TODO: Flags could be wrong" - :flags: + :flags: - :n - :v - :u @@ -847,7 +847,7 @@ :sbc: :description: "SuBtract with Carry" - :flags: + :flags: - :s - :v - :z @@ -976,7 +976,7 @@ :boundry_add: false :plp: :description: "PuLl Processor status" - :flags: + :flags: - :n - :v - :u diff --git a/lib/n65.rb b/lib/n65.rb index 8c1181c..5eef5b1 100644 --- a/lib/n65.rb +++ b/lib/n65.rb @@ -94,7 +94,7 @@ module N65 #### ## This is the main assemble method, it parses one line into an object ## which when given a reference to this assembler, controls the assembler - ## itself through public methods, executing assembler directives, and + ## itself through public methods, executing assembler directives, and ## emitting bytes into our virtual memory spaces. Empty lines or lines ## with only comments parse to nil, and we just ignore them. def assemble_one_line(line) @@ -120,7 +120,7 @@ module N65 #### - ## This rewinds the state of the assembler, so a promise can be + ## This rewinds the state of the assembler, so a promise can be ## executed with a previous state, for example if we can't resolve ## a symbol right now, and want to try during the second pass def with_saved_state(&block) @@ -194,7 +194,7 @@ module N65 puts "+ #{progs.size} PROG ROM bank#{progs.size != 1 ? 's' : ''}" puts "+ #{chars.size} CHAR ROM bank#{chars.size != 1 ? 's' : ''}" - rom_size = 0x10 + rom_size = 0x10 rom_size += MemorySpace::BankSizes[:prog] * progs.size rom_size += MemorySpace::BankSizes[:char] * chars.size diff --git a/lib/n65/directives/enter_scope.rb b/lib/n65/directives/enter_scope.rb index 2b39469..493c243 100644 --- a/lib/n65/directives/enter_scope.rb +++ b/lib/n65/directives/enter_scope.rb @@ -31,7 +31,7 @@ module N65 #### - ## Execute on the assembler, also create a symbol referring to + ## Execute on the assembler, also create a symbol referring to ## the current pc which contains a hyphen, and is impossible for ## the user to create. This makes a scope simultaneously act as ## a label to the current PC. If someone tries to use a scope diff --git a/lib/n65/directives/label.rb b/lib/n65/directives/label.rb index 3d41310..12d584f 100644 --- a/lib/n65/directives/label.rb +++ b/lib/n65/directives/label.rb @@ -2,8 +2,8 @@ module N65 #### - ## This class represents a label, and will create - ## an entry in the symbol table associated with + ## This class represents a label, and will create + ## an entry in the symbol table associated with ## the address it appears at. class Label diff --git a/lib/n65/directives/org.rb b/lib/n65/directives/org.rb index f155cb3..064cf4a 100644 --- a/lib/n65/directives/org.rb +++ b/lib/n65/directives/org.rb @@ -16,7 +16,7 @@ module N65 Org.new(address) end - + #### ## Initialized with address to switch to def initialize(address) diff --git a/lib/n65/directives/segment.rb b/lib/n65/directives/segment.rb index 753ee09..4cf4d3d 100644 --- a/lib/n65/directives/segment.rb +++ b/lib/n65/directives/segment.rb @@ -1,4 +1,4 @@ -require_relative '../instruction_base' +require_relative '../instruction_base' module N65 diff --git a/lib/n65/front_end.rb b/lib/n65/front_end.rb index 40aa28d..73bed72 100644 --- a/lib/n65/front_end.rb +++ b/lib/n65/front_end.rb @@ -4,7 +4,7 @@ require_relative '../n65' module N65 #### - ## This class handles the front end aspects, + ## This class handles the front end aspects, ## parsing the commandline options and running the assembler class FrontEnd @@ -42,7 +42,7 @@ module N65 STDERR.puts "Input file #{input_file} does not exist" exit(1) end - + ## Maybe they didn't provide an output file name, so we'll guess if @options[:output_file].nil? ext = File.extname(input_file) diff --git a/lib/n65/instruction.rb b/lib/n65/instruction.rb index 36a6120..58f80b1 100644 --- a/lib/n65/instruction.rb +++ b/lib/n65/instruction.rb @@ -15,7 +15,7 @@ module N65 class AddressOutOfRange < StandardError; end class ArgumentTooLarge < StandardError; end - ## Include Regexes + ## Include Regexes include Regexes AddressingModes = { @@ -26,7 +26,7 @@ module N65 :regex_label => /^#{Branches}\s+#{Sym}$/ }, - :immediate => { + :immediate => { :example => 'AAA #$FF', :display => '%s #$%.2X', :regex => /^#{Mnemonic}\s+#{Immediate}$/, @@ -116,7 +116,7 @@ module N65 match_data = parse_info[:regex].match(line) unless match_data.nil? - ## We must have a straight instruction without symbols, construct + ## We must have a straight instruction without symbols, construct ## an Instruction from the match_data, and return it _, op, arg_hex, arg_bin = match_data.to_a @@ -139,12 +139,12 @@ module N65 match_data = parse_info[:regex_label].match(line) unless match_data.nil? - ## We have found an assembly instruction containing a symbolic + ## We have found an assembly instruction containing a symbolic ## argument. We can resolve this symbol later by looking at the ## symbol table in the #exec method match_array = match_data.to_a - ## If we have a 4 element array, this means we matched something + ## If we have a 4 element array, this means we matched something ## like LDA # hash} when /^Implied/ {:implied => hash} - else + else {} end output[name].merge!(hash)