GBRb 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c3fcd2009ea0e3f6548923ab1562f454aa3751bb
4
+ data.tar.gz: 8c24ac86db2039d3c0523685a759303d40f99180
5
+ SHA512:
6
+ metadata.gz: a39fdbc706d100e663b9ee04d1cf4341b1675114d5d772230029ea41bdd525ac7cea164d559c1b24ab208b4bd3403fb64a1f3d4e46cc5ce1fe18dd1e4a944bc8
7
+ data.tar.gz: 8cd264c566d7c386b25939a0d5ed8cce0923e2a0688b67c133715b9765c67137662efdf7845cd04dac5bf559e8917ca48cf158b0608cd43393ebed4f7e29950f
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gbrb.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Casey Robinson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # GBRb
2
+ __This project is a work in progress and nowhere near complete.__
3
+
4
+ [Nintendo Game Boy](http://en.wikipedia.org/wiki/Game_Boy) emulator written in Ruby.
5
+
6
+ ## FAQ
7
+ ### How can I get it?
8
+ Clone the repository (directions are provided in the right sidebar) for the latest version.
9
+
10
+ Packaged releases are available through [Ruby Gems](https://rubygems.org/). Simply type `gem install GBRb`
11
+
12
+ ### How do I run it?
13
+ Just point GBRb to the location of your ROM and have fun.
14
+
15
+ `gbrb ~/location/to/my/romfile.gb`
16
+
17
+ ### How can I contribute?
18
+ 1. Select an [issue](https://github.com/rampantmonkey/GBRb/issues).
19
+ 2. [Fork](https://github.com/rampantmonkey/GBRb/fork) this repository.
20
+ 3. Create a bugfix branch (`git checkout -b my-issue-fix`)
21
+ 4. Commit your changes (`git commit -am "Fixed some bug"`)
22
+ 5. Push the branch (`git push origin my-issue-fix`)
23
+ 6. Create a new Pull Request
24
+
25
+ ### Where can I learn about Game Boy emulation?
26
+ Nintendo's Game Boy is well documented across the internet and a quick search will turn up many useful results.
27
+ Or you can save some time and visit the [wiki](https://github.com/rampantmonkey/GBRb/wiki) which has links to my research.
28
+
29
+ ## Code Status
30
+ [![Build Status](https://travis-ci.org/rampantmonkey/GBRb.png?branch=master)](https://travis-ci.org/rampantmonkey/GBRb)[![Code Climate](https://codeclimate.com/github/rampantmonkey/GBRb.png)](https://codeclimate.com/github/rampantmonkey/GBRb)[![Coverage Status](https://coveralls.io/repos/rampantmonkey/GBRb/badge.png)](https://coveralls.io/r/rampantmonkey/GBRb)
31
+
32
+ ## Progress
33
+ ![Boot Sequence which displays the Nintendo Logo](https://github.com/rampantmonkey/GBRb/raw/master/doc/images/nintendo_logo.png) 
34
+
35
+ ## Roadmap
36
+ - Improve Performance
37
+ - Input
38
+ - Support games which use Memory Bank Controllers
39
+ - Sound
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/display ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'gbrb/graphics/screen_server'
6
+
7
+ screen = GBRb::Graphics::ScreenServer.new
8
+ screen.power_on
9
+
data/bin/gbrb ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'gbrb/gb'
6
+
7
+ cartridge = ARGV.length == 0 ? '' : ARGV.first
8
+ debug = ARGV.length > 1 and ARGV[1] == '-D'
9
+
10
+ gameboy = GBRb::GB.new cartridge, debug
11
+ gameboy.power_on
12
+
data/gbrb.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gbrb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "GBRb"
8
+ spec.version = GBRb::VERSION
9
+ spec.authors = ["Casey Robinson"]
10
+ spec.email = ["kc@rampantmonkey.com"]
11
+ spec.summary = %q{Nintendo Game Boy Emulator}
12
+ spec.homepage = "http://rampantmonkey.github.io/GBRb"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = "~> 2.0.0"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec", "~> 2.14"
25
+ spec.add_development_dependency "coveralls", "~> 0.6"
26
+ end
data/lib/gbrb.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "gbrb/version"
2
+ require "gbrb/cpu"
3
+ require "gbrb/mmu"
4
+
5
+ module GBRb
6
+ MEMORY_BANK_SIZE = 0x4000
7
+
8
+ class InvalidCartridge < StandardError; end
9
+ end
data/lib/gbrb/bios ADDED
@@ -0,0 +1,256 @@
1
+ 0x31
2
+ 0xFE
3
+ 0xFF
4
+ 0xAF
5
+ 0x21
6
+ 0xFF
7
+ 0x9F
8
+ 0x32
9
+ 0xCB
10
+ 0x7C
11
+ 0x20
12
+ 0xFB
13
+ 0x21
14
+ 0x26
15
+ 0xFF
16
+ 0x0E
17
+ 0x11
18
+ 0x3E
19
+ 0x80
20
+ 0x32
21
+ 0xE2
22
+ 0x0C
23
+ 0x3E
24
+ 0xF3
25
+ 0xE2
26
+ 0x32
27
+ 0x3E
28
+ 0x77
29
+ 0x77
30
+ 0x3E
31
+ 0xFC
32
+ 0xE0
33
+ 0x47
34
+ 0x11
35
+ 0x04
36
+ 0x01
37
+ 0x21
38
+ 0x10
39
+ 0x80
40
+ 0x1A
41
+ 0xCD
42
+ 0x95
43
+ 0x00
44
+ 0xCD
45
+ 0x96
46
+ 0x00
47
+ 0x13
48
+ 0x7B
49
+ 0xFE
50
+ 0x34
51
+ 0x20
52
+ 0xF3
53
+ 0x11
54
+ 0xD8
55
+ 0x00
56
+ 0x06
57
+ 0x08
58
+ 0x1A
59
+ 0x13
60
+ 0x22
61
+ 0x23
62
+ 0x05
63
+ 0x20
64
+ 0xF9
65
+ 0x3E
66
+ 0x19
67
+ 0xEA
68
+ 0x10
69
+ 0x99
70
+ 0x21
71
+ 0x2F
72
+ 0x99
73
+ 0x0E
74
+ 0x0C
75
+ 0x3D
76
+ 0x28
77
+ 0x08
78
+ 0x32
79
+ 0x0D
80
+ 0x20
81
+ 0xF9
82
+ 0x2E
83
+ 0x0F
84
+ 0x18
85
+ 0xF3
86
+ 0x67
87
+ 0x3E
88
+ 0x64
89
+ 0x57
90
+ 0xE0
91
+ 0x42
92
+ 0x3E
93
+ 0x91
94
+ 0xE0
95
+ 0x40
96
+ 0x04
97
+ 0x1E
98
+ 0x02
99
+ 0x0E
100
+ 0x0C
101
+ 0xF0
102
+ 0x44
103
+ 0xFE
104
+ 0x90
105
+ 0x20
106
+ 0xFA
107
+ 0x0D
108
+ 0x20
109
+ 0xF7
110
+ 0x1D
111
+ 0x20
112
+ 0xF2
113
+ 0x0E
114
+ 0x13
115
+ 0x24
116
+ 0x7C
117
+ 0x1E
118
+ 0x83
119
+ 0xFE
120
+ 0x62
121
+ 0x28
122
+ 0x06
123
+ 0x1E
124
+ 0xC1
125
+ 0xFE
126
+ 0x64
127
+ 0x20
128
+ 0x06
129
+ 0x7B
130
+ 0xE2
131
+ 0x0C
132
+ 0x3E
133
+ 0x87
134
+ 0xF2
135
+ 0xF0
136
+ 0x42
137
+ 0x90
138
+ 0xE0
139
+ 0x42
140
+ 0x15
141
+ 0x20
142
+ 0xD2
143
+ 0x05
144
+ 0x20
145
+ 0x4F
146
+ 0x16
147
+ 0x20
148
+ 0x18
149
+ 0xCB
150
+ 0x4F
151
+ 0x06
152
+ 0x04
153
+ 0xC5
154
+ 0xCB
155
+ 0x11
156
+ 0x17
157
+ 0xC1
158
+ 0xCB
159
+ 0x11
160
+ 0x17
161
+ 0x05
162
+ 0x20
163
+ 0xF5
164
+ 0x22
165
+ 0x23
166
+ 0x22
167
+ 0x23
168
+ 0xC9
169
+ 0xCE
170
+ 0xED
171
+ 0x66
172
+ 0x66
173
+ 0xCC
174
+ 0x0D
175
+ 0x00
176
+ 0x0B
177
+ 0x03
178
+ 0x73
179
+ 0x00
180
+ 0x83
181
+ 0x00
182
+ 0x0C
183
+ 0x00
184
+ 0x0D
185
+ 0x00
186
+ 0x08
187
+ 0x11
188
+ 0x1F
189
+ 0x88
190
+ 0x89
191
+ 0x00
192
+ 0x0E
193
+ 0xDC
194
+ 0xCC
195
+ 0x6E
196
+ 0xE6
197
+ 0xDD
198
+ 0xDD
199
+ 0xD9
200
+ 0x99
201
+ 0xBB
202
+ 0xBB
203
+ 0x67
204
+ 0x63
205
+ 0x6E
206
+ 0x0E
207
+ 0xEC
208
+ 0xCC
209
+ 0xDD
210
+ 0xDC
211
+ 0x99
212
+ 0x9F
213
+ 0xBB
214
+ 0xB9
215
+ 0x33
216
+ 0x3E
217
+ 0x3c
218
+ 0x42
219
+ 0xB9
220
+ 0xA5
221
+ 0xB9
222
+ 0xA5
223
+ 0x42
224
+ 0x4C
225
+ 0x21
226
+ 0x04
227
+ 0x01
228
+ 0x11
229
+ 0xA8
230
+ 0x00
231
+ 0x1A
232
+ 0x13
233
+ 0xBE
234
+ 0x20
235
+ 0xFE
236
+ 0x23
237
+ 0x7D
238
+ 0xFE
239
+ 0x34
240
+ 0x20
241
+ 0xF5
242
+ 0x06
243
+ 0x19
244
+ 0x78
245
+ 0x86
246
+ 0x23
247
+ 0x05
248
+ 0x20
249
+ 0xFB
250
+ 0x86
251
+ 0x20
252
+ 0xFE
253
+ 0x3E
254
+ 0x11
255
+ 0xE0
256
+ 0x50
@@ -0,0 +1,15 @@
1
+ require_relative '../gbrb'
2
+
3
+ require 'pathname'
4
+
5
+ module GBRb
6
+ class Cartridge
7
+ def initialize raw_data
8
+ @banks = raw_data.read.each_byte.each_slice(MEMORY_BANK_SIZE).to_a
9
+ end
10
+
11
+ def bank number=0
12
+ @banks.fetch(number) { Array.new MEMORY_BANK_SIZE, 0 }
13
+ end
14
+ end
15
+ end