This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Calling ASM functions from C

I'm using the uVision2 8051 eval version trying to see if it's worth leaving my normal asm enviroment.
Natualy I have some asm functions that I would like to take with me, but I need to figure out how to call my asm functions.

I have three different senearios that are quiet common among my routines, and I'm looking for help to integrate the two worlds of programming.

This is how I would like the C code to look:

unsigned char portbit
unsigned char databyte
unsigned char stream[8]

bit Reset(portbit)
byte DataIO(portbit,databyte)
void DataOut(portbit,databyte)


The asm works like this:

Reset returns true or false in carry,
and accesses a certan output bit.

DataIO both sends and returns data in the accumulator. It, too acesses a port bit.

DataOut is basically the same as the above, but it returns nothing. It will however change the contens in the stream.

In other words... How do I make sure that the C routines communicates using the accumulator and carry.


I'm looking forward to hear what to do.

Regards,

Flemming Steffensen

0