Archived

This topic is now archived and is closed to further replies.

Slayer-X

One little error

Recommended Posts

Splat    122
Well, if you're using DirectDraw, just use IDirectDraw::WaitForVerticalBlank(). Other than that, I can't help. Just be aware that most conio.h functions (especially that one) will FAIL in a restricted and/or Windows NT/2000 environment.

Whoops, just reread your question: The correct prototype for _inp is the following

int __cdecl _inp(unsigned short);

I'm pretty sure leaving out the 'short' would give you an error.

- Splat

[This message has been edited by Splat (edited November 07, 1999).]

Share this post


Link to post
Share on other sites
Rock2000    122
OK, I'm probably missing your point, but why are you prototyping the conio func? Its already done; just include conio.h.

I would guess that the error it gives you is because it doesn't know what __cdecl is. Are you sure you have the correct # of _'s. It looks like it thinks __cdecl is a var, and then obviously wants a comma to separate it from the next var name.

Rock

Share this post


Link to post
Share on other sites
Slayer-X    122
I know that it thinks that __cdecl is var, and I'm prototyping it because I have 2 different conio.h files and one includes the funtion I need. It has the same error with that include file, so I was just going to use the funtion that I needed. But it is still giving me the same error. Here's more code:

#define __cdecl _cdecl

/* function prototypes */

int _cdecl _inp(unsigned);


#define VGA_INPUT_STATUS_1 0x3DA
// VGA status reg1, bit 3 is the vsync
// when 1 - retrace in progress
// when 0 - no retrace
#define VGA_VSYNC_MASK 0x80 // masks off unwanted bit of the status reg.

// Function: wait_for_vsync
// Purpose: waits for the vertical retrace
//
// Input: none
// Output: none
void wait_for_vsync();

---Game Code---

void wait_for_vsync()
{
while(_inp(VGA_INPUT_STATUS_1) & VGA_VSYNC_MASK)
{
// do nothing: VGA is in retrace
}

// Now wiat for vsync and exit

while(!(_inp(VGA_INPUT_STATUS_1) & VGA_VSYNC_MASK))
{
// Do nothing: wait for the start of retrace
}

// retrace is starting so exit
}

Share this post


Link to post
Share on other sites
Slayer-X    122
I have my pong clone almost complete, the only thing i need to do is get the vsync working. I'm using the _inp function from conio.h in my program to get the bits to test for the vsync. All I need is this one line working:

int __cdecl _inp(unsigned);

My compiler says I need a comma, like this:

int __cdecl ,_inp(unsigned);

But when I do that it gives my some stupid error. Please help.

Share this post


Link to post
Share on other sites