Class: Rubyboy::Registers
- Inherits:
-
Object
- Object
- Rubyboy::Registers
- Defined in:
- lib/rubyboy/registers.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#c ⇒ Object
Returns the value of attribute c.
-
#d ⇒ Object
Returns the value of attribute d.
-
#e ⇒ Object
Returns the value of attribute e.
-
#f ⇒ Object
Returns the value of attribute f.
-
#h ⇒ Object
Returns the value of attribute h.
-
#l ⇒ Object
Returns the value of attribute l.
Instance Method Summary collapse
- #af ⇒ Object
- #af=(value) ⇒ Object
- #bc ⇒ Object
- #bc=(value) ⇒ Object
- #de ⇒ Object
- #de=(value) ⇒ Object
- #hl ⇒ Object
- #hl=(value) ⇒ Object
-
#initialize ⇒ Registers
constructor
A new instance of Registers.
Constructor Details
#initialize ⇒ Registers
Returns a new instance of Registers.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rubyboy/registers.rb', line 7 def initialize @a = 0x01 @b = 0x00 @c = 0x13 @d = 0x00 @e = 0xd8 @h = 0x01 @l = 0x4d @f = 0xb0 end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def b @b end |
#c ⇒ Object
Returns the value of attribute c.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def c @c end |
#d ⇒ Object
Returns the value of attribute d.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def d @d end |
#e ⇒ Object
Returns the value of attribute e.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def e @e end |
#f ⇒ Object
Returns the value of attribute f.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def f @f end |
#h ⇒ Object
Returns the value of attribute h.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def h @h end |
#l ⇒ Object
Returns the value of attribute l.
5 6 7 |
# File 'lib/rubyboy/registers.rb', line 5 def l @l end |
Instance Method Details
#af ⇒ Object
50 51 52 |
# File 'lib/rubyboy/registers.rb', line 50 def af (@a << 8) | @f end |
#af=(value) ⇒ Object
66 67 68 69 |
# File 'lib/rubyboy/registers.rb', line 66 def af=(value) @a = (value >> 8) & 0xff @f = value & 0xf0 end |
#bc ⇒ Object
54 55 56 |
# File 'lib/rubyboy/registers.rb', line 54 def bc (@b << 8) | @c end |
#bc=(value) ⇒ Object
71 72 73 74 |
# File 'lib/rubyboy/registers.rb', line 71 def bc=(value) @b = (value >> 8) & 0xff @c = value & 0xff end |
#de ⇒ Object
58 59 60 |
# File 'lib/rubyboy/registers.rb', line 58 def de (@d << 8) | @e end |
#de=(value) ⇒ Object
76 77 78 79 |
# File 'lib/rubyboy/registers.rb', line 76 def de=(value) @d = (value >> 8) & 0xff @e = value & 0xff end |
#hl ⇒ Object
62 63 64 |
# File 'lib/rubyboy/registers.rb', line 62 def hl (@h << 8) | @l end |
#hl=(value) ⇒ Object
81 82 83 84 |
# File 'lib/rubyboy/registers.rb', line 81 def hl=(value) @h = (value >> 8) & 0xff @l = value & 0xff end |