Solved

C++ and Assembler languages

Posted on 1999-01-14
23
417 Views
Last Modified: 2010-04-02
I am taking C++ and Assembler this semester.  I bought MS Visual Studio 6.0.  I know that I use Visual C++ to program in C++, but what would I use to program in Assembler?
Thanks.
0
Comment
Question by:Armandito
  • 9
  • 9
  • 4
  • +1
23 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1182150
You can use Microsoft MASM, it is available from microsoft.  Also Borland sells TASM, but it is not as good.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182151
For short segments of assembly (not whole programs, but like assembly procedures) you can use inline assembly in VC.  However this is not like a full featured assembler, so you probably can't get but with it alone.
0
 
LVL 86

Expert Comment

by:jkr
ID: 1182152
Perhaps the GNU project might also be worth to check out - 'as' (the GNU assembler) is free, as the GNU C/C++ compilers (gcc and g++) and lots of other useful software - see 'http://www.cygnus.com/misc/gnu-win32/ The GNU-Win32 Project Page'
0
 

Author Comment

by:Armandito
ID: 1182153
All the answers have been good.  Since Nieto was first I feel inclined to give him the points.  But I need to ask for more information before the answer is right.  
Does Microsoft MASM come with Visual Studio 6.0 Pro?
Thanks!
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182154
NASM (Netwide Assembler) is a freeware assembler that doesn't second-guess the programmer (by optimizing).
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182155
By the way, MASM *doesn't* come with Visual Studio.  You have to purchase it separately (as far as I know).
0
 

Author Comment

by:Armandito
ID: 1182156
scrapdog, where can I get NASM?
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182157
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182158
And there is an excellent online assembly language book at:

http://webster.ucr.edu/Page_asm/ArtofAssembly/ArtofAsm.html

1500 pages!!  Very easy to read.
0
 

Author Comment

by:Armandito
ID: 1182159
Ok.  I'm gonna give you the points, but I have a question.  Can NASM produce executable files for win 95 or 98?

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182160
Yes, but I have never done so.  It is rare for someone to make an .exe out of pure assembly language.  Most of the time the assembly language code is assembled into an object files, and the executables are made out of a combination of the object files and another high level language (such as c or pascal).  However, it IS possible to make an executable out of pure assembly language.

You can read the docs for details.

http://www.web-sites.co.uk/nasm/docs/
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Armandito
ID: 1182161
I need to know if I can create executables with NASM.  The links you provided didn't mention it.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182162
Yes.
0
 

Author Comment

by:Armandito
ID: 1182163
Hey, sorry about that.  My browser must not have refreshed correctly so I didn't see your latest comment.  How do I give you the points?
0
 
LVL 5

Accepted Solution

by:
scrapdog earned 100 total points
ID: 1182164
Here is the specific chapter for writing Win32 code:

http://www.web-sites.co.uk/nasm/docs/nasmdoc8.html

Most likely you will be linking it with C...like I said, it is very *rare* to see a Win32 program written entirely in assembly language...I have only seen it once or twice, and these were just demo programs.

It might be very confusing to read this until you understand assembly language.  I would recommend reading The Art of Assembly Language (the link to the book I gave you above), at least the first half of it, before you begin to *try* to understand the process of writing an assembly language program.  I also recommend that you read Art of Asm as soon as possible, since the server there tends to go in and out, and you may not be able to access it for a couple of weeks before it is rebooted.  Right now it seems to be online.

If you are taking a class on assembly language, chances are that you will write small programs for DOS for learning purposes.  If you will be writing practical programs (which most classes do not), you will most likely be integrating your code with another language in Windows (e.g. Visual C++).  Interfacing assembly language programs with Windows is much tougher, and the red tape that goes along with it will take a semester to learn in itself!!
0
 

Author Comment

by:Armandito
ID: 1182165
Hey, gimme an opinion.  I found out from someone else that Microsoft's MASM is also downloadable.  Which do you recommend?  MASM or NASM?  About making EXE's, our professor said we'll be doing that.  Thanks a lot for your help!
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182166
I don't know for sure if MASM is free, so I don't know.
I do know that MASM requires a lot of directives, which can make it very confusing.  NASM lets you build programs without using the directives but gives you the option of doing so.  So for ease of use I would probably say NASM.  MASM probably has less bugs however.  I really don't know.  Download both and see which you like better.

By the way, the online book assumes you are using MASM.  I am not exactly sure, but NASM may be compatible with MASM.
0
 

Author Comment

by:Armandito
ID: 1182167
Scrapdog, I have just downloaded both.  I'm not installing either of them quite yet.  But it looks like I will go with NASM because I was reading some documentation for MASM and MASM will not support Visual C++ 6.0, which is what I have.  Do you know of any compatability issues with NASM, Win98, and VC++6.0?

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1182168
Nope, I don't, because I normally don't use Visual C++.  You could look through the NASM website.  My guess is that if it doesn't now, it will soon.  NASM seems to be an ongoing project.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182169
>> MASM will not support Visual C++ 6.0,
In what way?  You can create programs that contain MASM and VC 6 code linked together.
0
 

Author Comment

by:Armandito
ID: 1182170
Nieto, go to this link.

http://www.microsoft.com/ddk/1ddk98.htm

It is the Info page for MS Win98 Device Driver Kit (DDK).
Supposedly the MASM comes with the DDK.  Now look on that page under system requirements for installation.  It says "Microsoft Visual C++ 6.0 is not currently supported."
I don't know how or in what way.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1182171
The DDK doesn't support VC 6.  That has nothing to do with MASM  All that means is that you can't write a device driver with VC 6 and the DDK.  

MASM neither supports or doesn't support VC 6.  They have nothing to do with each other in tha way.
0
 

Author Comment

by:Armandito
ID: 1182172
Oh, Ok.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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

12 Experts available now in Live!

Get 1:1 Help Now