Class: LadderDrive::AsmLine
- Inherits:
-
Object
- Object
- LadderDrive::AsmLine
- Defined in:
- lib/ladder_drive/asm.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#codes ⇒ Object
readonly
Returns the value of attribute codes.
-
#endian ⇒ Object
readonly
Returns the value of attribute endian.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
- #dump ⇒ Object
- #dump_line ⇒ Object
-
#initialize(line, address = 0, endian = nil) ⇒ AsmLine
constructor
A new instance of AsmLine.
- #next_address ⇒ Object
Constructor Details
#initialize(line, address = 0, endian = nil) ⇒ AsmLine
Returns a new instance of AsmLine.
85 86 87 88 89 90 91 |
# File 'lib/ladder_drive/asm.rb', line 85 def initialize line, address = 0, endian = nil @endian = endian || Asm::LITTLE_ENDIAN @line = line.upcase.chomp @codes = [] @address = address parse end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
82 83 84 |
# File 'lib/ladder_drive/asm.rb', line 82 def address @address end |
#codes ⇒ Object (readonly)
Returns the value of attribute codes.
81 82 83 |
# File 'lib/ladder_drive/asm.rb', line 81 def codes @codes end |
#endian ⇒ Object (readonly)
Returns the value of attribute endian.
83 84 85 |
# File 'lib/ladder_drive/asm.rb', line 83 def endian @endian end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
80 81 82 |
# File 'lib/ladder_drive/asm.rb', line 80 def line @line end |
Instance Method Details
#dump ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/ladder_drive/asm.rb', line 97 def dump @codes.map do |c| c.to_s(16).rjust(2, "0") end .join(" ") .ljust(12) end |
#dump_line ⇒ Object
93 94 95 |
# File 'lib/ladder_drive/asm.rb', line 93 def dump_line "#{dump}\t#{line}" end |
#next_address ⇒ Object
105 106 107 |
# File 'lib/ladder_drive/asm.rb', line 105 def next_address address + codes.size end |