UMBC CMSC 313, Computer Organization & Assembly Language, Spring 2002, Section 0101
Examples II
Tuesday 03/05, 2001
[Up]
[Previous Lecture]
[Next Lecture]
Assigned Reading in Murdocca & Heuring:
Assigned Reading in Neveln:
Assigned:
Due:
Topics Covered:
- We continued discussion of C function call conventions.
- We looked examples of calling C functions from assembly language
programs (e.g., calling printf()). We used gcc to
link/load the program to avoid having to figure out the options
to give to ld to get this to work.
- We looked at C programs calling assembly language functions.
- Discussed
Project 2 from the Fall 2001.
Programs shown:
- A simple C function converted to assembly language
using gcc -S:
cfunc.c,
cfunc.s (AT&T style assembly),
cfunc.asm (Intel style assembly),
cfunc.txt.
- A more complicated C function converted to assembly language
using gcc -S (shown only briefly):
cfunc.c,
cfunc2.s (AT&T style assembly),
cfunc2.asm (Intel style assembly).
- A C function with a return value with size more than 4 bytes
(shown only briefly):
cfunc3.c,
cfunc3.asm
(The comments in this file were added afterwards).
- An assembly language program that calls printf to write
to stdout (with C style main function):
printf1.asm,
printf1.txt.
- An assembly language program that calls printf to write
to stdout (with assembly style _start entry point):
printf2.asm,
printf2.txt.
- An example of a C program that calls a function implemented in assembly:
arraytest.c,
arrayinc.asm,
arraytest.txt.
- File related to previous semester's
Project 2:
bigint.h
(header file for BigInt class),
bigint.cpp
(implementation of BigInt class),
bimath.h
(header file for C functions to be implemented in assembly),
bimath-template.asm
(assembly stubs for the functions in bimath.h),
biadd.asm
(sample assembly implementation for BI_Add).
Last Modified:
22 Jul 2024 11:29:34 EDT
by
Richard Chang
to Spring 2002 CMSC 313 Section Homepage