mirror of
https://github.com/safiire/n65.git
synced 2025-01-24 17:31:38 +00:00
Removed all trailing whitespace
This commit is contained in:
parent
d6a9f7ac7d
commit
7ffd2dc8ac
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -16,7 +16,7 @@ module N65
|
||||
Org.new(address)
|
||||
end
|
||||
|
||||
|
||||
|
||||
####
|
||||
## Initialized with address to switch to
|
||||
def initialize(address)
|
||||
|
@ -1,4 +1,4 @@
|
||||
require_relative '../instruction_base'
|
||||
require_relative '../instruction_base'
|
||||
module N65
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 #<label, which is a legal immediate one byte value
|
||||
## by taking the msb. We need to make that distinction in the
|
||||
## Instruction, by passing an extra argument
|
||||
|
@ -19,7 +19,7 @@ module N65
|
||||
|
||||
####
|
||||
## This class determines what sort of line of code we
|
||||
## are dealing with, parses one line, and returns an
|
||||
## are dealing with, parses one line, and returns an
|
||||
## object deriving from InstructionBase
|
||||
class Parser
|
||||
|
||||
|
@ -5,7 +5,7 @@ module N65
|
||||
####
|
||||
## All the regexes used to parse in one module
|
||||
module Regexes
|
||||
## Mnemonics
|
||||
## Mnemonics
|
||||
Mnemonic = '([A-Za-z]{3})'
|
||||
Branches = '(BPL|BMI|BVC|BVS|BCC|BCS|BNE|BEQ|bpl|bmi|bvc|bvs|bcc|bcs|bne|beq)'
|
||||
|
||||
|
@ -25,7 +25,7 @@ module N65
|
||||
## Define a new scope, which can be anonymous or named
|
||||
## and switch into that scope
|
||||
def enter_scope(name = nil)
|
||||
name = generate_name if name.nil?
|
||||
name = generate_name if name.nil?
|
||||
name = name.to_sym
|
||||
scope = current_scope
|
||||
if scope.has_key?(name)
|
||||
@ -56,7 +56,7 @@ module N65
|
||||
|
||||
|
||||
####
|
||||
##
|
||||
##
|
||||
def resolve_symbol(name)
|
||||
method = name.include?('.') ? :resolve_symbol_dot_syntax : :resolve_symbol_scoped
|
||||
value = self.send(method, name)
|
||||
|
@ -40,7 +40,7 @@ class TestMemorySpace < MiniTest::Test
|
||||
|
||||
def _test_reading_out_of_bounds
|
||||
space = MemorySpace.create_prog_rom
|
||||
assert_raises(MemorySpace::AccessOutsideProgRom) do
|
||||
assert_raises(MemorySpace::AccessOutsideProgRom) do
|
||||
space.read(0x200, 10)
|
||||
end
|
||||
|
||||
@ -50,7 +50,7 @@ class TestMemorySpace < MiniTest::Test
|
||||
|
||||
## But something like this should explode
|
||||
space = MemorySpace.create_char_rom
|
||||
assert_raises(MemorySpace::AccessOutsideCharRom) do
|
||||
assert_raises(MemorySpace::AccessOutsideCharRom) do
|
||||
space.read(0x8001, 10)
|
||||
end
|
||||
end
|
||||
@ -66,7 +66,7 @@ class TestMemorySpace < MiniTest::Test
|
||||
|
||||
## Write the NMI address to FFFA
|
||||
space.write(0xFFFA, bytes)
|
||||
|
||||
|
||||
## Write the entry point to FFFC
|
||||
space.write(0xFFFC, bytes)
|
||||
|
||||
|
@ -66,7 +66,7 @@ class TestSymbolTable < MiniTest::Test
|
||||
|
||||
st.exit_scope
|
||||
|
||||
assert_raises(SymbolTable::UndefinedSymbol) do
|
||||
assert_raises(SymbolTable::UndefinedSymbol) do
|
||||
assert_equal('woof', st.resolve_symbol('dog'))
|
||||
end
|
||||
end
|
||||
@ -106,7 +106,7 @@ class TestSymbolTable < MiniTest::Test
|
||||
|
||||
|
||||
####
|
||||
## How do you get stuff out of the global scope when you are in
|
||||
## How do you get stuff out of the global scope when you are in
|
||||
## a sub scope?
|
||||
def test_access_global_scope
|
||||
st = SymbolTable.new
|
||||
@ -144,18 +144,18 @@ class TestSymbolTable < MiniTest::Test
|
||||
|
||||
|
||||
####
|
||||
## Now I want to test that I cannot exist the outer-most
|
||||
## Now I want to test that I cannot exist the outer-most
|
||||
## global scope by mistake
|
||||
def test_cant_exit_global
|
||||
st = SymbolTable.new
|
||||
assert_raises(SymbolTable::CantExitScope) do
|
||||
assert_raises(SymbolTable::CantExitScope) do
|
||||
st.exit_scope
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
####
|
||||
## I would like the name of the scope to take on the
|
||||
## I would like the name of the scope to take on the
|
||||
## value of the program counter at that location.
|
||||
def test_scope_as_symbol
|
||||
program = <<-ASM
|
||||
|
@ -119,12 +119,12 @@ class MidiToNES
|
||||
|
||||
####
|
||||
## Given an event, produce a value for register nes.apu.pulse1.control
|
||||
## DDLC VVVV
|
||||
## DDLC VVVV
|
||||
## Duty (D), envelope loop / length counter halt (L), constant volume (C), volume/envelope (V)
|
||||
def pulse_control_value(event)
|
||||
## Start with 50% duty cycle, length counter halt is on
|
||||
## Constant volume is On, and volume is determined by bit-reducing the event velocity to 4-bit
|
||||
value = 0b10000111
|
||||
value = 0b10000111
|
||||
|
||||
#four_bit_max = (2**4 - 1)
|
||||
#seven_bit_max = (2**7 - 1)
|
||||
|
@ -3,7 +3,7 @@
|
||||
###############################################################################
|
||||
## http://www.6502.org/tutorials/6502opcodes.html
|
||||
## This web page has information about each and every 6502 instruction
|
||||
## Specifically:
|
||||
## Specifically:
|
||||
##
|
||||
## - Description of what each of the instructions do
|
||||
## - Which modes are supported by which instructions, immediate, zero page
|
||||
@ -13,7 +13,7 @@
|
||||
## - The possibly variable number of cycles each instruction takes.
|
||||
##
|
||||
## There are 56 of them, and in my programmer laziness I just wrote this
|
||||
## script to parse the page into the data structure that you see in
|
||||
## script to parse the page into the data structure that you see in
|
||||
## opcodes.yaml. This really helped in creating the assembler, and
|
||||
## it had basically everything I needed to know, and sped up writing
|
||||
## this by huge factor. So, yay to this page, and this script!
|
||||
@ -77,7 +77,7 @@ lines.each do |line|
|
||||
{:indirect => hash}
|
||||
when /^Implied/
|
||||
{:implied => hash}
|
||||
else
|
||||
else
|
||||
{}
|
||||
end
|
||||
output[name].merge!(hash)
|
||||
|
Loading…
x
Reference in New Issue
Block a user