1"use strict";var RECORD_TYPE={DATA:"00",END_OF_FILE:"01",EXTENDED_SEGMENT_ADDRESS:"02",START_SEGMENT_ADDRESS:"03",EXTENDED_LINEAR_ADDRESS:"04",START_LINEAR_ADDRESS:"05"},loggers=[];function addLogger(r){"function"==typeof r&&loggers.push(r)}function log(r){loggers.forEach((function(e){e(r)}))}function helperGetBinaryStartAddress(r){var e;do{e=r.shift()}while("00"!=e.substr(7,2));var s=parseInt(e.substr(9,4),16)<<16;do{e=r.shift()}while(e.substr(7,2)!=RECORD_TYPE.DATA);var t=s+parseInt(e.substr(3,4),16);return console.log("start address of binary: "+t),t}function helperGetBinaryEndAddress(r,e){var s;do{s=r.pop()}while(s.substr(7,2)!=RECORD_TYPE.DATA);var t=parseInt(s.substr(1,2),16),n=parseInt(s.substr(3,4),16);do{s=r.pop()}while("00"!=s.substr(7,2));var a=(parseInt(s.substr(9,4),16)<<16)+n+t;return a>e?helperGetBinaryEndAddress(r,e):(console.log("end address of binary: "+a),a)}function convert_hex2bin(r,e,s){var t=s,n=e||0;0==t&&(t=1048575&helperGetBinaryEndAddress(r.match(/(.*)\r?\n/g),33554431)),n<e&&log("trimmed start address of binary: "+(n=e));var a=t-n;console.log("size of binary: "+a);var E=new ArrayBuffer(a),o=new Uint8Array(E);o.fill(0);var i=0;if("string"==typeof r)d=r.toString().split("\n");else var d=r.toString().split(",");return d.forEach((function(r){switch(r.substr(7,2)){case RECORD_TYPE.DATA:for(var e=parseInt(r.substr(1,2),16),s=parseInt(r.substr(3,4),16),t=r.substr(9,2*e),E=0;E<2*e;E+=2){var d=i+s-n+E/2;d>=0&&d<a&&(o[d]=parseInt(t.substr(E,2),16))}break;case RECORD_TYPE.END_OF_FILE:log("done converting hex file to binary");break;case RECORD_TYPE.EXTENDED_SEGMENT_ADDRESS:throw"ERROR - invalid hex file - extended segment address is not handled";case RECORD_TYPE.START_SEGMENT_ADDRESS:throw"ERROR - invalid hex file - start segment address is not handled";case RECORD_TYPE.EXTENDED_LINEAR_ADDRESS:134217728==(i=parseInt(r.substr(9,4),16)<<16)&&(i=0);break;case RECORD_TYPE.START_LINEAR_ADDRESS:log("ignore records of type start linear address");break;default:if(""===r)break;throw"ERROR - invalid hex file - unexpected record type in provided hex file"}})),o}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.