Class: Amaterasu::GameBoy::Oam
- Defined in:
- lib/amaterasu/game_boy/oam.rb,
lib/amaterasu/game_boy/oam/sprite.rb
Overview
Models the OAM (Object Attribute Memory) from the DMG Game Boy.
Defined Under Namespace
Classes: Sprite
Constant Summary collapse
- START_ADDRESS =
0xFE00- END_ADDRESS =
0xFE9F- SPRITE_ENTRIES =
40- SIZE =
> 160 bytes
(END_ADDRESS - START_ADDRESS) + 1
Instance Attribute Summary
Attributes inherited from Ram
Instance Method Summary collapse
- #each_sprite ⇒ Object
-
#initialize ⇒ Oam
constructor
A new instance of Oam.
- #sprite(index) ⇒ Object
Methods inherited from Ram
#disk_size, #read_backup, #read_byte, #restore_data, #save_data, #wipe_backup, #wipe_data, #write_byte
Constructor Details
#initialize ⇒ Oam
Returns a new instance of Oam.
12 13 14 15 16 17 18 |
# File 'lib/amaterasu/game_boy/oam.rb', line 12 def initialize super(size: SIZE, offset: START_ADDRESS) @sprites = Array.new(SPRITE_ENTRIES) do |sprite_index| Sprite.new(oam_data: @data, index: sprite_index) end end |
Instance Method Details
#each_sprite ⇒ Object
24 25 26 |
# File 'lib/amaterasu/game_boy/oam.rb', line 24 def each_sprite(&) @sprites.each(&) end |
#sprite(index) ⇒ Object
20 21 22 |
# File 'lib/amaterasu/game_boy/oam.rb', line 20 def sprite(index) @sprites[index] end |