FreeCalypso > hg > fc-usbser-tools
comparison cp2102/intel_hex_out.c @ 56:842cff427588
cp2102: fix Intel HEX read/write bugs
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Sep 2023 19:52:28 +0000 |
parents | d4d3531d342a |
children |
comparison
equal
deleted
inserted
replaced
55:c0084bf153e5 | 56:842cff427588 |
---|---|
30 *dp++ = 0x00; | 30 *dp++ = 0x00; |
31 for (bytecnt = 0; bytecnt < 16; bytecnt++) | 31 for (bytecnt = 0; bytecnt < 16; bytecnt++) |
32 *dp++ = *sp++; | 32 *dp++ = *sp++; |
33 csum = 0; | 33 csum = 0; |
34 for (bytecnt = 0; bytecnt < 20; bytecnt++) | 34 for (bytecnt = 0; bytecnt < 20; bytecnt++) |
35 csum = record[bytecnt]; | 35 csum += record[bytecnt]; |
36 csum = 0x100 - csum; | 36 csum = 0x100 - csum; |
37 record[20] = csum; | 37 record[20] = csum; |
38 putc(':', outf); | 38 putc(':', outf); |
39 for (bytecnt = 0; bytecnt < 21; bytecnt++) | 39 for (bytecnt = 0; bytecnt < 21; bytecnt++) |
40 fprintf(outf, "%02X", record[bytecnt]); | 40 fprintf(outf, "%02X", record[bytecnt]); |