CS250 Lab 7: Practice with Functions

Due Wednesday, March 13

This lab is a practice lab for assembly, but you also try calling an assembly function from C. There's a C file in the class examples, call_string_length.c which expects to find a function called string_length. Write this function in an assembly file (with a .s extension), and compile them together like this:
gcc call_string_length.c string_length.s  -static -z execstack
Once your assembly function works, you'll get output like this:
seth@nimrod:~/cs250/asm_examples $ gcc call_string_length.c string_length.s  -static -z execstack
seth@nimrod:~/cs250/asm_examples $ ./a.out
Testphrase:  How many turtles can you fit in a flying saucer?
Length:  48
So in essence, you'll write your own version of the common function strlen. There are a couple relevant files in the class examples, notably factorial.s and times_three.s.