Class: Amaterasu::GameBoy::Ppu::Modes::Disabled

Inherits:
Object
  • Object
show all
Defined in:
lib/amaterasu/game_boy/ppu/modes/disabled.rb

Overview

Defines the behavior of the PPU when LCD Control Bit 7 is 0.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ppu) ⇒ Disabled

Returns a new instance of Disabled.



11
12
13
14
15
16
17
# File 'lib/amaterasu/game_boy/ppu/modes/disabled.rb', line 11

def initialize(ppu)
  @ppu = ppu
  @lcd_control = @ppu.registers.lcdc

  @name = 'DISABLED'
  @number = 0
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/amaterasu/game_boy/ppu/modes/disabled.rb', line 9

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



9
10
11
# File 'lib/amaterasu/game_boy/ppu/modes/disabled.rb', line 9

def number
  @number
end

Instance Method Details

#tickObject



19
20
21
22
23
24
# File 'lib/amaterasu/game_boy/ppu/modes/disabled.rb', line 19

def tick
  return unless @lcd_control.lcd_enabled?

  @ppu.reset_states
  @ppu.set_mode(:oam_scan)
end