Lab 8

  1. Download and save the files test.c and Diff.asm
  2. gcc -S test.c produces the assembly language version test.s . Examine the assembly file to see the code produced by the compiler to implement a function call.
  3. Write assembly code for the function with the following prototype DWORD32 max(DWORD32 , DWORD32), and save it to the file Max.asm
  4. Add a call to the function max in the function main in the file test.c
  5. Assemble the file Max.asm  using the nasm assembler. Compile the C file. Link the two modules together. Click here for details on the mechanics.
  6. Execute your program and verify that your code works correctly.
  7. Write assembly code for the function DWORD32 factorial(DWORD32) in the file Factorial.asm and test it by calling it from the function main in test.c.