| ??? 03/28/00 06:31 Read: times |
#1984 - RE: How to convert Intel hex file to bin? I |
> How to convert Intel hex file to
> bin? I need the algorithm. At first you'll need a buffer large enough -- 64K would be great, and while using C in DOS, farmalloc() will do the job to allocate something like 'char buf[65535]'. Simplest solution is to open HEX file as text and read it line-by-line. Check if record length byte corresponds to actual record length (just for sure). Decode record address and write record data to buffer, using address as array index. Additionally, you should sum up all record bytes from length byte to checksum -- if the latter is correct, result will be zero. Then, check record type byte: if it is equal to one, proceed with next HEX line, otherwise it means EOF. Finally, the loaded code block in buffer should be saved to disk. Again, using DOS may be a bit tricky, as runtime library functions based on DOS calls (e.g. fwrite()) can not handle entire 64K, but a few bytes less. And of sure, while analyzing HEX file, block address space should be calculated -- actually it means block size. (Source code will be available somewhere at the end of the summer -- it is a part of freeware disassembler package just being developed.) HTH -- Tomas |
| Topic | Author | Date |
| How to convert Intel hex file to bin? I | 01/01/70 00:00 | |
| RE: How to convert Intel hex file to bin? I | 01/01/70 00:00 | |
| RE: How to convert Intel hex file to bin? I | 01/01/70 00:00 | |
| RE: How to convert Intel hex file to bin? I | 01/01/70 00:00 | |
| RE: How to convert Intel hex file to bin? I | 01/01/70 00:00 | |
RE: How to convert Intel hex file to bin? I | 01/01/70 00:00 |



