Keil Logo

Parameters and Local Variables

Historically, function parameters were passed using fixed memory locations. This is still true for routines written in PL/M-51. However, the Cx51 Compiler can pass up to three function arguments in registers. Other arguments are passed using the traditional fixed memory areas. Memory space is reserved for all function arguments regardless of whether or not some of these arguments may be passed in registers. The parameter areas must be publicly known to any calling module. So, they are publicly defined using the following names:

  • ?function_name?BYTE is the name assigned to the contiguous memory area reserved for non-bit parameters.
  • ?function_name?BIT is the name assigned to the contiguous memory area reserved for all bit parameters.

For example, if func1 is a function that accepts bit arguments as well as arguments of other data types, the bit arguments are passed in the memory area starting at ?FUNC1?BIT. All other parameters are passed starting at ?FUNC1?BYTE. Refer to Interfacing C Programs to Assembler for more examples.

Related Knowledgebase Articles

  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.