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:
|
:adc:
|
||||||
:description: "ADd with Carry"
|
:description: "ADd with Carry"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :v
|
- :v
|
||||||
- :z
|
- :z
|
||||||
- :c
|
- :c
|
||||||
:immediate:
|
:immediate:
|
||||||
:hex: 0x69
|
:hex: 0x69
|
||||||
:len: 2
|
:len: 2
|
||||||
:cycles: 2
|
:cycles: 2
|
||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:zero_page:
|
:zero_page:
|
||||||
:hex: 0x65
|
:hex: 0x65
|
||||||
:len: 2
|
:len: 2
|
||||||
:cycles: 3
|
:cycles: 3
|
||||||
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
:and:
|
:and:
|
||||||
:description: "bitwise AND with accumulator"
|
:description: "bitwise AND with accumulator"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
:asl:
|
:asl:
|
||||||
:description: "Arithmetic Shift Left"
|
:description: "Arithmetic Shift Left"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
- :c
|
- :c
|
||||||
@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
:bit:
|
:bit:
|
||||||
:description: "test BITs"
|
:description: "test BITs"
|
||||||
:flags:
|
:flags:
|
||||||
- :n
|
- :n
|
||||||
- :v
|
- :v
|
||||||
- :z
|
- :z
|
||||||
@ -202,9 +202,9 @@
|
|||||||
|
|
||||||
:brk:
|
:brk:
|
||||||
:description: "BReaK"
|
:description: "BReaK"
|
||||||
:flags:
|
:flags:
|
||||||
- :b
|
- :b
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0x0
|
:hex: 0x0
|
||||||
:len: 1
|
:len: 1
|
||||||
:cycles: 7
|
:cycles: 7
|
||||||
@ -212,7 +212,7 @@
|
|||||||
|
|
||||||
:cmp:
|
:cmp:
|
||||||
:description: "CoMPare accumulator"
|
:description: "CoMPare accumulator"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :c
|
- :c
|
||||||
- :z
|
- :z
|
||||||
@ -259,7 +259,7 @@
|
|||||||
|
|
||||||
:cpx:
|
:cpx:
|
||||||
:description: "ComPare X register"
|
:description: "ComPare X register"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :c
|
- :c
|
||||||
- :z
|
- :z
|
||||||
@ -281,7 +281,7 @@
|
|||||||
|
|
||||||
:cpy:
|
:cpy:
|
||||||
:description: "ComPare Y register"
|
:description: "ComPare Y register"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :c
|
- :c
|
||||||
- :z
|
- :z
|
||||||
@ -303,7 +303,7 @@
|
|||||||
|
|
||||||
:dec:
|
:dec:
|
||||||
description: "DECrement memory"
|
description: "DECrement memory"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:zero_page:
|
:zero_page:
|
||||||
@ -329,7 +329,7 @@
|
|||||||
|
|
||||||
:eor:
|
:eor:
|
||||||
:description: "bitwise Exclusive OR"
|
:description: "bitwise Exclusive OR"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -375,7 +375,7 @@
|
|||||||
|
|
||||||
:clc:
|
:clc:
|
||||||
:description: "CLear Carry"
|
:description: "CLear Carry"
|
||||||
:flags:
|
:flags:
|
||||||
- :c
|
- :c
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0x18
|
:hex: 0x18
|
||||||
@ -383,7 +383,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:sec:
|
:sec:
|
||||||
:description: "SEt Carry"
|
:description: "SEt Carry"
|
||||||
:flags:
|
:flags:
|
||||||
- :c
|
- :c
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0x38
|
:hex: 0x38
|
||||||
@ -391,7 +391,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:cli:
|
:cli:
|
||||||
:description: "CLear Interrupt"
|
:description: "CLear Interrupt"
|
||||||
:flags:
|
:flags:
|
||||||
- :i
|
- :i
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0x58
|
:hex: 0x58
|
||||||
@ -399,7 +399,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:sei:
|
:sei:
|
||||||
:description: "SEt Interrupt"
|
:description: "SEt Interrupt"
|
||||||
:flags:
|
:flags:
|
||||||
- :i
|
- :i
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0x78
|
:hex: 0x78
|
||||||
@ -407,7 +407,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:clv:
|
:clv:
|
||||||
:description: "CLear oVerflow"
|
:description: "CLear oVerflow"
|
||||||
:flags:
|
:flags:
|
||||||
- :v
|
- :v
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0xB8
|
:hex: 0xB8
|
||||||
@ -415,7 +415,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:cld:
|
:cld:
|
||||||
:description: "CLear Decimal"
|
:description: "CLear Decimal"
|
||||||
:flags:
|
:flags:
|
||||||
- :d
|
- :d
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0xD8
|
:hex: 0xD8
|
||||||
@ -423,7 +423,7 @@
|
|||||||
:cycles: 2
|
:cycles: 2
|
||||||
:sed:
|
:sed:
|
||||||
:description: "SEt Decimal"
|
:description: "SEt Decimal"
|
||||||
:flags:
|
:flags:
|
||||||
- :d
|
- :d
|
||||||
:implied:
|
:implied:
|
||||||
:hex: 0xF8
|
:hex: 0xF8
|
||||||
@ -432,7 +432,7 @@
|
|||||||
|
|
||||||
:inc:
|
:inc:
|
||||||
:description: "INCrement memory"
|
:description: "INCrement memory"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:zero_page:
|
:zero_page:
|
||||||
@ -481,7 +481,7 @@
|
|||||||
|
|
||||||
:lda:
|
:lda:
|
||||||
:description: "LoaD Accumulator"
|
:description: "LoaD Accumulator"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -527,7 +527,7 @@
|
|||||||
|
|
||||||
:ldx:
|
:ldx:
|
||||||
:description: "LoaD X register"
|
:description: "LoaD X register"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -558,7 +558,7 @@
|
|||||||
|
|
||||||
:ldy:
|
:ldy:
|
||||||
:description: "LoaD Y register"
|
:description: "LoaD Y register"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -589,7 +589,7 @@
|
|||||||
|
|
||||||
:lsr:
|
:lsr:
|
||||||
:description: "Logical Shift Right"
|
:description: "Logical Shift Right"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
- :c
|
- :c
|
||||||
@ -630,7 +630,7 @@
|
|||||||
|
|
||||||
:ora:
|
:ora:
|
||||||
:description: "bitwise OR with Accumulator"
|
:description: "bitwise OR with Accumulator"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:immediate:
|
:immediate:
|
||||||
@ -676,7 +676,7 @@
|
|||||||
|
|
||||||
:tax:
|
:tax:
|
||||||
:description: "Transfer A to X"
|
:description: "Transfer A to X"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -686,7 +686,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:txa:
|
:txa:
|
||||||
:description: "Transfer X to A"
|
:description: "Transfer X to A"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -696,7 +696,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:dex:
|
:dex:
|
||||||
:description: "DEcrement X"
|
:description: "DEcrement X"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -706,7 +706,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:inx:
|
:inx:
|
||||||
:description: "INcrement X"
|
:description: "INcrement X"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -716,7 +716,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:tay:
|
:tay:
|
||||||
:description: "Transfer A to Y"
|
:description: "Transfer A to Y"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -726,7 +726,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:tya:
|
:tya:
|
||||||
:description: "Transfer Y to A"
|
:description: "Transfer Y to A"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -736,7 +736,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:dey:
|
:dey:
|
||||||
:description: "DEcrement Y"
|
:description: "DEcrement Y"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -746,7 +746,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:iny:
|
:iny:
|
||||||
:description: "INcrement Y"
|
:description: "INcrement Y"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
:implied:
|
:implied:
|
||||||
@ -757,7 +757,7 @@
|
|||||||
|
|
||||||
:rol:
|
:rol:
|
||||||
:description: "ROtate Left"
|
:description: "ROtate Left"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
- :c
|
- :c
|
||||||
@ -789,7 +789,7 @@
|
|||||||
|
|
||||||
:ror:
|
:ror:
|
||||||
:description: "ROtate Right"
|
:description: "ROtate Right"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :z
|
- :z
|
||||||
- :c
|
- :c
|
||||||
@ -821,7 +821,7 @@
|
|||||||
|
|
||||||
:rti:
|
:rti:
|
||||||
:description: "ReTurn from Interrupt, TODO: Flags could be wrong"
|
:description: "ReTurn from Interrupt, TODO: Flags could be wrong"
|
||||||
:flags:
|
:flags:
|
||||||
- :n
|
- :n
|
||||||
- :v
|
- :v
|
||||||
- :u
|
- :u
|
||||||
@ -847,7 +847,7 @@
|
|||||||
|
|
||||||
:sbc:
|
:sbc:
|
||||||
:description: "SuBtract with Carry"
|
:description: "SuBtract with Carry"
|
||||||
:flags:
|
:flags:
|
||||||
- :s
|
- :s
|
||||||
- :v
|
- :v
|
||||||
- :z
|
- :z
|
||||||
@ -976,7 +976,7 @@
|
|||||||
:boundry_add: false
|
:boundry_add: false
|
||||||
:plp:
|
:plp:
|
||||||
:description: "PuLl Processor status"
|
:description: "PuLl Processor status"
|
||||||
:flags:
|
:flags:
|
||||||
- :n
|
- :n
|
||||||
- :v
|
- :v
|
||||||
- :u
|
- :u
|
||||||
|
@ -94,7 +94,7 @@ module N65
|
|||||||
####
|
####
|
||||||
## This is the main assemble method, it parses one line into an object
|
## This is the main assemble method, it parses one line into an object
|
||||||
## which when given a reference to this assembler, controls the assembler
|
## 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
|
## emitting bytes into our virtual memory spaces. Empty lines or lines
|
||||||
## with only comments parse to nil, and we just ignore them.
|
## with only comments parse to nil, and we just ignore them.
|
||||||
def assemble_one_line(line)
|
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
|
## executed with a previous state, for example if we can't resolve
|
||||||
## a symbol right now, and want to try during the second pass
|
## a symbol right now, and want to try during the second pass
|
||||||
def with_saved_state(&block)
|
def with_saved_state(&block)
|
||||||
@ -194,7 +194,7 @@ module N65
|
|||||||
puts "+ #{progs.size} PROG ROM bank#{progs.size != 1 ? 's' : ''}"
|
puts "+ #{progs.size} PROG ROM bank#{progs.size != 1 ? 's' : ''}"
|
||||||
puts "+ #{chars.size} CHAR ROM bank#{chars.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[:prog] * progs.size
|
||||||
rom_size += MemorySpace::BankSizes[:char] * chars.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 current pc which contains a hyphen, and is impossible for
|
||||||
## the user to create. This makes a scope simultaneously act as
|
## the user to create. This makes a scope simultaneously act as
|
||||||
## a label to the current PC. If someone tries to use a scope
|
## a label to the current PC. If someone tries to use a scope
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
module N65
|
module N65
|
||||||
|
|
||||||
####
|
####
|
||||||
## This class represents a label, and will create
|
## This class represents a label, and will create
|
||||||
## an entry in the symbol table associated with
|
## an entry in the symbol table associated with
|
||||||
## the address it appears at.
|
## the address it appears at.
|
||||||
class Label
|
class Label
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ module N65
|
|||||||
Org.new(address)
|
Org.new(address)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
## Initialized with address to switch to
|
## Initialized with address to switch to
|
||||||
def initialize(address)
|
def initialize(address)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require_relative '../instruction_base'
|
require_relative '../instruction_base'
|
||||||
module N65
|
module N65
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ require_relative '../n65'
|
|||||||
module 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
|
## parsing the commandline options and running the assembler
|
||||||
class FrontEnd
|
class FrontEnd
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ module N65
|
|||||||
STDERR.puts "Input file #{input_file} does not exist"
|
STDERR.puts "Input file #{input_file} does not exist"
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
## Maybe they didn't provide an output file name, so we'll guess
|
## Maybe they didn't provide an output file name, so we'll guess
|
||||||
if @options[:output_file].nil?
|
if @options[:output_file].nil?
|
||||||
ext = File.extname(input_file)
|
ext = File.extname(input_file)
|
||||||
|
@ -15,7 +15,7 @@ module N65
|
|||||||
class AddressOutOfRange < StandardError; end
|
class AddressOutOfRange < StandardError; end
|
||||||
class ArgumentTooLarge < StandardError; end
|
class ArgumentTooLarge < StandardError; end
|
||||||
|
|
||||||
## Include Regexes
|
## Include Regexes
|
||||||
include Regexes
|
include Regexes
|
||||||
|
|
||||||
AddressingModes = {
|
AddressingModes = {
|
||||||
@ -26,7 +26,7 @@ module N65
|
|||||||
:regex_label => /^#{Branches}\s+#{Sym}$/
|
:regex_label => /^#{Branches}\s+#{Sym}$/
|
||||||
},
|
},
|
||||||
|
|
||||||
:immediate => {
|
:immediate => {
|
||||||
:example => 'AAA #$FF',
|
:example => 'AAA #$FF',
|
||||||
:display => '%s #$%.2X',
|
:display => '%s #$%.2X',
|
||||||
:regex => /^#{Mnemonic}\s+#{Immediate}$/,
|
:regex => /^#{Mnemonic}\s+#{Immediate}$/,
|
||||||
@ -116,7 +116,7 @@ module N65
|
|||||||
match_data = parse_info[:regex].match(line)
|
match_data = parse_info[:regex].match(line)
|
||||||
|
|
||||||
unless match_data.nil?
|
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
|
## an Instruction from the match_data, and return it
|
||||||
_, op, arg_hex, arg_bin = match_data.to_a
|
_, op, arg_hex, arg_bin = match_data.to_a
|
||||||
|
|
||||||
@ -139,12 +139,12 @@ module N65
|
|||||||
match_data = parse_info[:regex_label].match(line)
|
match_data = parse_info[:regex_label].match(line)
|
||||||
|
|
||||||
unless match_data.nil?
|
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
|
## argument. We can resolve this symbol later by looking at the
|
||||||
## symbol table in the #exec method
|
## symbol table in the #exec method
|
||||||
match_array = match_data.to_a
|
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
|
## like LDA #<label, which is a legal immediate one byte value
|
||||||
## by taking the msb. We need to make that distinction in the
|
## by taking the msb. We need to make that distinction in the
|
||||||
## Instruction, by passing an extra argument
|
## Instruction, by passing an extra argument
|
||||||
|
@ -19,7 +19,7 @@ module N65
|
|||||||
|
|
||||||
####
|
####
|
||||||
## This class determines what sort of line of code we
|
## 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
|
## object deriving from InstructionBase
|
||||||
class Parser
|
class Parser
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ module N65
|
|||||||
####
|
####
|
||||||
## All the regexes used to parse in one module
|
## All the regexes used to parse in one module
|
||||||
module Regexes
|
module Regexes
|
||||||
## Mnemonics
|
## Mnemonics
|
||||||
Mnemonic = '([A-Za-z]{3})'
|
Mnemonic = '([A-Za-z]{3})'
|
||||||
Branches = '(BPL|BMI|BVC|BVS|BCC|BCS|BNE|BEQ|bpl|bmi|bvc|bvs|bcc|bcs|bne|beq)'
|
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
|
## Define a new scope, which can be anonymous or named
|
||||||
## and switch into that scope
|
## and switch into that scope
|
||||||
def enter_scope(name = nil)
|
def enter_scope(name = nil)
|
||||||
name = generate_name if name.nil?
|
name = generate_name if name.nil?
|
||||||
name = name.to_sym
|
name = name.to_sym
|
||||||
scope = current_scope
|
scope = current_scope
|
||||||
if scope.has_key?(name)
|
if scope.has_key?(name)
|
||||||
@ -56,7 +56,7 @@ module N65
|
|||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
##
|
##
|
||||||
def resolve_symbol(name)
|
def resolve_symbol(name)
|
||||||
method = name.include?('.') ? :resolve_symbol_dot_syntax : :resolve_symbol_scoped
|
method = name.include?('.') ? :resolve_symbol_dot_syntax : :resolve_symbol_scoped
|
||||||
value = self.send(method, name)
|
value = self.send(method, name)
|
||||||
|
@ -40,7 +40,7 @@ class TestMemorySpace < MiniTest::Test
|
|||||||
|
|
||||||
def _test_reading_out_of_bounds
|
def _test_reading_out_of_bounds
|
||||||
space = MemorySpace.create_prog_rom
|
space = MemorySpace.create_prog_rom
|
||||||
assert_raises(MemorySpace::AccessOutsideProgRom) do
|
assert_raises(MemorySpace::AccessOutsideProgRom) do
|
||||||
space.read(0x200, 10)
|
space.read(0x200, 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ class TestMemorySpace < MiniTest::Test
|
|||||||
|
|
||||||
## But something like this should explode
|
## But something like this should explode
|
||||||
space = MemorySpace.create_char_rom
|
space = MemorySpace.create_char_rom
|
||||||
assert_raises(MemorySpace::AccessOutsideCharRom) do
|
assert_raises(MemorySpace::AccessOutsideCharRom) do
|
||||||
space.read(0x8001, 10)
|
space.read(0x8001, 10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -66,7 +66,7 @@ class TestMemorySpace < MiniTest::Test
|
|||||||
|
|
||||||
## Write the NMI address to FFFA
|
## Write the NMI address to FFFA
|
||||||
space.write(0xFFFA, bytes)
|
space.write(0xFFFA, bytes)
|
||||||
|
|
||||||
## Write the entry point to FFFC
|
## Write the entry point to FFFC
|
||||||
space.write(0xFFFC, bytes)
|
space.write(0xFFFC, bytes)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class TestSymbolTable < MiniTest::Test
|
|||||||
|
|
||||||
st.exit_scope
|
st.exit_scope
|
||||||
|
|
||||||
assert_raises(SymbolTable::UndefinedSymbol) do
|
assert_raises(SymbolTable::UndefinedSymbol) do
|
||||||
assert_equal('woof', st.resolve_symbol('dog'))
|
assert_equal('woof', st.resolve_symbol('dog'))
|
||||||
end
|
end
|
||||||
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?
|
## a sub scope?
|
||||||
def test_access_global_scope
|
def test_access_global_scope
|
||||||
st = SymbolTable.new
|
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
|
## global scope by mistake
|
||||||
def test_cant_exit_global
|
def test_cant_exit_global
|
||||||
st = SymbolTable.new
|
st = SymbolTable.new
|
||||||
assert_raises(SymbolTable::CantExitScope) do
|
assert_raises(SymbolTable::CantExitScope) do
|
||||||
st.exit_scope
|
st.exit_scope
|
||||||
end
|
end
|
||||||
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.
|
## value of the program counter at that location.
|
||||||
def test_scope_as_symbol
|
def test_scope_as_symbol
|
||||||
program = <<-ASM
|
program = <<-ASM
|
||||||
|
@ -119,12 +119,12 @@ class MidiToNES
|
|||||||
|
|
||||||
####
|
####
|
||||||
## Given an event, produce a value for register nes.apu.pulse1.control
|
## 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)
|
## Duty (D), envelope loop / length counter halt (L), constant volume (C), volume/envelope (V)
|
||||||
def pulse_control_value(event)
|
def pulse_control_value(event)
|
||||||
## Start with 50% duty cycle, length counter halt is on
|
## 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
|
## 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)
|
#four_bit_max = (2**4 - 1)
|
||||||
#seven_bit_max = (2**7 - 1)
|
#seven_bit_max = (2**7 - 1)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
## http://www.6502.org/tutorials/6502opcodes.html
|
## http://www.6502.org/tutorials/6502opcodes.html
|
||||||
## This web page has information about each and every 6502 instruction
|
## This web page has information about each and every 6502 instruction
|
||||||
## Specifically:
|
## Specifically:
|
||||||
##
|
##
|
||||||
## - Description of what each of the instructions do
|
## - Description of what each of the instructions do
|
||||||
## - Which modes are supported by which instructions, immediate, zero page
|
## - Which modes are supported by which instructions, immediate, zero page
|
||||||
@ -13,7 +13,7 @@
|
|||||||
## - The possibly variable number of cycles each instruction takes.
|
## - The possibly variable number of cycles each instruction takes.
|
||||||
##
|
##
|
||||||
## There are 56 of them, and in my programmer laziness I just wrote this
|
## 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
|
## opcodes.yaml. This really helped in creating the assembler, and
|
||||||
## it had basically everything I needed to know, and sped up writing
|
## it had basically everything I needed to know, and sped up writing
|
||||||
## this by huge factor. So, yay to this page, and this script!
|
## this by huge factor. So, yay to this page, and this script!
|
||||||
@ -77,7 +77,7 @@ lines.each do |line|
|
|||||||
{:indirect => hash}
|
{:indirect => hash}
|
||||||
when /^Implied/
|
when /^Implied/
|
||||||
{:implied => hash}
|
{:implied => hash}
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
output[name].merge!(hash)
|
output[name].merge!(hash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user