![]() |
| | #1 |
| Super Moderator Join Date: Sep 2001
Posts: 4,680
| MAINFRAME Assembler. _________________________ Sean Mackrory sean_mackrory@hotmail.com |
| sean is offline |
| | #2 |
| Blank Join Date: Aug 2001
Posts: 1,034
| 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; return a+b+c+i; } int main(void) { int a; a = f(1, 2, 3); return 0; } By falling this same convention, making sure it's linked globally, and writing the header files with extern "c" it should work. |
| Nick is offline |
| | #3 |
| Guest
Posts: n/a
| 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. void foo(void) { 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... |
| | #4 |
| _B-L-U-E_ Join Date: Aug 2001
Posts: 1,412
| can you write a seperate assembly function and impement that into your C++ code? For that is quite easy.
__________________ Blue |
| Betazep is offline |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 68000 assembler (building one that is) | Nutcasey | C Programming | 7 | 01-22-2004 04:14 PM |
| Assembler | GaPe | A Brief History of Cprogramming.com | 8 | 02-03-2003 01:01 PM |
| Problem building Quake source | Silvercord | Game Programming | 14 | 01-25-2003 10:01 PM |
| Assembler error | beg_g | Linux Programming | 4 | 04-06-2002 08:29 AM |
| assembler and linker stuff...question | dirkduck | A Brief History of Cprogramming.com | 2 | 12-17-2001 12:10 AM |