Hi, in a given c program where you have

myvar = sumR(char * arg1, int arg2)

sumR is a function in an assembly .s file. I have done all the calculations, but I have no idea how to return the value to the calling c program.

Any ideas?

Thanks so much.

Recommended Answers

Usually the value is returned in R0. So in your sumR, after you do your stuff, place what you want myvar to equal in R0

Jump to Post

All 3 Replies

Usually the value is returned in R0. So in your sumR, after you do your stuff, place what you want myvar to equal in R0

Thanks. If you don't mind one more, how do you print the contents of a register which contains an int.

Eh, Not sure, I am an x86 guy - sorry. Check the ARM website for debug stuff you can use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.