q:Programming windows... 
Author Message
 q:Programming windows...

Hi.  I have a question about programming in windows; it's sort of a general question.
First, programs can run in one of two modes, real mode and protected mode, right?
I assume the same is true for operating systems.  Are there any other modes that the processor
can be in?  Next, is windows 95 always in protected mode?  I have been told that when
win 95 runs a 16-bit application, the processor changes to real mode.  Also, I am
aware (more or less) of how NT seperates the OS from the programs running in it, but
I'd like to know some specifics.  For example, you can run doom in 95 and hear sounds
fine, but in NT, you have to turn off the sounds in order for it to run; this is because
Doom "access the hardware directly" -- what exactly does this mean??? Does it mean that
it's trying to run as if the processor is in real mode and tried to execute an instruction
like "int 21h"? I'm sure this is not what it means because I can compile a simple program
like that and run it in NT fine. So, It must mean something specific when it says that
a program is "trying to access the hardware directly".

Also, is 95 still just windows on top of dos (just implemented better) or is dos actually
using the 95 kernel? I have discussed this at great lengths with a friend of mine but
to honest, neither one of us are qualified to answer that.

During your answers, if you could site sources on the net or books where you got your
information, I would be grateful.  Thanks in advance to whomever can help.

Dave



Fri, 27 Aug 1999 03:00:00 GMT  
 q:Programming windows...


Quote:
>Hi.  I have a question about programming in windows; it's sort of a general question.
>First, programs can run in one of two modes, real mode and protected mode, right?

There is another mode: Virtual 86 mode. This is a special instance of
protected mode, but it behaves much like real mode. Leventhal
described this as an {*filter*} behaving like a child. (Protected is {*filter*},
real is child).
Quote:
>I assume the same is true for operating systems.  Are there any other modes that the processor
>can be in?  Next, is windows 95 always in protected mode?  I have been told that when
>win 95 runs a 16-bit application, the processor changes to real mode.  

Not exactly. It switches to V86 mode. Most real mode programs run
equally well in V86 mode, but there are programs that don't, because
they try to use address offsets higher than 0000FFFF, with the prefix
67h

Quote:
>Doom "access the hardware directly" -- what exactly does this mean???

It means that the program sends commands to the hardware by writing to
the soundcard's ports, writing and reading the serial and parallel
ports, writing and reading video memory. Other programs give commands
to the OS, or to a driver, and the OS or the driver sends commands to
the hardware. This is slower, but often safer.

Quote:
>Also, is 95 still just windows on top of dos (just implemented better) or is dos actually
>using the 95 kernel?

They say it is Windows on top of DOS.

Unauthorized W 95 Developer's resource kit by Andrew Schulman
ISBN 1-56884-306-4
---
Feico Nater, Netherlands
---
In matters of trade the fault of the Dutch
is offering too little and asking too much.



Fri, 27 Aug 1999 03:00:00 GMT  
 q:Programming windows...


Quote:
> Hi.  I have a question about programming in windows; it's sort of a genera
> First, programs can run in one of two modes, real mode and protected mode,
> I assume the same is true for operating systems.  Are there any other mode

There are other modes, but they're just protected mode at different privelege
levels (V86 mode, for example).

Quote:
> can be in?  Next, is windows 95 always in protected mode?  I have been tol
> win 95 runs a 16-bit application, the processor changes to real mode.  Als

Nope.  If it switched to real mode, it would quit multitasking because all
the multitasking code in Win95 is written in protected mode (as evidence that
it's multitasking, I'm typing this in a 16-bit DOS based BBS program under
Win95 and another node of this BBS is making callouts as I type).  It
switches to V86 mode, which is protected mode (I forget which privelege
level, it was either 0 or 3, I need to look in my PMODE docs again, it's been
a while).  V86 mode is capable of running real mode and protected mode
programs, most DPMI and VCPI hosts (EMM386.EXE, QEMM, Windows, etc) put you
in V86 mode by default for just this reason.

Quote:
> Doom "access the hardware directly" -- what exactly does this mean??? Does
> it's trying to run as if the processor is in real mode and tried to execut
> like "int 21h"? I'm sure this is not what it means because I can compile a

Doom runs in protected mode (the DOS4GW screen that comes up when you run it
is a dead giveaway of this if you're experienced with DOS extenders and
32-bit compilers).  By "access the hardware directly" it usually means that
the program directly access the memory and/or port addresses of the hardware,
rather than using DOS, BIOS, or some TSR or device driver to handle the
access.  "int 21h" is DOS, do it would be the opposite of accessing the
hardware directly, it would be accessing through DOS.

Quote:
> Also, is 95 still just windows on top of dos (just implemented better) or
> using the 95 kernel? I have discussed this at great lengths with a friend
> to honest, neither one of us are qualified to answer that.

It's DOS.  You can run the DOS that comes with Win95 without ANY of Windows
being there (other than 3 drivers that are loaded by IO.SYS on bootup in
MSDOS 7 which aren't even used by DOS, only by Windows).  It's DEFINATELY
implemented better than Win3.x though, Win95 takes over MOST of DOS's
functions when it loads, only passing control to DOS when it absolutely
must.  Also, if you try to run Win95 from any version of DOS other tham MSDOS
7.0 (the DOS that comes packaged with Win95), it gives you a message
something like:

This version of Windows requires MS-DOS 7.00 or greater.

Quote:
> During your answers, if you could site sources on the net or books where y
> information, I would be grateful.  Thanks in advance to whomever can help.

Sorry, no sources other than personal experience (and not much of it) and the
docs for PMODE by Tran (which I didn't quote from) which can be found on the
web.

-steve



Fri, 27 Aug 1999 03:00:00 GMT  
 q:Programming windows...

This should be moved to alt.windows.programming or something.

Quote:
> programs can run in one of two modes, real mode and protected
>mode, right?

Right.

Quote:
> Are there any other modes that the processor can be in?

No.

Quote:
>Next, is windows 95 always in protected mode?

Except when restarting is DOS mode.

  I have been told that when

Quote:
>you can run doom in 95 and hear sounds fine, but in NT, you
>have to turn off the sounds because Doom "access the hardware
>directly" -- what exactly does this mean???

Generally, it refers to port access (ins and outs).

Quote:
> is 95 still just windows on top of dos

Initially - until it finishes booting: file access is still DOS, disk
access/cd-rom/network is protected mode stuff.


Sat, 28 Aug 1999 03:00:00 GMT  
 q:Programming windows...


Quote:


>> can be in?  Next, is windows 95 always in protected mode?  I have been tol
>> win 95 runs a 16-bit application, the processor changes to real mode.  Als

>Nope.  If it switched to real mode, it would quit multitasking because all
>the multitasking code in Win95 is written in protected mode (as evidence that
>it's multitasking, I'm typing this in a 16-bit DOS based BBS program under
>Win95 and another node of this BBS is making callouts as I type).  It
>switches to V86 mode, which is protected mode (I forget which privelege
>level, it was either 0 or 3, I need to look in my PMODE docs again, it's been
>a while).  V86 mode is capable of running real mode and protected mode
>programs, most DPMI and VCPI hosts (EMM386.EXE, QEMM, Windows, etc) put you
>in V86 mode by default for just this reason.

V86 always runs in ring 3.  CS is a selector in protected mode and
the least significant two bits determine the current privilege
level.  But V86 code must interpret the current CS differently and
the least significant two bits are no longer available for that
use.  Thus, V86 is "hard coded" as ring 3.

Jon



Tue, 31 Aug 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Program Windows in BASIC for Free

2. VW2.0 Executing other programs (Windows)

3. Anyone programming Windows apps in Forth?

4. Charles Petzold's Programming Windows,good?

5. C/FORTRAN Programming, Windows NT

6. Problem embedding multithreaded python into GUI program (Windows)

7. How does one pass Unicode command line arguments to Tcl program (Windows 2000)

8. Help !! Need "Programming Windows 3.1" by Petzold

9. Windows program call DOS program

10. comm ports/shell out from DOS program to execute Windows program

11. Start of a windows-program out of a COBOL-program / file-encoding

12. adding program to windows 'programs' menu

 

 
Powered by phpBB® Forum Software