I was trying to get asm6 working on my machine, but all the data values were outputting as zero. I finally traced it down to it assuming that the host is little-endian, where it essentially does in many places:
rather than the much more portable
Code:
int i = ...;
write_bytes_to_output( &i, 1 ); // for byte output
write_bytes_to_output( &i, 2 ); // for 16-bit word output
write_bytes_to_output( &i, 1 ); // for byte output
write_bytes_to_output( &i, 2 ); // for 16-bit word output
rather than the much more portable
Code:
int i = ...;
unsigned char c = i;
write_bytes_to_output( &c, 1 );
unsigned char word [2] = { i, i >> 8 };
write_bytes_to_output( word, 2 );
unsigned char c = i;
write_bytes_to_output( &c, 1 );
unsigned char word [2] = { i, i >> 8 };
write_bytes_to_output( word, 2 );