rubyboy 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08c5c68c0375707dcc850da2776897f0fd9d5d185b917f50215dcea7bbfcd70c'
4
- data.tar.gz: 23e385a235a8179006ac286b31e737c205854eb8564204d220fc7a867c637ac4
3
+ metadata.gz: f71c49ce8d91b143c346ea5ac3534d531faa1d7ed7fc886243ed77e9e76e31b7
4
+ data.tar.gz: c9211303e89f8d775fb8c083a0eb3ab97e2299e41722b6c461bfac0cc9ea94ac
5
5
  SHA512:
6
- metadata.gz: 7cf0e5a59a76982a5bbff640d555a0f240ff980b4706a943cb8566cc3d4974b33dfdb2502499d457c66a2165bd5ace339bf68e69cb762f7ee9b4b9a5ba54186d
7
- data.tar.gz: 9f96dc6441947295ec6fbc28e55dd9066de2a82de3ec1dc0c6ea82cac5aa956024bc0f3e8f3cc2038aef3b7def0dc363404d8dbec8224bbb3d70cd6ca8f3e3d2
6
+ metadata.gz: 76374e3846dc6a917a0dda34b71f6c667155cd5458bbb70ab0fba1ae16a8e5482153808e4de64aa8670d958a69ec52625e5f41673a04780d2b063b35c1564606
7
+ data.tar.gz: a3354719d960846738a7cb9252afa1a86fa0c3a2a0d3529013808386ab8a5aaa4a08ebc132cefed02353e20c4193f96804620031a79b6ca324c1e01ed5b8f12f
data/.rubocop.yml CHANGED
@@ -40,3 +40,6 @@ Style/FormatString:
40
40
 
41
41
  Style/NumericLiterals:
42
42
  Enabled: false
43
+
44
+ Style/NumericPredicate:
45
+ EnforcedStyle: comparison
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2023-12-28
4
+
5
+ - Add bench option
6
+ - Improve speed by refactoring
7
+
3
8
  ## [1.0.0] - 2023-12-04
4
9
 
5
10
  - Fix halt and timer
data/exe/rubyboy CHANGED
@@ -2,6 +2,16 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'rubyboy'
5
+ require 'bench'
5
6
 
6
- rom_path = ARGV[0]
7
- Rubyboy::Console.new(rom_path).start
7
+ arg = ARGV[0]
8
+
9
+ puts "yjit: #{RubyVM::YJIT.enabled?}"
10
+
11
+ if arg == 'bench'
12
+ Rubyboy::Bench.new.bench
13
+ elsif arg == 'stackprof'
14
+ Rubyboy::Bench.new.stackprof
15
+ else
16
+ Rubyboy::Console.new(arg).start
17
+ end
data/lib/bench.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'stackprof'
4
+ require_relative 'rubyboy'
5
+
6
+ module Rubyboy
7
+ class Bench
8
+ def stackprof
9
+ StackProf.run(mode: :cpu, out: 'stackprof-cpu-myapp.dump', raw: true) do
10
+ Rubyboy::Console.new('lib/roms/tobu.gb').bench
11
+ end
12
+ end
13
+
14
+ def bench
15
+ bench_cnt = 3
16
+ time_sum = 0
17
+ bench_cnt.times do |i|
18
+ time = Rubyboy::Console.new('lib/roms/tobu.gb').bench
19
+ time_sum += time
20
+ puts "#{i + 1}: #{time} sec"
21
+ end
22
+
23
+ puts "FPS: #{1500 * bench_cnt / time_sum}"
24
+ end
25
+ end
26
+ end
@@ -41,7 +41,7 @@ module Rubyboy
41
41
  @ram_enable = value & 0x0f == 0x0a
42
42
  when 0x2000..0x3fff
43
43
  @rom_bank = value & 0x1f
44
- @rom_bank = 1 if @rom_bank.zero?
44
+ @rom_bank = 1 if @rom_bank == 0
45
45
  when 0x4000..0x5fff
46
46
  @ram_bank = value & 0x03
47
47
  when 0x6000..0x7fff