Thread: MAINFRAME Assembler.

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    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
    [email protected]

  2. #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.

  3. #3
    Sayeh
    Guest
    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. #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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. 68000 assembler (building one that is)
    By Nutcasey in forum C Programming
    Replies: 7
    Last Post: 01-22-2004, 04:14 PM
  3. Assembler
    By GaPe in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 02-03-2003, 01:01 PM
  4. Assembler error
    By beg_g in forum Linux Programming
    Replies: 4
    Last Post: 04-06-2002, 08:29 AM
  5. assembler and linker stuff...question
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-17-2001, 12:10 AM