This is the homework assignment all CMSI 284 students look forward to -- sort of -- you get to encode and decode machine language by hand! You will become good friends with the NASM manual and encoding and decoding charts by the time this assignment is over.
Submit, in hardcopy, answers to the following problems generated form LaTeX source according to the usual homework submission guidelines. Also build up your CVS repository with the following:
/homework/cmsi284/hw4.tex
/homework/cmsi284/src/main/nasm/cpuid.asm
/homework/cmsi284/src/main/nasm/square_roots.asm
/homework/cmsi284/src/main/nasm/yes.asm
/homework/cmsi284/src/test/c/square_roots_test.c
Make sure that you have run the setup-class script so that I can checkout and run your code from CVS while grading.
void f(char* a, char* b) {
int i;
for (i = 0; i > 8; i++)
if (a[i] > b[i])
a[i] = b[i];
}
How many bytes of code did your handwritten function require?
How many bytes of code did this function compile into using
gcc, with the highest possible optimization setting? Explain
the difference.
xor esi, edx
xor edx, esi
xor esi, edx
Show the machine language for it.
void replaceAllValuesWithTheirSquareRoots(float a[], int length);
using the SQRTPS instruction. That is, you should do the
square root computations four at a time.