# File lib/native_file_types/trs80/Trs80LevelIIBasic.rb, line 145
def to_listing  
        s=""
        p=1
        while(p<contents.length-2) && !((contents[p]==0) && (contents[p+1]==0))
  
                p+=2  #skip the 2 byte pointer to the start of next line
                line_number=contents[p]+(contents[p+1]<<8)
                p+=2
                s+= "#{line_number} "         
    in_quotes=false
    in_remark=false    
                while(p<contents.length) && (contents[p]!=0)
                        c=contents[p]
                        p+=1
      in_quotes=!in_quotes if (c.chr=='"')
                        if (in_quotes or in_remark or (c<0x80)) then
                                s+=(c%0x80).chr
                        else
        token=SINGLE_BYTE_TOKENS[c]
                                s+=(token.nil?) ? sprintf("[%02X]",c):token
        in_remark=true if (c==0x93) 
                        end
                end
                s+="\n"
        p+=1
        end
        s      
end