Class: N65::Org
- Inherits:
-
InstructionBase
- Object
- InstructionBase
- N65::Org
- Defined in:
- lib/n65/directives/org.rb
Overview
This is an .org directive
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Class Method Summary collapse
-
.parse(line) ⇒ Object
Try to parse an .org statement.
Instance Method Summary collapse
-
#exec(assembler) ⇒ Object
Exec this directive on the assembler.
-
#initialize(address) ⇒ Org
constructor
Initialized with address to switch to.
-
#to_s ⇒ Object
Display.
Methods inherited from InstructionBase
Constructor Details
#initialize(address) ⇒ Org
Initialized with address to switch to
22 23 24 |
# File 'lib/n65/directives/org.rb', line 22 def initialize(address) @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
8 9 10 |
# File 'lib/n65/directives/org.rb', line 8 def address @address end |
Class Method Details
Instance Method Details
#exec(assembler) ⇒ Object
Exec this directive on the assembler
29 30 31 |
# File 'lib/n65/directives/org.rb', line 29 def exec(assembler) assembler.program_counter = address end |
#to_s ⇒ Object
Display
36 37 38 39 40 41 42 |
# File 'lib/n65/directives/org.rb', line 36 def to_s if @address <= 0xff ".org $%2.X" % @address else ".org $%4.X" % @address end end |