Class: Asm6502::Mem
- Inherits:
-
Struct
- Object
- Struct
- Asm6502::Mem
- Defined in:
- lib/asm6502.rb
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length
28 29 30 |
# File 'lib/asm6502.rb', line 28 def length @length end |
#value ⇒ Object
Returns the value of attribute value
28 29 30 |
# File 'lib/asm6502.rb', line 28 def value @value end |
Class Method Details
.[]=(length, value) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/asm6502.rb', line 29 def self.[]=(length, value) value = value.kind_of?(Symbol) ? @@labels[value] : value sprintf("%0#{value.size * 8 + 2}b", value)[2..-1].scan(/.{8}/).last(length).map { |i| i.to_i(2) }.reverse.each_with_index do |digit, index| @@mem[@@org + index] = digit end @@org += length end |