rubyboy 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/README.md +5 -1
- data/exe/rubyboy +2 -1
- data/lib/rubyboy/bus.rb +3 -5
- data/lib/rubyboy/cartridge/mbc1.rb +0 -2
- data/lib/rubyboy/cpu.rb +0 -1
- data/lib/rubyboy/lcd.rb +2 -1
- data/lib/rubyboy/version.rb +1 -1
- data/lib/rubyboy.rb +9 -4
- data/resource/logo/logo.png +0 -0
- data/resource/logo/logo.svg +1 -0
- metadata +6 -15
- data/lib/rubyboy/operand/direct16.rb +0 -13
- data/lib/rubyboy/operand/direct8.rb +0 -13
- data/lib/rubyboy/operand/hl_dec.rb +0 -11
- data/lib/rubyboy/operand/hl_inc.rb +0 -11
- data/lib/rubyboy/operand/immediate16.rb +0 -13
- data/lib/rubyboy/operand/immediate8.rb +0 -13
- data/lib/rubyboy/operand/indirect.rb +0 -13
- data/lib/rubyboy/operand/register16.rb +0 -13
- data/lib/rubyboy/operand/register8.rb +0 -13
- data/lib/rubyboy/operand.rb +0 -12
- data/lib/rubyboy/register.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 909f97d8e2a7de6573d735d5d949bd7a8533c6096c24f4f74cede36e2c3651bc
|
4
|
+
data.tar.gz: 2a0e0b87e8053143389a6970c910859229ec9001da32f91eb805ea0ebcea6bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01fa425096d955d638c55e2489642d2532af9772c3a78aa1f11797bd952396472e78b0851605e7e81abdf49adc746725fb6c96eee904811b65a4edee74204221
|
7
|
+
data.tar.gz: dc45f065ed0c3e93d14ad190bdb9b0a6947b3634e2907759fe909af61a1d6cdc9acae338955ecaeefa94411aa98847369691f77c1cf242ed8c2ea77e8d0d216e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/exe/rubyboy
CHANGED
data/lib/rubyboy/bus.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'cartridge/factory'
|
4
|
-
|
5
3
|
module Rubyboy
|
6
4
|
class Bus
|
7
|
-
def initialize(ppu, rom, timer, interrupt, joypad)
|
5
|
+
def initialize(ppu, rom, ram, mbc, timer, interrupt, joypad)
|
8
6
|
@ppu = ppu
|
9
7
|
@rom = rom
|
10
|
-
@ram =
|
11
|
-
@mbc =
|
8
|
+
@ram = ram
|
9
|
+
@mbc = mbc
|
12
10
|
@joypad = joypad
|
13
11
|
@interrupt = interrupt
|
14
12
|
@timer = timer
|
data/lib/rubyboy/cpu.rb
CHANGED
data/lib/rubyboy/lcd.rb
CHANGED
@@ -15,6 +15,7 @@ module Rubyboy
|
|
15
15
|
image = GenImageColor(WIDTH, HEIGHT, BLACK)
|
16
16
|
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8
|
17
17
|
@texture = LoadTextureFromImage(image)
|
18
|
+
@vector = Vector2.create(0, 0)
|
18
19
|
end
|
19
20
|
|
20
21
|
def draw(pixel_data)
|
@@ -22,7 +23,7 @@ module Rubyboy
|
|
22
23
|
|
23
24
|
BeginDrawing()
|
24
25
|
ClearBackground(BLACK)
|
25
|
-
DrawTextureEx(@texture,
|
26
|
+
DrawTextureEx(@texture, @vector, 0.0, SCALE, WHITE)
|
26
27
|
EndDrawing()
|
27
28
|
end
|
28
29
|
|
data/lib/rubyboy/version.rb
CHANGED
data/lib/rubyboy.rb
CHANGED
@@ -5,10 +5,12 @@ require_relative 'rubyboy/bus'
|
|
5
5
|
require_relative 'rubyboy/cpu'
|
6
6
|
require_relative 'rubyboy/ppu'
|
7
7
|
require_relative 'rubyboy/rom'
|
8
|
+
require_relative 'rubyboy/ram'
|
8
9
|
require_relative 'rubyboy/timer'
|
9
10
|
require_relative 'rubyboy/lcd'
|
10
11
|
require_relative 'rubyboy/joypad'
|
11
12
|
require_relative 'rubyboy/interrupt'
|
13
|
+
require_relative 'rubyboy/cartridge/factory'
|
12
14
|
|
13
15
|
module Rubyboy
|
14
16
|
class Console
|
@@ -18,11 +20,13 @@ module Rubyboy
|
|
18
20
|
load_raylib
|
19
21
|
rom_data = File.open(rom_path, 'r') { _1.read.bytes }
|
20
22
|
rom = Rom.new(rom_data)
|
23
|
+
ram = Ram.new
|
24
|
+
mbc = Cartridge::Factory.create(rom, ram)
|
21
25
|
interrupt = Interrupt.new
|
22
26
|
@ppu = Ppu.new(interrupt)
|
23
27
|
@timer = Timer.new(interrupt)
|
24
28
|
@joypad = Joypad.new(interrupt)
|
25
|
-
@bus = Bus.new(@ppu, rom, @timer, interrupt, @joypad)
|
29
|
+
@bus = Bus.new(@ppu, rom, ram, mbc, @timer, interrupt, @joypad)
|
26
30
|
@cpu = Cpu.new(@bus, interrupt)
|
27
31
|
@lcd = Lcd.new
|
28
32
|
end
|
@@ -65,9 +69,9 @@ module Rubyboy
|
|
65
69
|
end
|
66
70
|
|
67
71
|
def buffer_to_pixel_data(buffer)
|
68
|
-
buffer.
|
72
|
+
buffer.flat_map do |row|
|
69
73
|
[row, row, row]
|
70
|
-
end.
|
74
|
+
end.pack('C*')
|
71
75
|
end
|
72
76
|
|
73
77
|
def key_input_check
|
@@ -83,7 +87,8 @@ module Rubyboy
|
|
83
87
|
when /mswin|msys|mingw/ # Windows
|
84
88
|
Raylib.load_lib("#{shared_lib_path}libraylib.dll")
|
85
89
|
when /darwin/ # macOS
|
86
|
-
|
90
|
+
arch = RUBY_PLATFORM.split('-')[0]
|
91
|
+
Raylib.load_lib(shared_lib_path + "libraylib.#{arch}.dylib")
|
87
92
|
when /linux/ # Ubuntu Linux (x86_64 or aarch64)
|
88
93
|
arch = RUBY_PLATFORM.split('-')[0]
|
89
94
|
Raylib.load_lib(shared_lib_path + "libraylib.#{arch}.so")
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="467" height="75" viewBox="0 0 467 75"><path fill="#cc342d" d="M25.40 46.45L21.75 46.45L18.40 73.65L2.20 73.65L11.10 0.80L33.20 0.80Q39.90 0.80 44.63 2.23Q49.35 3.65 52.35 6.15Q55.35 8.65 56.73 12.08Q58.10 15.50 58.10 19.50L58.10 19.50Q58.10 23.55 57.03 27.15Q55.95 30.75 53.90 33.78Q51.85 36.80 48.88 39.13Q45.90 41.45 42.10 42.95L42.10 42.95Q43.60 43.80 44.93 45Q46.25 46.20 47 48L47 48L57.60 73.65L42.90 73.65Q40.85 73.65 39.45 72.85Q38.05 72.05 37.50 70.55L37.50 70.55L29.60 49Q29.05 47.60 28.13 47.03Q27.20 46.45 25.40 46.45L25.40 46.45ZM31.70 12.95L25.90 12.95L23.15 35.20L29.10 35.20Q32.60 35.20 35.05 34.13Q37.50 33.05 39.03 31.25Q40.55 29.45 41.23 27.05Q41.90 24.65 41.90 22L41.90 22Q41.90 19.95 41.30 18.28Q40.70 16.60 39.43 15.43Q38.15 14.25 36.23 13.60Q34.30 12.95 31.70 12.95L31.70 12.95ZM90.40 60.85L90.40 60.85Q93.45 60.85 95.95 59.68Q98.45 58.50 100.35 56.33Q102.25 54.15 103.50 51.05Q104.75 47.95 105.20 44.10L105.20 44.10L110.50 0.80L126.80 0.80L121.50 44.10Q120.65 50.75 117.98 56.33Q115.30 61.90 111.03 65.93Q106.75 69.95 101.10 72.20Q95.45 74.45 88.70 74.45L88.70 74.45Q82.60 74.45 77.83 72.60Q73.05 70.75 69.78 67.38Q66.50 64 64.80 59.30Q63.10 54.60 63.10 48.95L63.10 48.95Q63.10 46.60 63.40 44.10L63.40 44.10L68.60 0.80L84.90 0.80L79.60 44.10Q79.50 45 79.45 45.88Q79.40 46.75 79.40 47.60L79.40 47.60Q79.40 53.80 82.23 57.33Q85.05 60.85 90.40 60.85ZM154.50 73.65L127.30 73.65L136.30 0.80L161.30 0.80Q167.65 0.80 172.18 2Q176.70 3.20 179.58 5.42Q182.45 7.65 183.78 10.78Q185.10 13.90 185.10 17.70L185.10 17.70Q185.10 20.70 184.33 23.48Q183.55 26.25 181.88 28.60Q180.20 30.95 177.55 32.88Q174.90 34.80 171.15 36.10L171.15 36.10Q177.05 37.70 179.88 41.08Q182.70 44.45 182.70 49.60L182.70 49.60Q182.70 54.65 180.78 59.03Q178.85 63.40 175.20 66.65Q171.55 69.90 166.33 71.78Q161.10 73.65 154.50 73.65L154.50 73.65ZM157.90 42.55L147.40 42.55L145.10 61.40L155.80 61.40Q158.80 61.40 160.85 60.53Q162.90 59.65 164.18 58.08Q165.45 56.50 166.03 54.40Q166.60 52.30 166.60 49.80L166.60 49.80Q166.60 48.15 166.18 46.80Q165.75 45.45 164.73 44.53Q163.70 43.60 162.03 43.08Q160.35 42.55 157.90 42.55L157.90 42.55ZM151 12.95L148.70 31.75L156.50 31.75Q159.25 31.75 161.45 31.20Q163.65 30.65 165.23 29.33Q166.80 28 167.65 25.80Q168.50 23.60 168.50 20.35L168.50 20.35Q168.50 16.30 166.38 14.63Q164.25 12.95 159.80 12.95L159.80 12.95L151 12.95ZM255.30 0.80L225.45 45.75L222 73.65L205.70 73.65L209.15 45.90L190.40 0.80L204.90 0.80Q207 0.80 208.18 1.78Q209.35 2.75 209.90 4.35L209.90 4.35L216.90 26.40Q217.60 28.60 218.18 30.65Q218.75 32.70 219.15 34.60L219.15 34.60Q220.10 32.70 221.25 30.68Q222.40 28.65 223.70 26.40L223.70 26.40L236.10 4.35Q236.85 3 238.30 1.90Q239.75 0.80 241.80 0.80L241.80 0.80L255.30 0.80ZM297 73.65L269.80 73.65L278.80 0.80L303.80 0.80Q310.15 0.80 314.68 2Q319.20 3.20 322.08 5.42Q324.95 7.65 326.28 10.78Q327.60 13.90 327.60 17.70L327.60 17.70Q327.60 20.70 326.83 23.48Q326.05 26.25 324.38 28.60Q322.70 30.95 320.05 32.88Q317.40 34.80 313.65 36.10L313.65 36.10Q319.55 37.70 322.38 41.08Q325.20 44.45 325.20 49.60L325.20 49.60Q325.20 54.65 323.28 59.03Q321.35 63.40 317.70 66.65Q314.05 69.90 308.83 71.78Q303.60 73.65 297 73.65L297 73.65ZM300.40 42.55L289.90 42.55L287.60 61.40L298.30 61.40Q301.30 61.40 303.35 60.53Q305.40 59.65 306.68 58.08Q307.95 56.50 308.53 54.40Q309.10 52.30 309.10 49.80L309.10 49.80Q309.10 48.15 308.68 46.80Q308.25 45.45 307.23 44.53Q306.20 43.60 304.53 43.08Q302.85 42.55 300.40 42.55L300.40 42.55ZM293.50 12.95L291.20 31.75L299 31.75Q301.75 31.75 303.95 31.20Q306.15 30.65 307.73 29.33Q309.30 28 310.15 25.80Q311 23.60 311 20.35L311 20.35Q311 16.30 308.88 14.63Q306.75 12.95 302.30 12.95L302.30 12.95L293.50 12.95ZM401.40 32.55L401.40 32.55Q401.40 38.45 400.02 43.85Q398.65 49.25 396.13 53.90Q393.60 58.55 390.02 62.35Q386.45 66.15 382 68.83Q377.55 71.50 372.35 72.98Q367.15 74.45 361.40 74.45L361.40 74.45Q354.20 74.45 348.48 71.93Q342.75 69.40 338.75 65.03Q334.75 60.65 332.63 54.73Q330.50 48.80 330.50 41.95L330.50 41.95Q330.50 36.05 331.88 30.63Q333.25 25.20 335.77 20.55Q338.30 15.90 341.90 12.10Q345.50 8.30 349.95 5.63Q354.40 2.95 359.60 1.48Q364.80 0 370.60 0L370.60 0Q377.75 0 383.48 2.53Q389.20 5.05 393.18 9.45Q397.15 13.85 399.27 19.80Q401.40 25.75 401.40 32.55ZM384.70 32.95L384.70 32.95Q384.70 28.45 383.63 24.78Q382.55 21.10 380.48 18.48Q378.40 15.85 375.40 14.43Q372.40 13 368.60 13L368.60 13Q363.60 13 359.65 15.08Q355.70 17.15 352.93 20.90Q350.15 24.65 348.68 29.93Q347.20 35.20 347.20 41.60L347.20 41.60Q347.20 46.10 348.25 49.75Q349.30 53.40 351.32 56Q353.35 58.60 356.35 60.03Q359.35 61.45 363.20 61.45L363.20 61.45Q368.20 61.45 372.18 59.40Q376.15 57.35 378.93 53.60Q381.70 49.85 383.20 44.60Q384.70 39.35 384.70 32.95ZM467 0.80L437.15 45.75L433.70 73.65L417.40 73.65L420.85 45.90L402.10 0.80L416.60 0.80Q418.70 0.80 419.88 1.78Q421.05 2.75 421.60 4.35L421.60 4.35L428.60 26.40Q429.30 28.60 429.88 30.65Q430.45 32.70 430.85 34.60L430.85 34.60Q431.80 32.70 432.95 30.68Q434.10 28.65 435.40 26.40L435.40 26.40L447.80 4.35Q448.55 3 450 1.90Q451.45 0.80 453.50 0.80L453.50 0.80L467 0.80Z"></path></svg>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sacckey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raylib-bindings
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
executables:
|
@@ -69,23 +69,14 @@ files:
|
|
69
69
|
- lib/rubyboy/interrupt.rb
|
70
70
|
- lib/rubyboy/joypad.rb
|
71
71
|
- lib/rubyboy/lcd.rb
|
72
|
-
- lib/rubyboy/operand.rb
|
73
|
-
- lib/rubyboy/operand/direct16.rb
|
74
|
-
- lib/rubyboy/operand/direct8.rb
|
75
|
-
- lib/rubyboy/operand/hl_dec.rb
|
76
|
-
- lib/rubyboy/operand/hl_inc.rb
|
77
|
-
- lib/rubyboy/operand/immediate16.rb
|
78
|
-
- lib/rubyboy/operand/immediate8.rb
|
79
|
-
- lib/rubyboy/operand/indirect.rb
|
80
|
-
- lib/rubyboy/operand/register16.rb
|
81
|
-
- lib/rubyboy/operand/register8.rb
|
82
72
|
- lib/rubyboy/ppu.rb
|
83
73
|
- lib/rubyboy/ram.rb
|
84
|
-
- lib/rubyboy/register.rb
|
85
74
|
- lib/rubyboy/registers.rb
|
86
75
|
- lib/rubyboy/rom.rb
|
87
76
|
- lib/rubyboy/timer.rb
|
88
77
|
- lib/rubyboy/version.rb
|
78
|
+
- resource/logo/logo.png
|
79
|
+
- resource/logo/logo.svg
|
89
80
|
- sig/rubyboy.rbs
|
90
81
|
homepage: https://github.com/sacckey/rubyboy
|
91
82
|
licenses:
|
data/lib/rubyboy/operand.rb
DELETED
data/lib/rubyboy/register.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rubyboy
|
4
|
-
class Register
|
5
|
-
attr_reader :value
|
6
|
-
|
7
|
-
def initialize(name:, value:)
|
8
|
-
@name = name
|
9
|
-
@value = value
|
10
|
-
end
|
11
|
-
|
12
|
-
def value=(v)
|
13
|
-
@value = v & 0xff
|
14
|
-
end
|
15
|
-
|
16
|
-
def increment
|
17
|
-
@value = (@value + 1) & 0xff
|
18
|
-
end
|
19
|
-
|
20
|
-
def decrement
|
21
|
-
@value = (@value - 1) & 0xff
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|