HI
I have a hard time finding some documentation on assembly function calls from an assembly program. The instruction 'call' does exist. However, I'D like to know more about what happens when it is used.
Thanks
Daniel
U of Sherbrooke
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
HI
I have a hard time finding some documentation on assembly function calls from an assembly program. The instruction 'call' does exist. However, I'D like to know more about what happens when it is used.
Thanks
Daniel
U of Sherbrooke
Hi Daniel,
At the time of compilation of a c program,
Wherever a C function is called in a c program, that function call will be replaced by its assembly instruction "call ".\
Say for example,
main()
----------
----------
Func(); it will be replaced by call Func ;
---------
---------
For more information , check compiler user guide and assembler user guide for C6000 Devices.
http://www.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=spru187u
http://www.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=spru186w
Daniel,
The document I looked in was the TMS320C64x/C64x+ DSP CPU and Instruction Set Reference Guide. There is no 'call' instruction.
If you are using a processor that does not apply to this document, please state the device number you are using and the page reference where you find a 'call' instruction listed in that processor's DSP CPU & Instruction Set Ref Guide in the Instruction Set section. For example,
References showing a CALL instruction within other documents may refer to a macro or to pseudo code, but those are not the instruction set reference guide.
To find out what an instruction does, build a test program, give it various different arguments as appropriate, and step through it with the debugger. Observe the changes in registers as you step. This is not a replacement for the CPU & Instruction Set Ref Guide, of course.
Regards,
RandyP
Hi Randy
Thanks for your sound advices. As you may see, I'm not yet a pro in the field of C6000 assembly programming. However, thanks to you, I could figure out that the call word is synonymous to the b instruction. It does nothing less, nothing more than a simple branch to a symbol. I just find curious that this substitution is not documented anywhere, yet it still works with compiler version 7.4.4 using ti's C6713 simulator (little endian). I just can't trace back where I found the call instruction being used. Sure enough, I did not guess it.
Thanks again
Daniel
Hi Randy
Here is the screen capture. The call becomes a B to address 0x00000000.
Daniel
Hi Randy
I'm not sure whether my previous post included the screen captures. I inserted a word document this time.
RandyP said:In your source file, you would get the same code if you changed the CALL mnemonic to B, but a call is not the same as a branch. I do not know why it is behaving the way it is. You made some changes to your code which should have been put in by a CALL macro, but were not.
I don't understand what you're complaining about, RandyP. The confusion in this case is direct result of what you are preaching, i.e. "look at compiler output, you mortals." Compiler always uses 'call' in generated assembly listing which is not real instruction. Assembler does recognize it, just like it does a number of other "incorrect" mnemonics. It's not big deal.
RandyP said:I will go back to my recommendation to write in C and learn from the assembly or listing output from the C compiler.
You are at a good starting point, but coding will be best for you in my opinion if you write in C and read assembly.
I once again want to point out that this just a personal opinion, and there are others. In the context I'd like to quote you, RandyP, from another thread: "I have tried for many years to understand programming the SPLOOP, and it escapes me." I'd say this is how your advice works. As already said earlier, by limiting yourself to compiler generated output you set boundary for learning, and from own experience I can tell that this boundary is actually low.