Phew! Today was one rough day for homework. 8 hours of it, to be exact. That assignment involving writing binary data was managed pretty well in C, along with swapping the words and longs in little endian form beforehand to give the assembly code a fighting chance, but it did not prepare me for the tough nature of the assembly assignment.
Luckily enough, I had also prepared a set of data that contained the size of bytes, shorts, and longs in each section, so I could use that as reference to skip forward to a certain section and read it. However! I had to keep other things in account, such as odd numbers of bytes that demanded data padding when writing to the binary data, and knowing to skip that padding as necessary.
Once I got that rolling, the computing averages to two decimal points was ferocious. This time I needed exactly 100 as a fixed point denominator value, along with proper rounding; however, when summing and averaging a group of shorts and longs multiplied by 100 for that fixed point value, the division instruction kept overflowing. I had to divide it by 100 * the number of values, then use that remainder and calculate a rounding value from it. It was certainly tough work.
What next? The night is young; I still need to print an extra zero if the fixed point values in question are below 10.
No comments:
Post a Comment