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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/17/07 20:38
Read: times


 
#143387 - Inelegant!
Responding to: ???'s previous message
Jorge Torija Zane said:
I did something like this and seems to work.

It probably just happens to work in this case - but more by luck than judgement!

It is not safe to assume that an assignment made in 'C' (ie, outside the #pragma ASM) won't have been "interfered with" by the time you get into the inline assembler.

I don't know if there is a "more elegant" way of doing this.

Yes - it's what I tried to explain before:
http://www.8052.com/forum/read.phtml?id=143382

Again, you were lucky in this case - but it is not a good practice to adopt in general.

Is this what you mean with "skeleton"?

No: a skeleton is just a framework with no "meat" on it - you have included the meat!

The "skeletons" would look something like this:
void cout(unsigned char dato)
{
   // No meat here!
   // (it will be written later in assembler)
}

unsigned char cin(void)
{
   // No meat here!
   // (it will be written later in assembler)
}


You then get the compiler to translate that to assembler source;
You then edit the assembler source to insert the "meat"

See this Keil support article: http://www.keil.com/support/docs/50.htm




List of 39 messages in thread
TopicAuthorDate
C function with embeded ASM            01/01/70 00:00      
   You can call ASM from C...            01/01/70 00:00      
      I know nothing of Keil...            01/01/70 00:00      
         thanks            01/01/70 00:00      
      It seems to work.            01/01/70 00:00      
         Inelegant!            01/01/70 00:00      
            thanks for the article            01/01/70 00:00      
               I have certain examples available ...            01/01/70 00:00      
                  Make it public?            01/01/70 00:00      
                  Keil example            01/01/70 00:00      
                     It is a complete project with different files.            01/01/70 00:00      
                        Code library            01/01/70 00:00      
                           thanks!!!            01/01/70 00:00      
                              re;assembly language            01/01/70 00:00      
                                 ASM instructions in C            01/01/70 00:00      
                                    No, don\'t do that!            01/01/70 00:00      
                                 This is a really bad idea!            01/01/70 00:00      
                                    re;bad idea            01/01/70 00:00      
                                    re:bad idea II            01/01/70 00:00      
                                       The Best way is the C way            01/01/70 00:00      
   re: best way            01/01/70 00:00      
      Why not parameter passing?            01/01/70 00:00      
      What Compiler            01/01/70 00:00      
         re:parameter passing            01/01/70 00:00      
            Yes, but why?            01/01/70 00:00      
               re:            01/01/70 00:00      
               re:why            01/01/70 00:00      
                  Yes, But            01/01/70 00:00      
                  Parameter Passing R6, R7            01/01/70 00:00      
                     re:parameter passing using #pragma NOREGPARMS            01/01/70 00:00      
            REGPARMS/NOREGPARMS            01/01/70 00:00      
               re:NOREGPARMS            01/01/70 00:00      
                  ... and you always can use a global variable ...            01/01/70 00:00      
                     ???            01/01/70 00:00      
                        who said external???            01/01/70 00:00      
                           I            01/01/70 00:00      
                           re:??? 2            01/01/70 00:00      
                        re:???            01/01/70 00:00      
                           As long as you are aware of the issues.            01/01/70 00:00      

Back to Subject List