Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Unsigned Multiplication O/F (C Assembly)

LanguidLegendLanguidLegend Member Posts: 4
Hi, can you help with a C programming assignment?
A small part of the course covers writing/compiling assembler code as well, so I have this problem that I can't figure out:

Basically it deals with unsigned integer multiplication (specifically in dealing with 32-bit int overflow), using two files: big_mult.c, and mull.s.
So far, I have written the big_mult.c, which contains two methods: int main, & void mull (mull.s).
void mull(unsigned int x, unsigned int y, unsigned int* low, unsigned int* high);

int main(char *argv[]) {
unsigned x, y;
unsigned low = high = 0;
return 0;
Now mull.s function is to be written manually, and will be linked to the final program after compile: $ gcc -Wall -std=c99 -o big_mult.exe big_mult.c mull.s
This is the part I am lost at...
All I really know is that it starts out something like this:
pushl %ebp | save stack pointer
movl %esp, %ebp | new stack pointer
movl 8(%ebp), %eax | get x
movl 12(%ebp), %edx | get y
movl 16(%ebp), (%?) | get *low
movl 20(%ebp), (%?) | get *high
pop %ebp
Here is the sample output:
[code]$ ./big_mult 2f432f43 629b03cb
2f432f43 x 629b03cb = 12345678 87654321
* Using Cygwin Bash Shell[/code]

Can you please help?
[b]Thank you![/b]
Sign In or Register to comment.