Class: PackedAppleDosPic

Inherits:
AppleDosPic show all
Defined in:
lib/native_file_types/apple2/PackedHiResPicFormats.rb

Overview

picture packed in format first seen (by jonno) on a disk cracked by “Association Of Broadcasting Crackers”

Instance Attribute Summary

Attributes inherited from NativeFileType

#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data

Instance Method Summary collapse

Methods inherited from AppleDosPic

file_system_file_types, #header_length, load_address

Methods inherited from AppleHiResPic

buffer_to_picture, file_system_file_types, matching_score, #picture_format, #picture_height, #picture_width, scanline_offsets, #to_picture

Methods inherited from NativeFileType

#<=>, #==, all_native_file_types, best_fit, code_for_tests, compatability_score, #data_without_header, file_type_matches?, #full_filename, #header_length, #initialize, is_valid_file_if, #load_address, load_address, matching_score, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from NativeFileType

Instance Method Details

#unpacked_picture_bytesObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/native_file_types/apple2/PackedHiResPicFormats.rb', line 74

def unpacked_picture_bytes    
  packed_buffer=data_without_header
  unpacked_buffer="\000"*8192
  in_p=0
  out_p=0
  while out_p<=8192 && in_p<packed_buffer.length do
    count_byte=packed_buffer[in_p]     
    in_p+=1
    if (count_byte>=0x80) then
      (1+(count_byte & 0x7F)).times do
        unpacked_buffer[out_p]=packed_buffer[in_p] unless out_p>=8192
        in_p+=1
        out_p+=1
       end 
    else
      src_byte=packed_buffer[in_p]               
      in_p+=1
      (1+count_byte).times do
        unpacked_buffer[out_p]=src_byte  unless out_p>=8192
        out_p+=1
       end               
    end  
  end
  unpacked_buffer
end