C Board  

Go Back   C Board > Community Boards > A Brief History of Cprogramming.com

 
 
LinkBack Thread Tools Display Modes
Old 12-05-2001, 12:32 PM   #1
Super Moderator
 
Join Date: Sep 2001
Posts: 4,680
MAINFRAME Assembler.

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.

_________________________
Sean Mackrory
sean_mackrory@hotmail.com
sean is offline  
Old 12-05-2001, 03:13 PM   #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  
Old 12-05-2001, 03:57 PM   #3
Sayeh
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...
 
Old 12-05-2001, 05:32 PM   #4
_B-L-U-E_
 
Betazep's Avatar
 
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

Forum Jump

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


All times are GMT -6. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22