#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
long i;
int a;
int b;
int rest[3000];
int resttmp;
int restdiff;
void main()
{
for (i=0; i<100; i++)
{
outp(0x43,52);
outp(0x40, 255);
outp(0x40, 255);
for (b=0; b<1000; b++){;}
outp(0x43, 0);
a=inp(0x40);
b=inp(0x40);
rest=a+b*256; //*0.8380965;
printf ("%d ", (resttmp-rest));
resttmp=rest;
}
printf("\n\n");
for (i=0; i<100; i++)
{
printf("%d ",rest);
}
printf("\n");
}
</pre>
I dunno the fault. maybe someone can help me?
Thx
Timo
ps. you can find some info here: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__inp.2c_._inpw.2c_._inpd.asp">link to msdn</a>
<SPAN CLASS=editedby>[edited by - DarkKiller on January 8, 2003 5:31:34 AM]</SPAN> </i>
inp(portadress) - how to use?
I need to get some information from the system so I tried
inp(portadress);
With C I can use inport(Portadress); But with C++ that doesn't work. I also included the requested file: but still the same result.
DarkMcNugget next time... ;)
very wrong forum. Other than that - I sincerely hope you''re not trying to call inp(), outp(), inportb(), outportb() etc in Windows because any attempt to write to an extrernal devide directly is blocked by that particular OS. If you''re running the program in DOS, it''s a whole different story.
Crispy
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
wow, try to be cool :D
I used is in Dos, of course. But: This is one very simple way.... in Dos.... do use a high presicion counter of the system.
So why should c++ in Windows not support inpb()??
This could be one way to calculate the exacte time one frame needs to be rendered.
So I dont think its the wrong forum...
I hope I didn't sound unfair...
Thx
BTW: there're some simple ways to do that with Visual Basic via dll. But VB and OpenGL... urhg
[edited by - DarkKiller on January 8, 2003 6:52:01 AM]
I used is in Dos, of course. But: This is one very simple way.... in Dos.... do use a high presicion counter of the system.
So why should c++ in Windows not support inpb()??
This could be one way to calculate the exacte time one frame needs to be rendered.
So I dont think its the wrong forum...
I hope I didn't sound unfair...
Thx
BTW: there're some simple ways to do that with Visual Basic via dll. But VB and OpenGL... urhg
[edited by - DarkKiller on January 8, 2003 6:52:01 AM]
DarkMcNugget next time... ;)
First, why should this be the correct forum?
And in windows direct access to I/O ports is usually restricted and I wouldn''t use this method in a modern OS at all. Use Win32 API functions instead.
And in windows direct access to I/O ports is usually restricted and I wouldn''t use this method in a modern OS at all. Use Win32 API functions instead.
ok, api-calls are a good way to solve this problem, but in this case very hard to understand. I saw different versions and examples of a high precision counter an every single one was bad.
So I searched the web for usable information and this is the result.
This should be the right forum because I want to use this function in OpenGL to do a Process-Power-Calculation. That meens that I have to know the exact time a single frame needs to be rendert to get a good value for timebased movement. And this is for OpenGL, isn''t it?
So I could also ask for:"How can I code... use a high precision counter with c++ and opengl.
If someone can give an answer to this quastion I would be happy, too.
Thxs.
Timo
So I searched the web for usable information and this is the result.
This should be the right forum because I want to use this function in OpenGL to do a Process-Power-Calculation. That meens that I have to know the exact time a single frame needs to be rendert to get a good value for timebased movement. And this is for OpenGL, isn''t it?
So I could also ask for:"How can I code... use a high precision counter with c++ and opengl.
If someone can give an answer to this quastion I would be happy, too.
Thxs.
Timo
DarkMcNugget next time... ;)
_int64 pc1,pc2; // counter state
_int64 pf; // counter frequency
QueryPerformanceFrequency((LARGE_INTEGER*)&pf);
QueryPerformanceCounter((LARGE_INTEGER*)&pc1);
// do stuff...
QueryPerformanceCounter((LARGE_INTEGER*)&pc2);
double seconds_elapsed = double(pc2-pc1) / double(pf);
_int64 pf; // counter frequency
QueryPerformanceFrequency((LARGE_INTEGER*)&pf);
QueryPerformanceCounter((LARGE_INTEGER*)&pc1);
// do stuff...
QueryPerformanceCounter((LARGE_INTEGER*)&pc2);
double seconds_elapsed = double(pc2-pc1) / double(pf);
Maybe this is some kind of "new to this function" fault, but I get the same fault like some time ago:
main.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)'':
main.cpp:19: `_int64'' undeclared (first use this function)
main.cpp:19: (Each undeclared identifier is reported only once
main.cpp:19: for each function it appears in.)
main.cpp:19: parse error before `,''
main.cpp:44: `pf'' undeclared (first use this function)
main.cpp:45: `pc1'' undeclared (first use this function)
main.cpp:88: `pc2'' undeclared (first use this function)
main.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)'':
main.cpp:19: `_int64'' undeclared (first use this function)
main.cpp:19: (Each undeclared identifier is reported only once
main.cpp:19: for each function it appears in.)
main.cpp:19: parse error before `,''
main.cpp:44: `pf'' undeclared (first use this function)
main.cpp:45: `pc1'' undeclared (first use this function)
main.cpp:88: `pc2'' undeclared (first use this function)
DarkMcNugget next time... ;)
sorry, i meant __int64, though IIRC this is microsoft-specific, if you use another compiler, you should use LARGE_INTEGER, which is a little less comfortable though..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement