Using _asm in visual c++

Using _asm in visual c++

Post by ruppel » Thu, 20 Jul 2000 04:00:00



Hi everybody,

I am using Microsoft Visual c++ Ver.5.0. I want to programm assembler code
in a method,like the following:

X::test(int x)
{
__asm
{
        jmp start
jumpvector:
        DW t1
        DW t2
t1:     any code
            jmp leave
t2:     any code
        jmp leave

start:  any code using the adresses in jumptable to jump to t1 or t2
leave:

Quote:}
}

How can I implent this jumptable, which should be seen as a list of
adresses of code starting at t1 or t2.
I want to perform an indirect jump to t1 or t2 using the label jumptable.
While compiling I always get an
error "Opcode: constant found". How can i implement the jumpvector in
assembler?

Kind regards, Andi.

 
 
 

Using _asm in visual c++

Post by John Harriso » Thu, 20 Jul 2000 04:00:00



Quote:> Hi everybody,

> I am using Microsoft Visual c++ Ver.5.0. I want to programm assembler code
> in a method,like the following:

> X::test(int x)
> {
> __asm
> {
> jmp start
> jumpvector:
> DW t1
> DW t2
> t1: any code
>             jmp leave
> t2: any code
> jmp leave

> start:  any code using the adresses in jumptable to jump to t1 or t2
> leave:
> }

> }

> How can I implent this jumptable, which should be seen as a list of
> adresses of code starting at t1 or t2.
> I want to perform an indirect jump to t1 or t2 using the label jumptable.
> While compiling I always get an
> error "Opcode: constant found". How can i implement the jumpvector in
> assembler?

> Kind regards, Andi.

We don't get many assembly programming questions on c.l.c++. Needless to say
its off topic. Perhaps you could try an NG devoted to either Visual C++ or
x86 assembly programming.

john

 
 
 

Using _asm in visual c++

Post by Ivan A. Teblyashki » Fri, 21 Jul 2000 04:00:00


 Have you tried "dw offset tx"? (I use "asm" under BC and don't know if it's
suitable in VC)

>Hi everybody,

>I am using Microsoft Visual c++ Ver.5.0. I want to programm assembler code
>in a method,like the following:

>X::test(int x)
>{
>__asm
>{
> jmp start
>jumpvector:
> DW t1
> DW t2
>t1: any code
>            jmp leave
>t2: any code
> jmp leave

>start:  any code using the adresses in jumptable to jump to t1 or t2
>leave:
>}

>}

>How can I implent this jumptable, which should be seen as a list of
>adresses of code starting at t1 or t2.
>I want to perform an indirect jump to t1 or t2 using the label jumptable.
>While compiling I always get an
>error "Opcode: constant found". How can i implement the jumpvector in
>assembler?

>Kind regards, Andi.

 
 
 

Using _asm in visual c++

Post by Richard van Meur » Fri, 21 Jul 2000 04:00:00


Andi,

The labels to which your asm statements can 'jump' must be ordinary C++
labels. So, you need to place all non-label stuff in __asm { ... } and put the
labels in between. So your asm code would look something like this:

{
    ...
    __asm {
        jmp start
    }
    jumpvector:
    __asm {
        dw    offset t1
        dw    offset t2
    }
    t1:
    __asm {
        ..... asm instructions .....
        jmp    exit
    }
    t2:
    __asm {
        ..... asm instructions .....
        jmp    exit
    }
    exit:

Quote:}

Hope this helps,

Richard van Meurs
ANVA.


> Hi everybody,

> I am using Microsoft Visual c++ Ver.5.0. I want to programm assembler code
> in a method,like the following:

> X::test(int x)
> {
> __asm
> {
>         jmp start
> jumpvector:
>         DW t1
>         DW t2
> t1:     any code
>             jmp leave
> t2:     any code
>         jmp leave

> start:  any code using the adresses in jumptable to jump to t1 or t2
> leave:
> }

> }

> How can I implent this jumptable, which should be seen as a list of
> adresses of code starting at t1 or t2.
> I want to perform an indirect jump to t1 or t2 using the label jumptable.
> While compiling I always get an
> error "Opcode: constant found". How can i implement the jumpvector in
> assembler?

> Kind regards, Andi.

 
 
 

Using _asm in visual c++

Post by Andre van der Mer » Fri, 21 Jul 2000 04:00:00


Quote:>    jmp start
>jumpvector:
>    DW t1
>error "Opcode: constant found". How can i implement the jumpvector in
>assembler?

Use the MS _emit keyword to define data

eg  
   _emit 0x90
   _emit 0x90
   _emit 0x90
   _emit 0x90

hth


http://users.iafrica.com/d/da/dart/zen/zen.html

 
 
 

1. Announce: PluginMaker for Navigator plug-ins using MFC and Visual C++ 4

We are pleased to announce the PluginMaker: software for
creating Netscape Navigator plug-in DLLs using MFC and
Visual C++ version 4.

PluginMaker includes an AppWizard which makes creating
plug-ins as easy as typical Visual C++ AppWizard application
frameworks.  Plug-ins created by PluginMaker will run
under Navigator version 2, yet can take advantage of
newer features when running under Navigator version 3.
16-bit plug-ins can also be created.  Java/JavaScript
interfaces can be created via LiveConnect, and
used when running under v3.

Dialog-based plug-ins are available, making
it simple to put Windows "Controls" in the
plug-ins.  Alternatively, the familiar
document/view model may be used for creating
the plug-ins.

Visual C++ version 4 is required.

For downloading a free evaluation
copy of PluginMaker, please visit
our home page at

  http://www1.usa1.com/~desisoft/

Questions and comments may be addressed

2. Problems with Frame 6.0p405 on NTsp6?

3. Shutdown restarts...

4. Writing MMC Snap-Ins Using Visual Basic?

5. Serial Connection on Solaris

6. Excel add-ins (XLLs) in Visual C++

7. Abraxas CodeCheck Tool Questions Any Users Out There?

8. Visual C++ 5.0 Power Add-Ins

9. Using Visual C++ to Create an Event for Visual Basic

10. Export function from Visual C++ to be used in Visual Basic