Download the C program clab71c.c:
/* clab71c.c (Clements, page 145) */ int main() { int i,j; i = 1; j = 2; return i + j; }
Examine the syntax, and determine what the program does.
You can compile, assemble and link this program by typing the following commands in your terminal window:
m68k-coff-gcc -S clab71c.c -o clab71c.s -m68000
m68k-coff-as clab71c.s -o clab71c.o -m68000 -ahls=clab71c.lst
m68k-coff-ld clab71c.o -o clab71c.s19 -L. -Tbsvc-unix.ld
Exercise.
register int i,j;
Recompile, assemble and link. Run the code and check for correct operation. How are the variables stored now? How is the stack frame used?
ANU Engineering - ENGN3213