(s)
| 82 | } |
| 83 | |
| 84 | hexChecksum(s) { |
| 85 | if (s[0] != ':') |
| 86 | throw new Error("checksum for '" + s + "' failed: no initial :"); |
| 87 | |
| 88 | let accum = 0; |
| 89 | for (let i=0; i<(s.length-1)/2; i++) { |
| 90 | let chunk = s.slice(i*2+1, i*2+3); |
| 91 | accum += parseInt(chunk, 16); |
| 92 | } |
| 93 | |
| 94 | let twoC = ((~(accum-1)) & 0xff); |
| 95 | return ("00" + twoC.toString(16)).slice(-2).toUpperCase(); |
| 96 | } |
| 97 | |
| 98 | generateSegment(addr) { |
| 99 | this.currentSegment = (addr & 0xffff0000); |
no test coverage detected