Keil Logo

C166: WHAT IS R0 USED FOR?


Information in this article applies to:

  • C166 All Versions

QUESTION

What is register 0 (R0) used for in the code generated by the C166 compiler? There seems to be a lot of weird stuff going on with it.

ANSWER

The Keil C166 compiler uses R0 to maintain a user stack for local variables and function arguments. The startup code in START166.A166 and START167.A66 includes a section which sets up the user stack.

The user stack grows from the top down. So, as arguments are pushed on the stack, R0 decreases. This is probably the "weird stuff" that you see happening.

Last Reviewed: Wednesday, January 25, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.