diff options
| -rw-r--r-- | ruby/micronucleus.rb | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/ruby/micronucleus.rb b/ruby/micronucleus.rb index 3211d84..7dfafbd 100644 --- a/ruby/micronucleus.rb +++ b/ruby/micronucleus.rb @@ -127,11 +127,15 @@ class HexProgram    end    def binary +    bytes.pack('C*') +  end +   +  def bytes      highest_address = @bytes.keys.max - -    bytestring = Array.new(highest_address + 1) { |index| +     +    bytes = Array.new(highest_address + 1) { |index|        @bytes[index] -    }.pack('C*') +    }    end    protected @@ -143,7 +147,7 @@ class HexProgram        length = line[1..2].to_i(16) # usually 16 or 32        address = line[3..6].to_i(16) # 16-bit start address        record_type = line[7..8].to_i(16) -      data = line[9.. 9 + (length * 2)] +      data = line[9... 9 + (length * 2)]        checksum = line[9 + (length * 2).. 10 + (length * 2)].to_i(16)        checksum_section = line[1...9 + (length * 2)] | 
