Class: AVR::SP
Instance Attribute Summary
Attributes inherited from RegisterPair
#h, #l
Attributes inherited from Register
#cpu
Attributes inherited from Value
#name, #value
Instance Method Summary
collapse
#format, #value, #value=
Methods inherited from Value
#format, #inspect, #to_i, #to_s, #value_hex
Constructor Details
#initialize(cpu, l_memory_byte, h_memory_byte, initial_value) ⇒ SP
Returns a new instance of SP.
16
17
18
19
20
21
22
23
24
|
# File 'lib/avr/register/sp.rb', line 16
def initialize(cpu, l_memory_byte, h_memory_byte, initial_value)
super(
cpu,
MemoryByteRegister.new(cpu, 'SPL', l_memory_byte),
MemoryByteRegister.new(cpu, 'SPH', h_memory_byte),
'SP'
)
self.value = initial_value
end
|
Instance Method Details
#adjust(offset) ⇒ Object
27
28
29
|
# File 'lib/avr/register/sp.rb', line 27
def adjust(offset)
self.value += offset
end
|
#decrement(by = 1) ⇒ Object
32
33
34
|
# File 'lib/avr/register/sp.rb', line 32
def decrement(by = 1)
adjust(-by)
end
|
#increment(by = 1) ⇒ Object
37
38
39
|
# File 'lib/avr/register/sp.rb', line 37
def increment(by = 1)
adjust(+by)
end
|