Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linking Assembly code to C++

Posted on 1998-03-23
7
Medium Priority
?
200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 22

Accepted Solution

by:
nietod earned 100 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

715 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