def to_listing
s=""
records.each do |record|
record_type=record[:record_type]
data_area=record[:data_area]
record_length=data_area.length
s+= ";RECORD TYPE $#{"%02X" %record_type} OFFSET $#{"%02X" % p} LENGTH $#{"%2X" % record_length}\n"
case record_type
when 0x01 then
load_address=data_area[0]+data_area[1]*256
s+= ";\tLOAD $#{"%02X" % (data_area.length-2)} BYTES OF OBJECT CODE TO $#{"%02X" % load_address}\n"
when 0x02 then
transfer_address=data_area[0]+data_area[1]*256
s+= ";\tTRANSFER ADDRESS $#{"%02X" % transfer_address}\n"
when 0x05 then
s+= ";\tMODULE HEADER #{data_area}\n"
end
end
s
end