If you are not working with 8-bit variables, you must suppress the overflow by AND-ing the result with 0xFF. The overflow may occur since both 0x100-0 and (0x00 XOR 0xFF)+1 equal 0x100.
If the checksum is correctly calculated, adding all the bytes (the Byte count, both bytes in Address, the Record type, each Data byte and the Checksum) together will always result in a value wherein the least significant byte is zero (0x00). For example, on:337A1E 03 + 00 + 30 + 00 + 02 + 33 + 7A = E2, 2's complement is 1E. Quote: I have WinAvr but I don't want to use code (libraries) to make my hex file. If what you are tying to do here is take a.bin file of EEPROM initial values and convert this to Intel.hex (maybe.eep?) for input to your programmer software then either follow RiJoRi's suggestion of BIN2HEX (tons out there if you Google - I think it's Keil who have a good one for download) or just use avr-objcopy in the WinAVR package. It's happily operate a a Hex2Bin for you. Start with 'avr-objcopy -?' Or 'avr-objcopy --info' (hint: you want 'binary' and 'ihex') Cliff.