mos6510 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +20 -18
- data/README.md +4 -3
- data/lib/mos6510/cpu.rb +18 -31
- data/lib/mos6510/jssid_mos6510.rb +893 -0
- data/lib/mos6510/version.rb +1 -1
- data/lib/mos6510.rb +1 -0
- data/mos6510.gemspec +2 -2
- metadata +20 -20
- data/lib/mos6510/jssid.mos6510.js +0 -946
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba8bdd4a50128bae8029b543930ac001d3d458667d42cca6fdfa98dd3e6428ee
|
4
|
+
data.tar.gz: fe874fe7083bff2b5478f3bbef3055fb7bb011615372c702db062b34ecaf9519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8baadc0f4cf8e047a3de48c943554dead32df7cf866dc52814bb38fb0ec88a07513557b1ed19e577d71bc950de01b3a653fd9a190bc034ca6b5367d29c87807b
|
7
|
+
data.tar.gz: 18e83005a3aa7ae75dbf630331edfae281ac0cd6d187b890922e30fb9fb276cefbce926caee9e3833ac54a41f219d6decf5643f6a79be9cf2cff8b70fcc1f9b5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mos6510 (0.1.
|
5
|
-
mini_racer (~> 0.3.1)
|
4
|
+
mos6510 (0.1.3)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
coderay (1.1.3)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
method_source (1.0.0)
|
12
|
+
pry (0.14.1)
|
13
|
+
coderay (~> 1.1)
|
14
|
+
method_source (~> 1.0)
|
14
15
|
rake (10.5.0)
|
15
|
-
rspec (3.
|
16
|
-
rspec-core (~> 3.
|
17
|
-
rspec-expectations (~> 3.
|
18
|
-
rspec-mocks (~> 3.
|
19
|
-
rspec-core (3.
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-expectations (3.
|
16
|
+
rspec (3.11.0)
|
17
|
+
rspec-core (~> 3.11.0)
|
18
|
+
rspec-expectations (~> 3.11.0)
|
19
|
+
rspec-mocks (~> 3.11.0)
|
20
|
+
rspec-core (3.11.0)
|
21
|
+
rspec-support (~> 3.11.0)
|
22
|
+
rspec-expectations (3.11.0)
|
22
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-mocks (3.
|
24
|
+
rspec-support (~> 3.11.0)
|
25
|
+
rspec-mocks (3.11.1)
|
25
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-support (3.
|
27
|
+
rspec-support (~> 3.11.0)
|
28
|
+
rspec-support (3.11.0)
|
28
29
|
|
29
30
|
PLATFORMS
|
30
31
|
ruby
|
@@ -32,8 +33,9 @@ PLATFORMS
|
|
32
33
|
DEPENDENCIES
|
33
34
|
bundler (~> 2.0)
|
34
35
|
mos6510!
|
36
|
+
pry (~> 0.14)
|
35
37
|
rake (~> 10.0)
|
36
|
-
rspec (~> 3.
|
38
|
+
rspec (~> 3.11)
|
37
39
|
|
38
40
|
BUNDLED WITH
|
39
41
|
2.1.4
|
data/README.md
CHANGED
@@ -7,9 +7,10 @@ Additionally, the gem allows you to supply an object which simulates the SID pro
|
|
7
7
|
(Sound Interface Device - the sound chip from the Commodore 64). This object will receive
|
8
8
|
`poke` calls whenever the simulated program writes to the addresses mapped to the SID.
|
9
9
|
|
10
|
-
Be warned: This
|
11
|
-
|
12
|
-
|
10
|
+
Be warned: This is just a very raw conversion of a JavaScript implementation stolen (*)
|
11
|
+
from the [jsSID](https://github.com/jhohertz/jsSID) project. It has bugs, probably
|
12
|
+
because of my conversion. I'd love fix this one day, but just needed a MOS 6510 emulator
|
13
|
+
for another project.
|
13
14
|
|
14
15
|
(*) This explains the GPL v2 license of this project.
|
15
16
|
|
data/lib/mos6510/cpu.rb
CHANGED
@@ -1,51 +1,38 @@
|
|
1
|
-
require 'mini_racer'
|
2
|
-
|
3
1
|
module Mos6510
|
4
2
|
class Cpu
|
5
3
|
def initialize(sid: nil)
|
6
|
-
@
|
7
|
-
|
8
|
-
# Just define the name space used by the main mos6510 emulator
|
9
|
-
@context.eval 'function jsSID() {}'
|
10
|
-
|
11
|
-
@context.load(File.join(__dir__, 'jssid.mos6510.js'))
|
12
|
-
|
13
|
-
@context.eval <<~EOS
|
14
|
-
var memory = new Array(65536);
|
15
|
-
for(var i=0; i<65536; i++) {
|
16
|
-
memory[i]=0;
|
17
|
-
}
|
18
|
-
var sid = null;
|
19
|
-
EOS
|
20
|
-
|
21
|
-
if sid
|
22
|
-
@context.attach("sidPoke", proc{ |address, value| sid.poke(address, value) })
|
23
|
-
@context.eval <<~EOS
|
24
|
-
sid = {
|
25
|
-
poke: function(address, value) { sidPoke(address, value); }
|
26
|
-
};
|
27
|
-
EOS
|
28
|
-
end
|
4
|
+
@memory = [0] * 65536
|
5
|
+
@sid = sid
|
29
6
|
end
|
30
7
|
|
31
8
|
def load(bytes, from: 0)
|
32
9
|
bytes.each_with_index do |byte, index|
|
33
|
-
@
|
10
|
+
@memory[from + index] = byte
|
34
11
|
end
|
35
12
|
end
|
36
13
|
|
37
14
|
def start
|
38
|
-
@
|
39
|
-
var cpu = new jsSID.MOS6510(memory, sid);
|
40
|
-
EOS
|
15
|
+
@cpu = Mos6510.new(@memory, sid: @sid)
|
41
16
|
end
|
42
17
|
|
43
18
|
def jsr(address, accumulator_value=0)
|
44
|
-
@
|
19
|
+
@cpu.jsr(address, accumulator_value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def step
|
23
|
+
@cpu.step
|
24
|
+
end
|
25
|
+
|
26
|
+
def pc
|
27
|
+
@cpu.pc
|
28
|
+
end
|
29
|
+
|
30
|
+
def pc=(new_pc)
|
31
|
+
@cpu.pc = new_pc
|
45
32
|
end
|
46
33
|
|
47
34
|
def peek(address)
|
48
|
-
@
|
35
|
+
@cpu.getmem(address)
|
49
36
|
end
|
50
37
|
end
|
51
38
|
end
|