Hi.

I am a C++ programmer.

I began learning 16-bit ASM and practice 16-bit ASM programming under DOS and MASM 6.x three weeks ago. I am very impressed with ASM and the control and simplicity ASM brings to programming. 16-bit ASM is so simple. Programmers have the most flexibility in terms of program design. I enjoy ASM programming and will definitely continue learning and practicing 16-bit ASM.

I have some basic, but essential, questions on implementing 16-bit, 32-bit, and 64-bit assembly in C++ programs.

1) Under what circumstances in additional to device drivers development do programmers use 16-bit and 32-bit ASM? I am most interested in 16-bit ASM when using ASM only.

2) Under what circumstances do C++ programmers incorporate 16-bit and/or 32-bit ASM in C++ programs? Please be as specific as possible. For example, under what conditions do 16-bit and 32-bit ASM out-perform C++? I am most interested in the Windows environment when using C++ and ASM.

Is it possible to apply 16-bit ASM in C++ Windows programs? Again, C++ does all the messaging. I want to incorporate ASM it is called for.

Thanks,
Kuphryn
Posted on 2002-09-20 23:55:29 by kuphryn
kuphryn,

You can run 16 bit code in 32 bit as long as you don't try and use segments at all but its poor code alongside true 32 bit code. The other virtue is that 32 bit code is simpler because it no longer deals with segments at all.

Most people writing C who use assembler do so for speed reasons, the days of assembler device drivers are almost over in windows, they are mainly done in C++ these days.

With a 32 bit C/C++ compiler like Visual C, you can either write inline assembler or write seperate modules in MASM, the latter is the better way to do it in most instances.

Comparisons sight unseen are impossible to do, if you really need to know where performance can be gained, decompile your own code and have a look at how the compiler does it and see if you can improve on the compiler code.

In many instances its not worth the effort but compilers are still a long way from competing with correctly written assembler so if you have a performance problem in you C++ code, you have the option of improving the performance with a module written in assembler. It really depends on how well you can learn assembler and how well you end up writing it.

Regards,

hutch@movsd.com
Posted on 2002-09-21 00:15:48 by hutch--
Nicely explained! Thanks.

You mentioned disassembling a C++ project in Visual C++. I am using Visual C++ .NET. Do you know the exact option to disassemble and maybe even view 32-bit ASM code right next to or in another window of the C++ code?

Kuphryn
Posted on 2002-09-21 00:25:01 by kuphryn

Nicely explained! Thanks.

You mentioned disassembling a C++ project in Visual C++. I am using Visual C++ .NET. Do you know the exact option to disassemble and maybe even view 32-bit ASM code right next to or in another window of the C++ code?

Kuphryn


Kuph,

I have VC++6 and if you wish to view the ASM code right next to the C++ code, you just right click the editor and click "Go to dissassembly"...Also there are settings in VC++ to output ASM files with each build...

For a normal Dissassembler, I believe the MASM package supplies one in the /BIN folder
Posted on 2002-09-21 02:00:03 by Fordy
Okay. Thanks.

Visual C++ .NET interface is different. I will look into how to get it to show the ASM code for a C++ code.

Kuphryn
Posted on 2002-09-21 12:01:08 by kuphryn
Right click on (MyProject)->properties->C/C++->output files

output files->assembler output

Select what type of listing you want.
Posted on 2002-09-21 15:02:06 by ThoughtCriminal
Perfect! Thanks.

Kuphryn
Posted on 2002-09-21 15:14:12 by kuphryn