How to compile RDTSC instruction in MSDOS mode 
Author Message
 How to compile RDTSC instruction in MSDOS mode

Can anyone help me?

I write a C program and part of it I insert an inline assembly code that
contains the RDTSC (read time-stamp counter) instruction to measure the
Pentium MMX cycle count. (for more information about the RDTSC
intruction, please go to
http://www.*-*-*.com/
< http://www.*-*-*.com/ ;  ). The RDTSC
instruction is located in the inline assembly code in the C program, as
follow

main()
{
/*my program C code */

asm  {  
      rdtsc
     }
/*my program C code*/

Quote:
}

Do you know which C/C++ compiler can compile the mixed C code and inline

assembly code (inside the C program) that contain the RDTSC instruction
and generate a .exe file that can run in MSDOS mode? Or in other words,
which C/C++ DOS compiler can recognize the RDTSC instruction?

If I use MS Visual C++ Ver 5/6 to compile and generate the DOS .exe
file,
the .exe file generated will not be able to run in MSDOS mode (It only
can
run in MS windows environment).

The MASM ver 6.11 software can recognise the RDTSC instruction, but it
is impossible for me to write my C program code in assembly code and
generate
the DOS executable file.

The Borland C++ Ver 5.0 and Turbo C++ ver 3.0 software can generate can
generate a DOS executable file (*.exe) but cannot recognize the RDTSC
instruction.

So, can you recommend/ suggest to me, what can/should I do, so that I
can
generate the DOS executable file from a C program that has inline
assembly
code with RDTSC instruction inside?


you can.

Yours faithfully,

Tan Kok Leong
Instrumentation & System Engineering Lab
Division of Control & Instrumentation
S1-B4b-06, School of EEE
Nanyang Technological University
Nanyang Avenue
Singapore 639798
Tel: 65-790 5472

Yours faithfully,

Tan Kok Leong
Instrumentation & System Engineering Lab
Division of Control & Instrumentation
S1-B4b-06, School of EEE
Nanyang Technological University
Nanyang Avenue
Singapore 639798
Tel: 65-790 5472



Sat, 17 Nov 2001 03:00:00 GMT  
 How to compile RDTSC instruction in MSDOS mode

You could compile an assembly routine with the instruction into an .OBJ file and link it with any standard DOS C compiler's linking program.

Or -- you could simply imbed the machine code representation of the RDSTC instruction via DB statements in your inline assembly instead of using the instruction RDSTC directly.

Hope this helps...

    Can anyone help me?

    I write a C program and part of it I insert an inline assembly code that contains the RDTSC (read time-stamp counter) instruction to measure the Pentium MMX cycle count. (for more information about the RDTSC intruction, please go to http://www.intel.se/drg/pentiumII/appnotes/RDTSCPM1.htm ). The RDTSC instruction is located in the inline assembly code in the C program, as follow

    main()
    {
    /*my program C code */

    asm  {  
          rdtsc
         }
    /*my program C code*/
    }

    Do you know which C/C++ compiler can compile the mixed C code and inline
    assembly code (inside the C program) that contain the RDTSC instruction
    and generate a .exe file that can run in MSDOS mode? Or in other words,
    which C/C++ DOS compiler can recognize the RDTSC instruction?

    If I use MS Visual C++ Ver 5/6 to compile and generate the DOS .exe file,
    the .exe file generated will not be able to run in MSDOS mode (It only can
    run in MS windows environment).

    The MASM ver 6.11 software can recognise the RDTSC instruction, but it
    is impossible for me to write my C program code in assembly code and generate
    the DOS executable file.

    The Borland C++ Ver 5.0 and Turbo C++ ver 3.0 software can generate can
    generate a DOS executable file (*.exe) but cannot recognize the RDTSC
    instruction.

    So, can you recommend/ suggest to me, what can/should I do, so that I can
    generate the DOS executable file from a C program that has inline assembly
    code with RDTSC instruction inside?


    Yours faithfully,

    Tan Kok Leong
    Instrumentation & System Engineering Lab
    Division of Control & Instrumentation
    S1-B4b-06, School of EEE
    Nanyang Technological University
    Nanyang Avenue
    Singapore 639798
    Tel: 65-790 5472

    Yours faithfully,

    Tan Kok Leong
    Instrumentation & System Engineering Lab
    Division of Control & Instrumentation
    S1-B4b-06, School of EEE
    Nanyang Technological University
    Nanyang Avenue
    Singapore 639798
    Tel: 65-790 5472



Sat, 17 Nov 2001 03:00:00 GMT  
 How to compile RDTSC instruction in MSDOS mode

Quote:
> I write a C program and part of it I insert an inline assembly code that
> contains the RDTSC (read time-stamp counter) instruction to measure the
> Pentium MMX cycle count. (for more information about the RDTSC
> intruction, please go to
> http://www.*-*-*.com/
> < http://www.*-*-*.com/ ;  ). The RDTSC
> instruction is located in the inline assembly code in the C program, as
> follow

In MSC, try something like

        __int64 tscStart;
        //__asm rdtsc
          __asm _emit 0x0F
          __asm _emit 0x31
        __asm mov dword ptr tscStart,  eax
        __asm mov dword ptr tscStart+4,edx

0x0F,0x31 is the opcode for rdtsc...

--- Tom


TA Software Systems
C{*filter*}tesville, VA, USA



Mon, 19 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Page fault when compile using Release mode but not Debug mode

2. (MSDOS C) Displaying black text on coloured background in graphics mode

3. How to compile Arm assembler instruction

4. detailed instructions to compile stlport with evc++ 3.0?

5. prefetchnta instruction not in 386 instruction set

6. Pentium RDTSC timer (+GNU inline assembly) CPUID crashes

7. RDTSC VC++6.0

8. upgrade to WTL7.0 cause compile error in debug mode

9. Set a compiling mode

10. ATL COM client program using DAO compiles and links OK in Debug BUT NOT Release mode

11. Compiling a console app for dos mode?

12. Help Me: Exception compiling in Release Mode

 

 
Powered by phpBB® Forum Software