Class: N65::Space
- Inherits:
-
InstructionBase
- Object
- InstructionBase
- N65::Space
- Defined in:
- lib/n65/directives/space.rb
Overview
This directive gives a symbolic name for memory and creates space for a variable in RAM
Class Method Summary collapse
Instance Method Summary collapse
-
#exec(assembler) ⇒ Object
.space creates a symbol at the current PC, and then advances PC by size.
-
#initialize(name, size) ⇒ Space
constructor
Initialize some memory space with a name.
-
#to_s ⇒ Object
Display.
Methods inherited from InstructionBase
Constructor Details
#initialize(name, size) ⇒ Space
Initialize some memory space with a name
17 18 19 20 |
# File 'lib/n65/directives/space.rb', line 17 def initialize(name, size) @name = name @size = size end |
Class Method Details
Instance Method Details
#exec(assembler) ⇒ Object
.space creates a symbol at the current PC, and then advances PC by size
23 24 25 26 27 |
# File 'lib/n65/directives/space.rb', line 23 def exec(assembler) program_counter = assembler.program_counter assembler.symbol_table.define_symbol(@name, program_counter) assembler.program_counter += @size end |
#to_s ⇒ Object
Display
30 31 32 |
# File 'lib/n65/directives/space.rb', line 30 def to_s ".space #{@name} #{@size}" end |