Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Assembly procedure calling from C (INTEL 8086)

$
0
0
Let me thank you for replying first. Alright, so here is goes. I need to prepare a procedure in Assembly for Intel 8086 able to be called from a C (pass a string and return an integer value(16bit)). My assembly procedure works perfectly fine "stand-alone". I need help with connecting them together.

Program is supposed to run on Intel 8086. I need to use MASM or emu8086 as assembler/simulator. Kindly recommend a C compiler and also a way to make the simple C program that is able to call the assembly procedure and get the returned value.

How can i connect the ASM file and the C file? (How will the compiler know where is the definition/code for this procedure?)
How can i receive the string sent from C in Assembly language, also how to return the integer to C from Assembly?

Any help is sincerely appreciated. Thank you.

Some people have suggest me something like this:
#include <stdio.h>

extern int assem();

int main()
{
    int i = assem("abc");
    printf("%d\n", i);
    return 0;
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>