Solved

linking Turbo C and 8086 assembly

Posted on 2002-05-13
3
892 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to implement a communication protocol 8 520
FIR_filter 2 220
New tabs in IE9 never display anything 3 401
Bomb lab phase_5 1 1,345
A procedure for exporting installed hotfix details of remote computers using powershell
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

20 Experts available now in Live!

Get 1:1 Help Now