intToBCD() does not work correctly. A quick test is to pass in 256, the BCD output is 0x100 rather than 0x256. Instead of trying to debug and fix this routine I offer 2 new routines u16ToBCD() and u32ToBCD(). The u16ToBCD() routine uses 68K mod and div for speed optimization, while the u32ToBCD() uses normal C-style operations.
Feel free to decline these changes in favor of fixing intToBCD().
intToBCD() does not work correctly. A quick test is to pass in 256, the BCD output is 0x100 rather than 0x256. Instead of trying to debug and fix this routine I offer 2 new routines u16ToBCD() and u32ToBCD(). The u16ToBCD() routine uses 68K mod and div for speed optimization, while the u32ToBCD() uses normal C-style operations.
Feel free to decline these changes in favor of fixing intToBCD().
Cheers, IH.