News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Int 10h

Started by Sandokan, July 18, 2006, 06:51:01 PM

Previous topic - Next topic

Sandokan

Hello, I'm new here and already have a question. :)

I wrote an assembler program (using __asm) in MS VC++ 6.0, and I cannot use "int 10h" or any other bios interrupt. As far as I know this is related with the program running in protected mode. Is there any way to make it work?

Thank you!

Mark Jones

Hello Sandokan, and welcome to the group.

Your question is very vague, could you elaborate? Are you trying to do an INT 10h from Windows 32-bit mode? Thanks.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Sandokan

Yes, I think I'm trying to do an int 10h from windows 32-bit mode. The program is written in a "Win32 Console Application" type project.
The program is like this:

----------------------------------------

#include <stdio.h>

...
c++ code
....
__asm
{
   mov dl,1
   lea ebx,r
...
}
c++ code

-------------------------------------------

The program is running perfectly.
Inside the "__asm" sequence I want to use "Int 10h". When I use it, the program is giving me an error message.

hutch--

Sandokan,

Welcome ob board. In 32 bit Windows you cannot use the INT10H functions at all and for a console based 32 bit app, you use the normal console API function calls. They do the normal IO with no problems but note that in comparison to 16 bit DOS console apps, they are slower at screen upgrades and the like.

I know the name Sandokan as a very famous pirate from the Malay Peninsular.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sandokan

Thank you!
Yes, Sandokan was a famous fighter for liberty in Malaysiya, although I don't think it was a real person. (http://www.deadmentellnotales.com/onlinetexts/sandokan/sandokan.shtml)
I don't have anything to do with Malaysya, as I am from Romania, I just like the name.

One more question: I want to use instructions like "CLI", "STI", "mov ds,ax", etc. Normally this is no possible because of the insufficient privilege level (CPL) the program has, and therefore I receive an error message. How can I change this privilege level?

Thanks again.

hutch--

Sandokan,

You need to learn the architecture of 32 bit Windows if you wish to write 32 bit code as instrucions of that type are not available at ring3 access. If you had a need you could write a driver for the specific OS version but its not an easy task. I would look for another way to do what you are after if what you are writing is an application.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sandokan

I wrote a program in C++ code, and another version in C++ & asembler(for the time consuming section), just to see the difference in between. My results shows the assembler is 3-4 times faster than C++. The program is calculating the knight movement over a chess board, until is filling it, passing only one time through each square.
I was wondering what happens if I turn off the interrupts (cli), meaning how much time I will save. Anyway, this seems like a very hard task, especially for me, which I am not a programmer, I am doing this just for fun.
As I know so far is the CS bits 0 & 1 shows the privilege level of the program,  but I don't know any way to change them.
If you have a web-link to something useful, I will appreciate.

Thanks again.

akalenuk

Quote from: Sandokan on July 19, 2006, 12:33:39 PM
I wrote a program in C++ code, and another version in C++ & asembler(for the time consuming section), just to see the difference in between.

Try writing 16bit application and then running it under plain dos. That'll be really fast. And you can use interupts and "cli"/"sti" there. You may also write 16bit application with interrupts and then run it under windows, but you sure can not use interrupts in windows application. You see, windows is a multitask system, so one task may not be allowed to interrupt a processor, which is used for all the applications. For 16bit applications windows creates a virtual machine, so the program thinks it's running in the real mode.

Sandokan

@ akalenuk : Yes, you are right, this is the way I should do next. Really thanks.