Solved

Linking Assembly code to C++

Posted on 1998-03-23
7
182 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
  • 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.

746 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

13 Experts available now in Live!

Get 1:1 Help Now