I got some source code on net for displaying 256 bit bmp in turbo c++ which is using some assembly codes (actually using asm---about which I don't know anything). Unfortunately during compilation it give an error saying "286/287 instructions not enabled". Help me troubleshooting this problem.

post the assembly code that's in your program, e.g.

    asm {
        mov ax,1
        mov bx,ax
    }

The problem is that Turbo C++ 3.0 is an ancient 16bit compiler from 1991, and it will, by default, compile the code for the 8086 architecture (which dates back to 1978). The inline assembly in that code you are trying to compile probably uses more "recent" instructions from the 80286/80287 architectures (from 1982). You need to tell the compiler that you want the code to be compiled for that architecture, i.e., the command-line option for that is -2 (see here). If the assembly code actually uses any instructions that are more recent than 286/287, you're in trouble, because your compiler will never be able to compile it (it doesn't understand anything more recent than that).

The other option would be to upgrade to a more recent version if possible (does that code require the use of Turbo C++ 3.0?).

The site from where I had downloaded the source code had publishes the source code with the tag that it is written in turbo c++. So I think it will work in it. But u said I have to tell the compiler to use recent architecture, but how can I do that??

The code is like this:

asm {

    shl dx,6
};

I have ommited Starting and ending curly braces as I m not familiar with daniweb markdown syntax.

NOTE: I added the curly braces (to write code, you just write it, then select it, and hit the "Code" button on the editor or the tab-key on your keyboard).

But u said I have to tell the compiler to use recent architecture, but how can I do that??

The command-line option is -2. That means, when you write out the MS-DOS command to compile the code, you must add the -2 somewhere (anywhere) on the same line as the command.

If you are using the Windows version of Turbo C++ 3.0 (does one exist?? can it still run on any computer that is recent enough to be connected to the internet?), then look through the "build options" or "compilation configuration" or whatever it's called, and try to find either somewhere where there is an edit box that says something along the lines of "custom command-line compiler options" and enter -2 (dash and two), or you might be able to find a check-box somewhere that says "80286" or "286/287" or "286-protected mode".

I cannot give you detailed explanations (I doubt anyone could), this compiler dates back to when I was 6 years old. It is an old and forgotten compiler (and development environment).

Inline assembly is, as far as I know, not very portable between compilers, so I doubt that you could get the code to compile on another compiler. But, at least, try something more modern from the same family of compilers (Borland), like Turbo C++ 4.5, or Borland C++ 5.0 / 5.5, or some version of Borland C++Builder. I believe some of those are available for free (i.e., they're so old that it would be a crime to charge for them).

Thanks. I found it under options menu. And now its running awesomly. :-)
And also thanks for telling me that code syntax thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.