From 6e655963f74542395bb2c9f409824e2c32831e70 Mon Sep 17 00:00:00 2001 From: Safiire <safiire@gmail.com> Date: Sun, 29 Mar 2015 10:19:19 -0700 Subject: [PATCH] Renaming the program to n65 --- README.md | 24 ++++++++++++------------ lib/assembler.rb | 2 +- lib/directives/ascii.rb | 2 +- lib/directives/bytes.rb | 2 +- lib/directives/dw.rb | 2 +- lib/directives/enter_scope.rb | 2 +- lib/directives/exit_scope.rb | 2 +- lib/directives/inc.rb | 2 +- lib/directives/incbin.rb | 2 +- lib/directives/ines_header.rb | 2 +- lib/directives/label.rb | 2 +- lib/directives/org.rb | 2 +- lib/directives/segment.rb | 2 +- lib/directives/space.rb | 2 +- lib/front_end.rb | 4 ++-- lib/instruction.rb | 2 +- lib/instruction_base.rb | 2 +- lib/memory_space.rb | 2 +- lib/opcodes.rb | 2 +- lib/parser.rb | 2 +- lib/regexes.rb | 2 +- lib/symbol_table.rb | 2 +- assembler_6502.rb => n65 | 6 +++--- 23 files changed, 37 insertions(+), 37 deletions(-) rename assembler_6502.rb => n65 (67%) diff --git a/README.md b/README.md index f0a823c..c7a3808 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ -# Assembler6502 0.5 +# N65 NES assembler version 0.5 -An NES assembler for the 6502 microprocessor written in Ruby +This is an assembler for the Nintendo Entertainment System's 2A03 +microprocessor. The 2A03 is an 8-bit processor based on the MOS 6502. - Usage: ./assembler\_6502.rb <infile.asm> -o outfile.nes + ```bash + Usage: ./n65 <infile.asm> -o outfile.nes + ``` + +  This is a pretty straightfoward assembler, which is currently set up to produce iNES formatted ROM binaries from 6502 assembly language files. @@ -24,11 +29,10 @@ An NES assembler for the 6502 microprocessor written in Ruby It is good at knowing which addressing modes are and are not allowed for each instruction, and contains some examples of correct syntax. - I believe this assembler can now handle bankswitching if you set a + This assembler can now handle bankswitching if you set a valid mapper in the header, write more than 2 PROG banks, and then and write whatever bankswitching code is nessessary for the mapper - you've chosen. I have not tried this yet, but I will be testing it - out soon. + you've chosen. This assembler supports symbolic labels which can be scoped. When writing assembly it can be easy to run out of effective names for @@ -74,9 +78,8 @@ An NES assembler for the 6502 microprocessor written in Ruby on the NES. -  - # Some new additions: + - .byte can now handle hex and binary literals, and symbols - First version of Midi to NES music converter - added .inc directive, to include other .asm files - nes.asm library include file created, naming popular NES addresses @@ -109,11 +112,8 @@ An NES assembler for the 6502 microprocessor written in Ruby - Tested a ROM that changes background color # Some Todos: - - Create some documentation. - - Support binary %10101010 addresses and literals + - Create NES music from MIDI files easily - Make macros that can be used interchangably inline or as a subroutine - Create a library for common operations, DMA, sound, etc both inline and subroutine options - - Give this project a better name. - Create an interactive read eval compile loop? - - Make an interactive mode diff --git a/lib/assembler.rb b/lib/assembler.rb index 34eafea..9787ebd 100644 --- a/lib/assembler.rb +++ b/lib/assembler.rb @@ -2,7 +2,7 @@ require_relative 'symbol_table' require_relative 'memory_space' require_relative 'parser' -module Assembler6502 +module N65 class Assembler attr_reader :program_counter, :current_segment, :current_bank, :symbol_table, :virtual_memory, :promises diff --git a/lib/directives/ascii.rb b/lib/directives/ascii.rb index cce8d07..d65228e 100644 --- a/lib/directives/ascii.rb +++ b/lib/directives/ascii.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/bytes.rb b/lib/directives/bytes.rb index 6e69564..df02ef5 100644 --- a/lib/directives/bytes.rb +++ b/lib/directives/bytes.rb @@ -1,7 +1,7 @@ require_relative '../instruction_base' require_relative '../regexes.rb' -module Assembler6502 +module N65 #### diff --git a/lib/directives/dw.rb b/lib/directives/dw.rb index e6055bf..4e2e201 100644 --- a/lib/directives/dw.rb +++ b/lib/directives/dw.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/enter_scope.rb b/lib/directives/enter_scope.rb index 0a3ed90..2b39469 100644 --- a/lib/directives/enter_scope.rb +++ b/lib/directives/enter_scope.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/exit_scope.rb b/lib/directives/exit_scope.rb index ee497fc..8e66f27 100644 --- a/lib/directives/exit_scope.rb +++ b/lib/directives/exit_scope.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/inc.rb b/lib/directives/inc.rb index c070665..e8f312a 100644 --- a/lib/directives/inc.rb +++ b/lib/directives/inc.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/incbin.rb b/lib/directives/incbin.rb index 47fa5fb..5f855ea 100644 --- a/lib/directives/incbin.rb +++ b/lib/directives/incbin.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/ines_header.rb b/lib/directives/ines_header.rb index 016f9d8..f0ed189 100644 --- a/lib/directives/ines_header.rb +++ b/lib/directives/ines_header.rb @@ -1,7 +1,7 @@ require 'json' require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/label.rb b/lib/directives/label.rb index ecd14cd..3d41310 100644 --- a/lib/directives/label.rb +++ b/lib/directives/label.rb @@ -1,5 +1,5 @@ -module Assembler6502 +module N65 #### ## This class represents a label, and will create diff --git a/lib/directives/org.rb b/lib/directives/org.rb index 35e7a8f..f155cb3 100644 --- a/lib/directives/org.rb +++ b/lib/directives/org.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### ## This is an .org directive diff --git a/lib/directives/segment.rb b/lib/directives/segment.rb index 97a4fc6..753ee09 100644 --- a/lib/directives/segment.rb +++ b/lib/directives/segment.rb @@ -1,5 +1,5 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/directives/space.rb b/lib/directives/space.rb index 5d9a929..94f1388 100644 --- a/lib/directives/space.rb +++ b/lib/directives/space.rb @@ -1,6 +1,6 @@ require_relative '../instruction_base' -module Assembler6502 +module N65 #### diff --git a/lib/front_end.rb b/lib/front_end.rb index cb80398..2fb6125 100644 --- a/lib/front_end.rb +++ b/lib/front_end.rb @@ -1,7 +1,7 @@ require 'optparse' require_relative 'assembler' -module Assembler6502 +module N65 #### ## This class handles the front end aspects, @@ -55,7 +55,7 @@ module Assembler6502 end #begin - Assembler6502::Assembler.from_file(input_file, @options[:output_file]) + N65::Assembler.from_file(input_file, @options[:output_file]) #rescue StandardError => error #STDERR.puts("Assemble Failed!") #STDERR.puts(error.class) diff --git a/lib/instruction.rb b/lib/instruction.rb index 55a11f3..36a6120 100644 --- a/lib/instruction.rb +++ b/lib/instruction.rb @@ -1,7 +1,7 @@ require_relative 'opcodes' require_relative 'regexes' -module Assembler6502 +module N65 #### ## Represents a single 6502 Instruction diff --git a/lib/instruction_base.rb b/lib/instruction_base.rb index a0dd98b..9722169 100644 --- a/lib/instruction_base.rb +++ b/lib/instruction_base.rb @@ -1,5 +1,5 @@ -module Assembler6502 +module N65 class InstructionBase diff --git a/lib/memory_space.rb b/lib/memory_space.rb index 5909084..a3f59de 100644 --- a/lib/memory_space.rb +++ b/lib/memory_space.rb @@ -1,5 +1,5 @@ -module Assembler6502 +module N65 #### ## Let's use this to simulate a virtual address space diff --git a/lib/opcodes.rb b/lib/opcodes.rb index c3d2095..ecfccd6 100644 --- a/lib/opcodes.rb +++ b/lib/opcodes.rb @@ -1,6 +1,6 @@ require 'yaml' -module Assembler6502 +module N65 ## Load OpCode definitions into this module MyDirectory = File.expand_path(File.dirname(__FILE__)) diff --git a/lib/parser.rb b/lib/parser.rb index c570c2d..d39e233 100644 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -1,5 +1,5 @@ -module Assembler6502 +module N65 require_relative 'instruction' require_relative 'directives/ines_header' diff --git a/lib/regexes.rb b/lib/regexes.rb index 8cff0b5..9c2a65a 100644 --- a/lib/regexes.rb +++ b/lib/regexes.rb @@ -1,6 +1,6 @@ -module Assembler6502 +module N65 #### ## All the regexes used to parse in one module diff --git a/lib/symbol_table.rb b/lib/symbol_table.rb index 4807217..32a2fbb 100644 --- a/lib/symbol_table.rb +++ b/lib/symbol_table.rb @@ -1,6 +1,6 @@ require 'pry-byebug' -module Assembler6502 +module N65 class SymbolTable attr_accessor :scope_stack diff --git a/assembler_6502.rb b/n65 similarity index 67% rename from assembler_6502.rb rename to n65 index af17de7..366247d 100755 --- a/assembler_6502.rb +++ b/n65 @@ -1,11 +1,11 @@ #!/usr/bin/env ruby ############################################################################### -## 6502 Assembler +## 6502 Assembler for the NES's 2A03 ## -## Usage: ./assembler_6502.rb <infile.asm> +## Usage: ./n65 <infile.asm> ## ## This file runs the assembler though the commandline frontend. require_relative 'lib/front_end' -Assembler6502::FrontEnd.new(ARGV).run +N65::FrontEnd.new(ARGV).run