Class: AVR::RegisterPair
- Extended by:
- T::Sig
- Defined in:
- lib/avr/register/register_pair.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#l ⇒ Object
readonly
Returns the value of attribute l.
Attributes inherited from Register
Attributes inherited from Value
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(cpu, l, h, name = nil) ⇒ RegisterPair
constructor
A new instance of RegisterPair.
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Methods inherited from Value
#inspect, #to_i, #to_s, #value_hex
Constructor Details
#initialize(cpu, l, h, name = nil) ⇒ RegisterPair
Returns a new instance of RegisterPair.
23 24 25 26 27 |
# File 'lib/avr/register/register_pair.rb', line 23 def initialize(cpu, l, h, name = nil) super(cpu, name || "Temporary[#{l.name}, #{h.name}]") @l = l @h = h end |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h.
13 14 15 |
# File 'lib/avr/register/register_pair.rb', line 13 def h @h end |
#l ⇒ Object (readonly)
Returns the value of attribute l.
10 11 12 |
# File 'lib/avr/register/register_pair.rb', line 10 def l @l end |
Instance Method Details
#format ⇒ Object
30 31 32 |
# File 'lib/avr/register/register_pair.rb', line 30 def format '%04x' end |
#value ⇒ Object
35 36 37 |
# File 'lib/avr/register/register_pair.rb', line 35 def value (h.value << 8) | l.value end |
#value=(new_value) ⇒ Object
40 41 42 43 |
# File 'lib/avr/register/register_pair.rb', line 40 def value=(new_value) h.value = (new_value & 0xff00) >> 8 l.value = (new_value & 0x00ff) end |