Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/15/03 23:33
Read: times


 
#43514 - RE: Keil: bit *and* char params C to Asm?
Responding to: ???'s previous message
The Keil compiler will organize the parameters to a called routine according to very specific rules which are documented in the compiler manual. Here are some examples...

1) If the function prototype for the called ASM routine was....

void func1(unsigned char arg1);

....then the arg1 byte is passed in register R7.

2) If the function prototype for the called ASM
routine was...

void func2(bit arg2);

...then the compiler creates a bit variable that looks like this the following:
	PUBLIC	?func2?BIT
	RSEG  ?BI?func2?TESTC
?func2?BIT:
       arg2?040:   DBIT   1


...and then in your assembly language you would reference the bit as follows for example:
	JB   	arg2?040,label


3) If you made a combination routine whose
function prototype would be.....

void func3(unsigned char arg3,but arg4);

....then the arg3 would be passed in register R7
and the bit argument would be passed rather similar
to the above example.

--------------------

If you are going to be having many many routines
that pass bits around like this do note that there
are a limited nubmer of them. They use the static
allocations for the bits like this becaue they are
fast and efficient. If you wanted it to be more 'register' based you could chose to use unsigned char arguments with zero/non zero values. These would then be passed in registers.

Michael Karas



List of 3 messages in thread
TopicAuthorDate
Keil: bit *and* char params C to Asm?            01/01/70 00:00      
   RE: Keil: bit *and* char params C to Asm?            01/01/70 00:00      
   RE: Keil: bit *and* char params C to Asm?            01/01/70 00:00      

Back to Subject List