NO

Author Topic: Cannot access interrupts..  (Read 7252 times)

Deth

  • Guest
Cannot access interrupts..
« on: April 09, 2007, 04:26:42 PM »
Hi,
It seems to me to have a simple fix, but I still can't get to it.  ???
Why code just like this one gives me an error: "Access violation!"
I tried to trace into an interrupt call but it falls stright into an exception call.
void setVideoMode()
{
    _asm
     {
         mov ah,00h
         mov al,03h
         int 10h        //Here it falls.
      }
}

Thank you in advance.

Offline Robert

  • Member
  • *
  • Posts: 245
Re: Cannot access interrupts..
« Reply #1 on: April 10, 2007, 04:26:24 AM »
DOS interrupt calls can not be made in Windows.

Robert Wishlaw
« Last Edit: April 10, 2007, 05:15:01 AM by Robert »

Deth

  • Guest
Re: Cannot access interrupts..
« Reply #2 on: April 10, 2007, 09:12:39 AM »
Thank you, Robert.
I suspected this reason, but how can I access any system routines?
Is it only through Windows API or dos.h? I thought that since my program runs in DOS session it should be accessible, 'cos when I compile similar code in Assembly it runs. 
Could you please explain me shortly the difference between codes compiled from C and Assembly from the point of view of Windows or maybe there is some written topic about?

Thnx.

severach

  • Guest
Re: Cannot access interrupts..
« Reply #3 on: April 21, 2007, 03:23:49 AM »
http://en.wikipedia.org/wiki/Win32_console
http://sourceforge.net/projects/conio/

A Win32 console program may look like a DOS program but it uses the Win32 API and runs in 32 bit protected mode. It isn't obvious because the DOS prompt customizes its behavior to match the type of program it's running.

A 16-bit DOS program in a Windows DOS prompt uses an emulated DOS API. Pelles does not compile DOS programs. Find another compiler. I use Borland C++ 3.1 for DOS.

Which you choose depends on where your program is expected to run. If you never need to run from a real MS-DOS boot disk then a Win32 console program will be faster and more capable. You just need to find the equivalent calls to do what you want. Most of those DOS calls have something similar in the Win32 API.

You can write in assembly in Windows but you should first look at some compiled C code to see what the assembly should look like on the platform you're working on. You may decide that it's just better to let the C compiler handle it.

Deth

  • Guest
Re: Cannot access interrupts..
« Reply #4 on: April 22, 2007, 09:07:03 AM »
Thank you for clear explanation, Severach  ;)