Mail Archives: djgpp/2001/08/01/08:30:57
On Wed, 1 Aug 2001, Rafal Maj (Raf256) wrote:
> I have found quite interesting code, that returns exacly number of CPU
> cycles since last reset/power off.
>
> But I have this "program" writtne in Pascal, how can I translate this into
> C++ DJGPP inlie asembler ?
> 1) Can I write assembler instructions anywhere inside C++ code in DJGPP ?
Yes, you can use inline assembly; it's documented in the GCC manual.
> 2) How can I wrtie\compile in RHIDE assembler files (any tutuorial ?)
No need for any tutorials, just compile them as usual. GCC already
knows what to do.
> 3) Ther are two diffrent syntaxes of ASM AFAIK, with ist best, what are they
> names ?
See chapter 17 of the FAQ.
> 4) AFAIR assembler can be written using functions for calling interrupts,
> using
> inline($AA/...) statment or in real assebler syntax... I'm most interested
> in 3rd
> possibility...
I have no clue what you are talking about here.
> "e" - is a hmm... pointer to 64-bit integer
> 0fh is 0x0F in Pascal
> asm
> db 0fh, 31h
> db 66h
> mov c, dx
> db 66h
> mov e, ax
> end;
0F31h is the opcode of the RDTSC instruction. So there's nothing
exciting about this code, a couple of programs that use RDTSC were
posted here recently, perhaps in this very thread.
- Raw text -