Solved

Linking Assembly code to C++

Posted on 1998-03-23
7
198 Views
Last Modified: 2010-04-10
can anybody help me how to create a link-able macro in Assembly language for C++ source code?
for example I want to create some routines in assembly that handle disk I/O and want to link them to my C++ code.
0
Comment
Question by:bluebird031198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
7 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1183752
Yes, I can help.  If you want qualifications, I've written a 500,000 line assembly language program.

Can you provide some details.?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183753
What operatig system?  DOS I assume?
Is this for the x86 computers?
What C++ compiler?
Why not provide at least one example procedure of what you want?

0
 

Author Comment

by:bluebird031198
ID: 1183754
if can just give some examples in DOS, Unix, or even others OS.
thanks for all
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1183755
Answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183756
; A convenient macro for making DOS interrupt service calls.
BDOS          MACRO         U,V
              IFNB          <V>
              MOV       AL,V
              ENDIF
              MOV           AH,U
              INT           21H
              ENDM

; Assemply procedure top opne a file in DOS.  Caller specifies the file name and the mode to open in.  Procedure returns a non-zero handle if it succeeds.  zero if it fails.
; Returns
; AX file handle.
OPNFIL PROC NEAR PASCAL DWORD FILNAM,BYTE OPNMOD
   LDS DX FILNAM
   BDOS 3Dh,OPNMOD
  JNC OPNFILEND:
  XOR AX,AX

OPNFILEND: RET
OPNFIL END
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183757
from C++ you would use.

extern "C" HANDLE OPNFIL(char *FilNam,char Mode);

handle FilHnd = OPNFIL("c:\autoexec.bat",0);
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183758
That's about the best I can offer without more input from you.  
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

632 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