I started a thread on the C++ Programming board a while ago asking for instruction on how to incorporate Assembler code into C++. The code I got was from untrue assembler - It's called assemler, but it's just a macro-expansion language based on the current Mainframe assembler - I'm using mainframe to describe the original - for PC's AND Mainframes. Does anyone know how to incorporate the original assembler's code into C++. There's $250,000 riding on me getting the right language from the incompetent idiots I work with, so I need pretty decent clarification.
This shouldn't be too hard. Compile some c code into assembly.
You will then be able to see the c compiler's calling convention and what registers to use. Maybe you can show the output on this board?
int f(int a, int b, int c)
int i = 4;
a = f(1, 2, 3);
By falling this same convention, making sure it's linked globally, and writing the header files with extern "c" it should work.
Assembly language is just a mnemonic grammar and syntax for specifying object code values-- binary really.
If you can't use inline assembler, then do this-- works with any language, any compiler you can disassemble with.
register char a;
register long v;
a = v;
Now dissassemble and see what registers the compiler stuffed var a & v in. It will reference them off the stack and move them into registers. You have a limited number of registers to use.
Then write your assembly code to use those locations.
Once you know what registers your vars wind up in, write the rest of the function to load the object code and jump to it.
Alternatively you could do the same thing, but with function pointers...
can you write a seperate assembly function and impement that into your C++ code? For that is quite easy.