Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Intergrate C function in Assembly code!!!

Status
Not open for further replies.

ahuy82

Newbie level 5
Joined
Oct 17, 2004
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
41
Hi all,
I'm using Keil Compiler. I want to intergrate some C functions into my old Assembly code. I know that the parameters are parsed through R0-R7 register. The problem is that if this C function calls another C function!!! So the parameters use which registers? How can I intergrate these functions into my Assembly code?
Thanks all for your help.
P/s: sorry for my bad English. I have tried my best:D
 

Hi Ahuy,
No matter how many function are present in the code and no matter the number of time that they are called the compiler transfers the parameters throught the registers [R0-R7]. Now when there is a call to some function within a function the compiler uses the stack to PUSH the parameters on to STACKand then load the registers with the current values and then POP the paramaters from the STACK after the call is returned. Thus placing a resrtriction on the number of calls within a function based on the STACK size. However you can increase the number of call depth by programming the register select field and increse the depth by 4 times. Well I think any program of a resonably fair complexity can be managed by this mechanism without loss in the modularity of the code. Hope I have answered your question

~Kalyan.
 

    ahuy82

    Points: 2
    Helpful Answer Positive Rating
Thanks alot, Kalyan! Your answer makes everything clear to me.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top