mirror of
https://github.com/safiire/n65.git
synced 2025-03-03 01:30:07 +00:00
Made n65 into a RubyGem
This commit is contained in:
parent
58eab7dd6f
commit
1013280f9e
14
.gitignore
vendored
14
.gitignore
vendored
@ -7,3 +7,17 @@ Thumbs.db
|
||||
*.deb
|
||||
*.swp
|
||||
*.mus
|
||||
/.bundle/
|
||||
/.yardoc
|
||||
/Gemfile.lock
|
||||
/_yardoc/
|
||||
/coverage/
|
||||
/doc/
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/tmp/
|
||||
*.bundle
|
||||
*.so
|
||||
*.o
|
||||
*.a
|
||||
mkmf.log
|
||||
|
4
Gemfile
Normal file
4
Gemfile
Normal file
@ -0,0 +1,4 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Specify your gem's dependencies in n65.gemspec
|
||||
gemspec
|
@ -14,6 +14,11 @@ The 2A03 is an 8-bit processor based on the MOS 6502.
|
||||
This is a pretty straightfoward assembler, which is currently set up
|
||||
to produce iNES formatted ROM binaries from 6502 assembly language files.
|
||||
|
||||
<a href="http://irkenkitties.com/blog/2015/03/29/creating-sound-on-the-nes/">Here</a>
|
||||
is a recent blog post that goes through creating a program with this
|
||||
n65, showing the essential syntax and more. Best thing until I create
|
||||
some real documentation.
|
||||
|
||||
Inside An NES cartridge there are basically some number of ROM chips
|
||||
which contain banks of either program code or character (graphics)
|
||||
data. A PROG ROM bank is generally 16KB, and a CHAR ROM bank is generally
|
||||
|
@ -6,6 +6,6 @@
|
||||
##
|
||||
## This file runs the assembler though the commandline frontend.
|
||||
|
||||
require_relative 'lib/front_end'
|
||||
require_relative '../lib/n65/front_end'
|
||||
|
||||
N65::FrontEnd.new(ARGV).run
|
@ -1,6 +1,7 @@
|
||||
require_relative 'symbol_table'
|
||||
require_relative 'memory_space'
|
||||
require_relative 'parser'
|
||||
require_relative 'n65/version'
|
||||
require_relative 'n65/symbol_table'
|
||||
require_relative 'n65/memory_space'
|
||||
require_relative 'n65/parser'
|
||||
|
||||
module N65
|
||||
|
||||
@ -25,8 +26,13 @@ module N65
|
||||
|
||||
puts "Building #{infile}"
|
||||
## Process each line in the file
|
||||
program.split(/\n/).each do |line|
|
||||
assembler.assemble_one_line(line)
|
||||
program.split(/\n/).each_with_index do |line, line_number|
|
||||
begin
|
||||
assembler.assemble_one_line(line)
|
||||
rescue StandardError => e
|
||||
STDERR.puts("\n\n#{e.class}\n#{line}\n#{e}\nOn line #{line_number}")
|
||||
exit(1)
|
||||
end
|
||||
print '.'
|
||||
end
|
||||
puts
|
@ -8,7 +8,7 @@ module N65
|
||||
class Inc < InstructionBase
|
||||
|
||||
#### System include directory
|
||||
SystemInclude = File.dirname(__FILE__) + "/../../nes_lib"
|
||||
SystemInclude = File.dirname(__FILE__) + "/../../../nes_lib"
|
||||
|
||||
#### Custom Exceptions
|
||||
class FileNotFound < StandardError; end
|
@ -1,5 +1,5 @@
|
||||
require 'optparse'
|
||||
require_relative 'assembler'
|
||||
require_relative '../n65'
|
||||
|
||||
module N65
|
||||
|
@ -4,6 +4,6 @@ module N65
|
||||
|
||||
## Load OpCode definitions into this module
|
||||
MyDirectory = File.expand_path(File.dirname(__FILE__))
|
||||
OpCodes = YAML.load_file("#{MyDirectory}/../data/opcodes.yaml")
|
||||
OpCodes = YAML.load_file("#{MyDirectory}/../../data/opcodes.yaml")
|
||||
|
||||
end
|
@ -1,4 +1,3 @@
|
||||
require 'pry-byebug'
|
||||
|
||||
module N65
|
||||
|
3
lib/n65/version.rb
Normal file
3
lib/n65/version.rb
Normal file
@ -0,0 +1,3 @@
|
||||
module N65
|
||||
VERSION = "0.5.0"
|
||||
end
|
23
n65.gemspec
Normal file
23
n65.gemspec
Normal file
@ -0,0 +1,23 @@
|
||||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'n65/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "n65"
|
||||
spec.version = N65::VERSION
|
||||
spec.authors = ["Safiire"]
|
||||
spec.email = ["safiire@irkenkitties.com"]
|
||||
spec.summary = %q{An NES assembler for the 6502 microprocessor written in Ruby}
|
||||
spec.description = %q{An NES assembler for the 6502 microprocessor written in Ruby}
|
||||
spec.homepage = "http://github.com/safiire/n65"
|
||||
spec.license = "GPL2"
|
||||
|
||||
spec.files = `git ls-files -z`.split("\x0")
|
||||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_development_dependency "bundler", "~> 1.7"
|
||||
spec.add_development_dependency "rake", "~> 10.0"
|
||||
end
|
@ -2,11 +2,11 @@ gem 'minitest'
|
||||
require 'minitest/autorun'
|
||||
require 'minitest/unit'
|
||||
|
||||
require_relative '../lib/memory_space.rb'
|
||||
require_relative '../lib/n65/memory_space.rb'
|
||||
|
||||
|
||||
class TestMemorySpace < MiniTest::Test
|
||||
include Assembler6502
|
||||
include N65
|
||||
|
||||
def _test_create_prog_rom
|
||||
## First just try to read alll of it
|
||||
|
@ -2,12 +2,12 @@ gem 'minitest'
|
||||
require 'minitest/autorun'
|
||||
require 'minitest/unit'
|
||||
|
||||
require_relative '../lib/symbol_table.rb'
|
||||
require_relative '../lib/assembler.rb'
|
||||
require_relative '../lib/n65/symbol_table.rb'
|
||||
require_relative '../lib/n65.rb'
|
||||
|
||||
|
||||
class TestSymbolTable < MiniTest::Test
|
||||
include Assembler6502
|
||||
include N65
|
||||
|
||||
####
|
||||
## Test that we can make simple global symbols
|
||||
|
Loading…
x
Reference in New Issue
Block a user