inline asm / int 10h in MFC code?

inline asm / int 10h in MFC code?

Post by Don Metzle » Fri, 10 Jul 1998 04:00:00



I want to call the VESA VBE/PM Get Capabilities function rfom inline
Assembler in my MFC code.  I am using VC++ 5.0 (all service packs installed)
to compile.

To set up the call:

AX = 4F10h
BL = 00h
ES:DI = 0000h:0000h

(see http://www.ctyme.com/intr/RB-0273.HTM for more information on the call)

Return:
AL = 4Fh if the function is supported
AH = call status

My _asm block looks like:

short    ZERO = 0x0000;

_asm
{
    push    di

    mov    ax,4f10h
    mov    bl,00h
;    mov    es,0000h    ; causes compiler to generate an error C2415 :
improper operand type
    mov    es,ZERO
    mov    di,ZERO

    int    10h

    ; check return codes, etc.

Quote:}

Questions:

1) Why does the compiler generate a C2415 error when attempting to move
0000h into es or di?
2) The above call causes a system crash.
    2a) Is this coded correctly?
    2b) Is there a problem making this call in Win32?

Any/all help much appreciated.

Thanks,

Don Metzler
Barefoot Productions, Inc.
http://www.barefootinc.com

 
 
 

inline asm / int 10h in MFC code?

Post by Brad Wilso » Sat, 11 Jul 1998 04:00:00


Quote:>1) Why does the compiler generate a C2415 error when attempting to move
>0000h into es or di?

You need to find a new way to do what you want.  The VESA BIOS extensions
are real mode (DOS), and your application is protected mode (95/98/NT).

-- Brad Wilson, student of Objectivism -------- bradw<at>pobox<dot>com --
"I would remind you that  extremism in the defense of liberty is no vice!
And let me remind  you also that moderation in the  pursuit of justice is
no virtue!"   - Barry Goldwater

 
 
 

inline asm / int 10h in MFC code?

Post by Michael Gea » Sat, 11 Jul 1998 04:00:00



>I want to call the VESA VBE/PM Get Capabilities function rfom inline
>Assembler in my MFC code.  I am using VC++ 5.0 (all service packs installed)
>to compile.

You've gotten a few answers correctly indicating that you can't get
there from here, and DirectX probably is what you're looking for.

Quote:>;    mov    es,0000h    ; causes compiler to generate an error C2415 :
>improper operand type

>1) Why does the compiler generate a C2415 error when attempting to move
>0000h into es or di?

Just in case you're still curious about the ES register issue, it's
just that a MOV into a segment register can't take a constant operand.
It's different from a MOV into a general register. So you would
typically see code like this:

   xor ax, ax
   mov es, ax

You *can* move a constant directly into DI (or EDI):

   mov di, 0

is perfectly legal. But you'll rarely see it, because compilers (and
people) usually use the more compact:

   xor di, di

-Mike

(p.s. Let's continue the discussion in the newsgroup. If you do
want to send email, delete the "X" from my email address or follow
the link at www.geary.com. Sorry for the anti-spam inconvenience.)

 
 
 

inline asm / int 10h in MFC code?

Post by Don Metzle » Sat, 11 Jul 1998 04:00:00


I thought so.  It is an int 10h call, but I am querying the ability of a
machine to enter suspend mode.  How would DirectX be able to help with this?
(The program is a shutdown utility.)

Is there any other way around this (querying if a machine can suspend)?

Thanks,

Don

Quote:> > I want to call the VESA VBE/PM Get Capabilities function
> > rfom inline Assembler in my MFC code.  I am using VC++ 5.0
> > (all service packs installed) to compile.

>Since you are using VC5, you are generating code for a protected-mode OS
>(NT) or one that tries to look like a protected-mode OS (95/98).

>In such an environment, you cannot call the VESA BIOS, as it requires
>your CPU to run in real or V86 mode.

>Considering that direct INT 10h (and direct use of video memory) is
>usually the domain of games, might I suggest you look at DirectX?

 
 
 

inline asm / int 10h in MFC code?

Post by Felix Kasza [MV » Sun, 12 Jul 1998 04:00:00


Don,

 > I am querying the ability of a machine to enter suspend mode.
 > How would DirectX be able to help with this?

It wouldn't. My D-X referral was based on probabilities.

I never played with suspend mode; servers are my bag, and they don't
usually go into standby ...

--

Cheers,

Felix.

If you post a reply, kindly refrain from emailing it, too.

No anti-spam address here. Just one comment: IN YOUR FACE!

 
 
 

inline asm / int 10h in MFC code?

Post by Brad Wilso » Sun, 12 Jul 1998 04:00:00


Quote:>Is there any other way around this (querying if a machine can suspend)?

You'll need to write a device driver.  Have fun.  The DDK can be an ugly
thing for the uninitiated.  :-)

-- Brad Wilson, student of Objectivism -------- bradw<at>pobox<dot>com --
"I would remind you that  extremism in the defense of liberty is no vice!
And let me remind  you also that moderation in the  pursuit of justice is
no virtue!"   - Barry Goldwater

 
 
 

inline asm / int 10h in MFC code?

Post by Mohanra » Sun, 12 Jul 1998 04:00:00


You can write a 16-bit program if you want to call interrupts.
Check out handler sample code in VC++ 1.5.

Mohanraj
Samsung India Software Operations
Bangalore-560 001.
India.


> I want to call the VESA VBE/PM Get Capabilities function rfom inline
> Assembler in my MFC code.  I am using VC++ 5.0 (all service packs installed)
> to compile.

> To set up the call:

> AX = 4F10h
> BL = 00h
> ES:DI = 0000h:0000h

> (see http://www.ctyme.com/intr/RB-0273.HTM for more information on the call)

> Return:
> AL = 4Fh if the function is supported
> AH = call status

> My _asm block looks like:

> short    ZERO = 0x0000;

> _asm
> {
>     push    di

>     mov    ax,4f10h
>     mov    bl,00h
> ;    mov    es,0000h    ; causes compiler to generate an error C2415 :
> improper operand type
>     mov    es,ZERO
>     mov    di,ZERO

>     int    10h

>     ; check return codes, etc.

> }

> Questions:

> 1) Why does the compiler generate a C2415 error when attempting to move
> 0000h into es or di?
> 2) The above call causes a system crash.
>     2a) Is this coded correctly?
>     2b) Is there a problem making this call in Win32?

> Any/all help much appreciated.

> Thanks,

> Don Metzler
> Barefoot Productions, Inc.
> http://www.barefootinc.com


 
 
 

inline asm / int 10h in MFC code?

Post by Brad Wilso » Sun, 12 Jul 1998 04:00:00


Quote:>You can write a 16-bit program if you want to call interrupts.
>Check out handler sample code in VC++ 1.5.

Won't work in NT.

-- Brad Wilson, student of Objectivism -------- bradw<at>pobox<dot>com --
"I would remind you that  extremism in the defense of liberty is no vice!
And let me remind  you also that moderation in the  pursuit of justice is
no virtue!"   - Barry Goldwater

 
 
 

inline asm / int 10h in MFC code?

Post by William Garriso » Mon, 13 Jul 1998 04:00:00


What you are missing is that Microsoft has intentionally hidden the
function calls you need -- but they are there.  My suggestion is to use
an old compiler.  I keep Borland C++/Windows 3.1 around for just such
needs.  It has functions such as int86, intr, etc. which officially do
not work.  Obviously they do, and will until Windows can do such things
as what you need.  

1) You can make a DLL that does a real mode callback and returns the
registers in a structure.  I'm sure the ability exists in Win32, but
none of the header files contain these functions.  Worst case, I believe
2) You can call INT 31h, Function 03h, Subfunction 00h -- "Simulate Real
Mode Interrupt"
         Or try INT 31h, Function 03, Subfunction 02h -- "Call Real Mode
Procedure With IRET Frame"

Either way, you should be vaguely familiar with the way the system
handles real-mode segments -vs- protected mode selectors, that way you
understand why mov es,xxxxx will likely crash in protected mode.  A good
interrupt reference can show you how to call these functions, or just
use method #1.


> I want to call the VESA VBE/PM Get Capabilities function rfom inline
> Assembler in my MFC code.  I am using VC++ 5.0 (all service packs installed)
> to compile.

 
 
 

1. inline ARM ASM or how to link to ARMASM function?

Hi,
        I need to execute some arm assemble how ever I don't think evc supports
inline ASM on the ARM target. If it can be done how, if not how do I
link to an external compiled arm asm compiled with armasm?

Thnaks in advance

2. volume mixer controller

3. Inline ASM for ARM

4. Changing Motherboard in XP Environment

5. ARM inline asm for Embedded

6. START UP PROBLEMS

7. inline asm use

8. folder protection

9. inline asm..

10. Inline x86 asm: must save regs?

11. Help!-Debug Error in MFC code when MFC destroys frame window

12. How could the code be portable with MFC or not MFC?

13. Use MFC to generate Win16 & Mac code from same source code?