Class: Rubyboy::Cartridge::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyboy/cartridge/factory.rb

Class Method Summary collapse

Class Method Details

.create(rom, ram) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rubyboy/cartridge/factory.rb', line 9

def self.create(rom, ram)
  case rom.cartridge_type
  when 0x00
    Nombc.new(rom)
  when 0x01..0x03
    Mbc1.new(rom, ram)
  when 0x08..0x09
    Nombc.new(rom)
  else
    raise "Unsupported cartridge type: #{rom.cartridge_type}"
  end
end