r6502 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/LICENSE +20 -0
- data/README.md +27 -0
- data/bin/r6502 +41 -0
- data/lib/r6502.rb +6 -0
- data/lib/r6502/assembler.rb +204 -0
- data/lib/r6502/cpu_execution.rb +95 -0
- data/lib/r6502/cpu_instructions.rb +517 -0
- data/lib/r6502/instr_table.rb +213 -0
- data/lib/r6502/memory.rb +21 -0
- data/lib/r6502/opcode_table.rb +64 -0
- data/r6502.gemspec +13 -0
- data/spec/r6502/assembler_spec.rb +226 -0
- data/spec/r6502/cpu_execution_spec.rb +119 -0
- data/spec/r6502/cpu_instructions_spec.rb +1284 -0
- data/spec/r6502/memory_spec.rb +37 -0
- data/spec/spec_helper.rb +1 -0
- metadata +60 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module R6502
|
4
|
+
describe Memory do
|
5
|
+
it "lets me set and get a value from a location" do
|
6
|
+
memory = Memory.new
|
7
|
+
memory.set(0x00, 0x0a)
|
8
|
+
memory.get(0x00).should == 0x0a
|
9
|
+
end
|
10
|
+
it "truncates values above 0xff" do
|
11
|
+
memory = Memory.new
|
12
|
+
memory.set(0x10, 0xbbaa)
|
13
|
+
memory.get(0x10).should == 0xaa
|
14
|
+
end
|
15
|
+
it "returns 0 for uninitialized memory" do
|
16
|
+
memory = Memory.new
|
17
|
+
memory.get(0x0b).should == 0x00
|
18
|
+
end
|
19
|
+
it "can retrieve two bytes" do
|
20
|
+
memory = Memory.new
|
21
|
+
memory.set(0xf0, 0x01)
|
22
|
+
memory.set(0xf1, 0x02)
|
23
|
+
memory.get_word(0xf0).should == 0x0201
|
24
|
+
|
25
|
+
memory.set(0xfffc, 0x00)
|
26
|
+
memory.set(0xfffd, 0x20)
|
27
|
+
memory.get_word(0xfffc).should == 0x2000
|
28
|
+
end
|
29
|
+
it "can retrieve a range of bytes" do
|
30
|
+
memory = Memory.new
|
31
|
+
memory.set(0x00, 0x0a)
|
32
|
+
memory.set(0x01, 0x0b)
|
33
|
+
memory.set(0x02, 0x0c)
|
34
|
+
memory.get_range(0x00, 0x02).should == [0x0a, 0x0b, 0x0c]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'r6502'
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: r6502
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe Landers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 6502 simulator and assembler, work-in-progress, not cycle-accurate, etc.
|
14
|
+
email: joe@joelanders.net
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
- bin/r6502
|
22
|
+
- lib/r6502.rb
|
23
|
+
- lib/r6502/assembler.rb
|
24
|
+
- lib/r6502/cpu_execution.rb
|
25
|
+
- lib/r6502/cpu_instructions.rb
|
26
|
+
- lib/r6502/instr_table.rb
|
27
|
+
- lib/r6502/memory.rb
|
28
|
+
- lib/r6502/opcode_table.rb
|
29
|
+
- r6502.gemspec
|
30
|
+
- spec/r6502/assembler_spec.rb
|
31
|
+
- spec/r6502/cpu_execution_spec.rb
|
32
|
+
- spec/r6502/cpu_instructions_spec.rb
|
33
|
+
- spec/r6502/memory_spec.rb
|
34
|
+
- spec/spec_helper.rb
|
35
|
+
homepage: https://github.com/joelanders/r6502
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.2.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: 6502 simulator and assembler
|
59
|
+
test_files: []
|
60
|
+
has_rdoc:
|