View previous topic - View next topic |
Author |
Message |
BDZ Slightly Deformed Faerie Princess
Joined: 11 Jan 2007 Posts: 32 Location: Wisconsin
|
Posted: Tue Feb 06, 2007 1:32 pm Post subject: Vertical Retrace Question |
[quote] |
|
(I posted this about 2 days ago at Pete's QB Site...and no one seems to have the answer.)
A little background first. I'm using QuickBasic 4.0 on a Pentium II 333Mhz (Win98.) The other day I discovered from some tutorials about using OUT and INP to adjust the palette in Screen 13, so I wrote some subs for my RPG to fade the screen in and out.
I was a little disgusted by the flicker though, so I read further. I then experimented with "WAIT &H3DA, 8" and "WAIT &H3DA, 8, 8" to try to wait for the vertical retrace before messing with the palette in each iteration of the loops that fade and "unfade" the screen. These commands caused a delay, but they didn't really seem to affect the flicker much; it still remained.
I read in one of the shorter tuts that "WAIT &H3DA, 8" worked best on 486s and slower Pentiums. What I'm wondering is, is there a good way to wait for the vertical retrace in my program? I don't want to resort to ASM. I'd like my RPG to be pure QB.
Thanks for your help.
(I'd like your help even if you aren't using QB.)
|
|
Back to top |
|
|
Terry Spectral Form
Joined: 16 Jun 2002 Posts: 798 Location: Dublin, Ireland
|
Posted: Tue Feb 06, 2007 2:13 pm Post subject: |
[quote] |
|
What you're doing sounds like it's correct, so I don't know why it isn't working for you.
I'm not sure about this, but I think it's possible that you don't need the second WAIT &H3DA, 8, 8 line. The first line waits until the vertical retrace is at the bottom of the screen, but as far as I know, the retrace actually keeps going for a few nanoseconds. The second waits until it gets back to the top.
If that's the case (and I stress, I'm not sure about this), then you should simply do a single WAIT &H3DA, 8, and then update your palette.
If you're working in screen 13 in pure QB, you're going to find it difficult to keep the game from flickering. Unless you use a fast offscreen buffer, it's pretty much unavoidable. You'll also probably going to have problems when you try to enhance your game with music and a decent keyboard handler. Why not just use an ASM lib?
Or Freebasic? I hear it's pretty good. Plus that way, your game isn't limited to people who have pre WinXP operating systems on their PCs. _________________ http://www.distractionware.com
|
|
Back to top |
|
|
Nodtveidt Demon Hunter
Joined: 11 Nov 2002 Posts: 786 Location: Camuy, PR
|
Posted: Tue Feb 06, 2007 4:10 pm Post subject: |
[quote] |
|
SCREEN 13 is probably the fastest mode available to native QB. The WAIT needs to be executed at the correct time though...just shoving it anywhere in your code isn't going to help much unless you got lucky and put it exactly where it needs to go. _________________ If you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows. - wallace
|
|
Back to top |
|
|
BDZ Slightly Deformed Faerie Princess
Joined: 11 Jan 2007 Posts: 32 Location: Wisconsin
|
Posted: Tue Feb 06, 2007 5:18 pm Post subject: |
[quote] |
|
nodtveidt wrote: | The WAIT needs to be executed at the correct time though...just shoving it anywhere in your code isn't going to help much unless you got lucky and put it exactly where it needs to go. |
Where exactly would that be?
Here's my sub that unfades the palette (pal() is a shared array that's got the palette data in it):
SUB unfadescreen
FOR i = 0 TO 63
FOR j = 0 TO 255
OUT &H3C7, j
r = INP(&H3C9) + 1: IF r > pal(j, 0) THEN r = pal(j, 0)
g = INP(&H3C9) + 1: IF g > pal(j, 1) THEN g = pal(j, 1)
b = INP(&H3C9) + 1: IF b > pal(j, 2) THEN b = pal(j, 2)
OUT &H3C8, j: OUT &H3C9, r: OUT &H3C9, g: OUT &H3C9, b
NEXT j
PLAY "p64" 'for now
NEXT i
END SUB
I tried putting the "wait" just inside the first loop. Then I tried it just inside the second loop. Where would it go?
By the way, my reason for using pure QB is I want my game to be my own creation as much as possible. If once it is finished it just doesn't perform well enough then I'd consider using an asm library or writing my own. That and I (actually my dad) legally owns QB 3.0, 4.0, and QBX.
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Tue Feb 06, 2007 6:23 pm Post subject: |
[quote] |
|
It was quite awhile since I used the WAIT command, when I still coded QB I used Rellib. I'll recommend you to use it, it's easy to use and flicker is no problem for you.
Otherwise, test to put your WAIT just before NEXT.
Quote: | Plus that way, your game isn't limited to people who have pre WinXP operating systems on their PCs. | Pure QB games works well on WinXP machines ^_^ _________________
|
|
Back to top |
|
|
Terry Spectral Form
Joined: 16 Jun 2002 Posts: 798 Location: Dublin, Ireland
|
Posted: Tue Feb 06, 2007 10:48 pm Post subject: |
[quote] |
|
BadMrBox wrote: | Quote: | Plus that way, your game isn't limited to people who have pre WinXP operating systems on their PCs. | Pure QB games works well on WinXP machines ^_^ |
Yeah, whatever. Still doesn't make it a good idea :P _________________ http://www.distractionware.com
|
|
Back to top |
|
|
RedSlash Mage
Joined: 12 May 2005 Posts: 331
|
Posted: Wed Feb 07, 2007 1:47 am Post subject: |
[quote] |
|
So are we talking about flickering or tearing? If flickering, it is likely the fact that VGA mode13h mode runs under 60Hz, which does has a noticable flicker. Tearing on the other hand is solved by vsync.
|
|
Back to top |
|
|
BDZ Slightly Deformed Faerie Princess
Joined: 11 Jan 2007 Posts: 32 Location: Wisconsin
|
Posted: Wed Feb 07, 2007 4:27 am Post subject: |
[quote] |
|
RedSlash wrote: | So are we talking about flickering or tearing? If flickering, it is likely the fact that VGA mode13h mode runs under 60Hz, which does has a noticable flicker. Tearing on the other hand is solved by vsync. |
It's like white static that flickers around contrasting areas when I fade the screen.
|
|
Back to top |
|
|
Nodtveidt Demon Hunter
Joined: 11 Nov 2002 Posts: 786 Location: Camuy, PR
|
Posted: Wed Feb 07, 2007 6:10 am Post subject: |
[quote] |
|
That's palette snow, it happens when you alter the palette during vertical retrace (as far as I remember). _________________ If you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows. - wallace
|
|
Back to top |
|
|
BDZ Slightly Deformed Faerie Princess
Joined: 11 Jan 2007 Posts: 32 Location: Wisconsin
|
Posted: Wed Feb 07, 2007 9:09 pm Post subject: |
[quote] |
|
Dang...It's a problem with Win98 (I think perhaps the drivers for the cheap on-board video card in my PC)...on pure DOS on the same computer and my other Windows XP computer adding the "waits" makes it near flickerless...thanks guys.
|
|
Back to top |
|
|