Solved

linking Turbo C and 8086 assembly

Posted on 2002-05-13
3
893 Views
Last Modified: 2010-05-18
i use turbo c 3.0 compiler and turbo assembler.i want to connect or combine 8086 assembly( for low level stuff) and C routines.i could not find good resources of information.can you please help me in finding some.thanks
0
Comment
Question by:vinayak_j
3 Comments
 
LVL 11

Accepted Solution

by:
dimitry earned 50 total points
ID: 7007587
I suggest you to try next thing:
1. In order to create assembler function that you can call
from c:
- Define it in .h file as:
 void cdecl myasmfunc( params );
- And in assembler its header should look like:
 _TEXT     segment byte public 'CODE'
  ;
  ;     void cdecl myasmfunc( params )
  ;
    assume     cs:_TEXT
 _myasmfunc proc     near
    push     bp
    mov     bp,sp
       ...
    ; 16-bit parameter1 - word ptr [bp+4]
    ; 16-bit parameter2 - word ptr [bp+6]
       ...
 _myasmfunc endp

 _TEXT     ends
    public     _myasmfunc
    end

2. To call function from assembler:
- Define it in .h file as:
 void near cdecl mycfunc( params );
- And in assembler its header should look like:
 extrn  _mycfunc : near
  ...
 push  parameter2
 push  parameter1
 call  _mycfunc

Note: You need to pass parameters correctly from and to
your functions. In C convention you need to enter parameters to stack in opposite order.

0
 
LVL 2

Expert Comment

by:jonnin
ID: 7023824
Also, using the turbo assembler, you can make obj files that can be linked.  Make sure the asm routines use C calling conventions or place the push/pop pairs in the C to clean up (see above and articles on this)

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now