Class: Amaterasu::GameBoy::Ppu::Modes::HBlank
- Inherits:
-
Object
- Object
- Amaterasu::GameBoy::Ppu::Modes::HBlank
- Defined in:
- lib/amaterasu/game_boy/ppu/modes/h_blank.rb
Overview
Defines the behavior of the Ppu during HBlank mode.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(ppu) ⇒ HBlank
constructor
A new instance of HBlank.
- #inspect ⇒ Object
- #tick ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(ppu) ⇒ HBlank
Returns a new instance of HBlank.
11 12 13 14 15 16 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 11 def initialize(ppu) @ppu = ppu @name = 'HBLANK' @number = 0 end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 9 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 9 def number @number end |
Instance Method Details
#inspect ⇒ Object
32 33 34 35 36 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 32 def inspect '#<Amaterasu::GameBoy::Ppu::Modes::HBlank ' \ "@name='#{@name}' " \ "@number=#{@number} " end |
#tick ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 18 def tick return unless @ppu.dots == DOTS_PER_SCANLINE @ppu.reset_for_scanline @ppu.increment_ly if @ppu.registers.ly < VISIBLE_SCANLINES @ppu.set_mode(:oam_scan) elsif @ppu.registers.ly == VISIBLE_SCANLINES @ppu.set_mode(:v_blank) @ppu.request_interrupt(:v_blank) end end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/amaterasu/game_boy/ppu/modes/h_blank.rb', line 38 def to_s "#{@name} (##{@number}) | WAITING FOR SCANLINE TO FINISH" end |