Combining C and assembly codes into one header file.

Hi!

At school we are going to have the final test in programming. Most of the class are really good at programming at C and Assembly therefore teachers allowed us to create universal header file with some functions for peripheries we are going to use. We have created header files for almost everything we need. There is just one little question. In one of the files we use C and Asm code we are using separate *.A51 file. Is there a way to put it into this header file? (We are creating one universal file with preprocessor directives and we want to stick to just this one file).

SO again questions:

1. Can we create something like this:

type FunctionInC(type foo)
{
   #pragma asm
     JMP $  ;
   #pragma endasm
}


(Because we are reading lots of articles against it.)

2. Is there any other way to put it together? (Everything else is in C but 3 functions need "direct supervision")

Please excuse my English (I am still not on level I want to be ;))

Parents
  • 1. Can we create something like this:

    type FunctionInC(type foo)
    {
       #pragma asm
         JMP $  ;
       #pragma endasm
    }
    

    You can, but you really shouldn't. It'll cause you a good deal more problems than it's likely to solve.

    But then again, since all you're talking about is header files, you shouldn't be writing anything like that at all because that's a function definition, and that absolutely does not belong into a header file. Well, either that or you've invented your own meaning of the term "header file", which maybe you should share with us before going on.

Reply
  • 1. Can we create something like this:

    type FunctionInC(type foo)
    {
       #pragma asm
         JMP $  ;
       #pragma endasm
    }
    

    You can, but you really shouldn't. It'll cause you a good deal more problems than it's likely to solve.

    But then again, since all you're talking about is header files, you shouldn't be writing anything like that at all because that's a function definition, and that absolutely does not belong into a header file. Well, either that or you've invented your own meaning of the term "header file", which maybe you should share with us before going on.

Children
More questions in this forum