Board index » delphi » Graphics flicker

Graphics flicker

Hi everyone,
  This is my first post on a message board so please be tolerant.

  I am having a problem working with graphics mode 13h.  When I work with
the palette or write to the screen it flickers a lot.  This doesn't happen
on my p200 but I tried it on a K6-400 because a friend said they had had
problems on their 350 and it left my program useless!

  Can anyone help me?  I'm not a superb programmer and I would be really
greatful if you could.

 

Re:Graphics flicker


"Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)" wrote:

Quote
>   This is my first post on a message board so please be tolerant.

>   I am having a problem working with graphics mode 13h.  When I work with
> the palette or write to the screen it flickers a lot.  This doesn't happen
> on my p200 but I tried it on a K6-400 because a friend said they had had
> problems on their 350 and it left my program useless!

Which routine cause the screen to flicker? Could you post some snippets?

Re:Graphics flicker


"Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)" wrote:

Quote
> Hi everyone,
>   This is my first post on a message board so please be tolerant.

>   I am having a problem working with graphics mode 13h.  When I work with
> the palette or write to the screen it flickers a lot.  This doesn't happen
> on my p200 but I tried it on a K6-400 because a friend said they had had
> problems on their 350 and it left my program useless!

>   Can anyone help me?  I'm not a superb programmer and I would be really
> greatful if you could.

go and look up code that checks the vsync, and only does pallete changes then.
other wise you're in the middle of drawing to the screen, and different parts
of the screen
get different colors for the same pallete index.

Also, it might help to do double buffering.

--
Robin Hugh Johnson
"Robbat2"
"Of all deceptions, self-deception is the worst"
- Plato
E-Mail     : robb...@home.com
ICQ#       : 30269588 or 41961639
Home Page  : http://robbat2.cjb.net
Time Zone  : Pacific Daylight (GMT - 8)

Re:Graphics flicker


Hi,
  Thanks for the prompt response.  I did a search for +vsync +source pascal
and I didn't get anything.  Could you point me in the right direction for
some code to do that or perhaps an overview of checking for vsync or an easy
fix for my problem?  It would be more than appreciated.

  The screen writes are done simply by using Move and copying images from
one buffer to the appropriate offset in segment $A000.  It doesn't flicker
on my pentium 200 and works fine but it wont work on the two faster (350 and
400) machines its been tested on.

  The palette is faded using service 10h of interrupt 10h.  Again, works
alright on my p200 but not on the faster machines.  Heres the code for the
palette fades as requested:

Type
  TColor    = Record
    Red,Green,Blue : Byte;
  End;
  TPalette  = Array[0..255] Of TColor;

Procedure DoVPalette(PalSeg,PalOfs : Word); Assembler;
Asm
  Mov Ax, $1012
  Mov Bx, $0000
  Mov Cx, $0100
  Mov Dx, PalOfs
  Mov Es, PalSeg
  Int $10
End;

Procedure FadeFromBlack(Var APalette : TPalette; Cycles : Word);
Var
  FadePal : TPalette;
  Count   : Byte;
  ColCount: Word;
Begin
  For ColCount := 0 To Cycles Do
  Begin
    For Count := 0 To 255 Do
      With FadePal[Count] Do
      Begin
        Red := Round(APalette[Count].Red / Cycles * ColCount);
        Green := Round(APalette[Count].Green / Cycles * ColCount);
        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
      End;
    DoVPalette(Seg(FadePal),Ofs(FadePal));
  End;
End;

Procedure FadeToBlack(Var APalette : TPalette; Cycles : Word);
Var
  FadePal : TPalette;
  Count   : Byte;
  ColCount: Word;
Begin
  For ColCount := Cycles DownTo 0 Do
  Begin
    For Count := 0 To 255 Do
      With FadePal[Count] Do
      Begin
        Red := Round(APalette[Count].Red / Cycles * ColCount);
        Green := Round(APalette[Count].Green / Cycles * ColCount);
        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
      End;
    DoVPalette(Seg(FadePal),Ofs(FadePal));
  End;
End;

Quote
Robin Johnson <NOSPAMrobb...@home.comNOSPAM> wrote in message

news:383F7C8B.16C5C99B@home.comNOSPAM...
Quote
> "Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)"
wrote:

> > Hi everyone,
> >   This is my first post on a message board so please be tolerant.

> >   I am having a problem working with graphics mode 13h.  When I work
with
> > the palette or write to the screen it flickers a lot.  This doesn't
happen
> > on my p200 but I tried it on a K6-400 because a friend said they had had
> > problems on their 350 and it left my program useless!

> >   Can anyone help me?  I'm not a superb programmer and I would be really
> > greatful if you could.

> go and look up code that checks the vsync, and only does pallete changes
then.
> other wise you're in the middle of drawing to the screen, and different
parts
> of the screen
> get different colors for the same pallete index.

> Also, it might help to do double buffering.

Re:Graphics flicker


Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)

Quote
<grayman...@hotmail.com> wrote in message

news:81mq0v$smi1@tech.port.ac.uk...

Quote
> Hi everyone,
>   This is my first post on a message board so please be tolerant.

>   I am having a problem working with graphics mode 13h.  When I work with
> the palette or write to the screen it flickers a lot.  This doesn't happen
> on my p200 but I tried it on a K6-400 because a friend said they had had
> problems on their 350 and it left my program useless!

>   Can anyone help me?  I'm not a superb programmer and I would be really
> greatful if you could.

Perhaps a little more information would be in order, so your question can be
answered positively/without any guesswork.

What operating system are you using (plain DOS, DOS from Win9x, Win2000,
etc)?
What video card are you using?
Is it just mode 13h, or are the other VGA graphics modes, text modes
affected?
Do other programs work okay in mode 13h? (try non-TP stuff, as well as TP
stuff by other people if possible)
Does it affect VESA graphics modes you set up?
Have you tried inserting a "wait for monitor retrace" procedure in your main
loop? (Find plenty in SWAG or at graphics' coders pages on this NG)
Are you doing anything "unusual" in your program? (redirecting interrupts,
no name one "unusual" activity - although that specifically shouldn't affect
anything)

Re:Graphics flicker


Hi
Vsync  is not part off pascal.
Here's some code attached to help you!

The only way to really iliminate the flicker with drawings is to use a
double Buffer!
I hope you're doing this!!

Bye

Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention) wrote
in message <81p1a8$s...@tech.port.ac.uk>...

Quote
>Hi,
>  Thanks for the prompt response.  I did a search for +vsync +source pascal
>and I didn't get anything.  Could you point me in the right direction for
>some code to do that or perhaps an overview of checking for vsync or an
easy
>fix for my problem?  It would be more than appreciated.

>  The screen writes are done simply by using Move and copying images from
>one buffer to the appropriate offset in segment $A000.  It doesn't flicker
>on my pentium 200 and works fine but it wont work on the two faster (350
and
>400) machines its been tested on.

>  The palette is faded using service 10h of interrupt 10h.  Again, works
>alright on my p200 but not on the faster machines.  Heres the code for the
>palette fades as requested:

>Type
>  TColor    = Record
>    Red,Green,Blue : Byte;
>  End;
>  TPalette  = Array[0..255] Of TColor;

>Procedure DoVPalette(PalSeg,PalOfs : Word); Assembler;
>Asm
>  Mov Ax, $1012
>  Mov Bx, $0000
>  Mov Cx, $0100
>  Mov Dx, PalOfs
>  Mov Es, PalSeg
>  Int $10
>End;

>Procedure FadeFromBlack(Var APalette : TPalette; Cycles : Word);
>Var
>  FadePal : TPalette;
>  Count   : Byte;
>  ColCount: Word;
>Begin
>  For ColCount := 0 To Cycles Do
>  Begin
>    For Count := 0 To 255 Do
>      With FadePal[Count] Do
>      Begin
>        Red := Round(APalette[Count].Red / Cycles * ColCount);
>        Green := Round(APalette[Count].Green / Cycles * ColCount);
>        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
>      End;
>    DoVPalette(Seg(FadePal),Ofs(FadePal));
>  End;
>End;

>Procedure FadeToBlack(Var APalette : TPalette; Cycles : Word);
>Var
>  FadePal : TPalette;
>  Count   : Byte;
>  ColCount: Word;
>Begin
>  For ColCount := Cycles DownTo 0 Do
>  Begin
>    For Count := 0 To 255 Do
>      With FadePal[Count] Do
>      Begin
>        Red := Round(APalette[Count].Red / Cycles * ColCount);
>        Green := Round(APalette[Count].Green / Cycles * ColCount);
>        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
>      End;
>    DoVPalette(Seg(FadePal),Ofs(FadePal));
>  End;
>End;

>Robin Johnson <NOSPAMrobb...@home.comNOSPAM> wrote in message
>news:383F7C8B.16C5C99B@home.comNOSPAM...
>> "Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)"
>wrote:

>> > Hi everyone,
>> >   This is my first post on a message board so please be tolerant.

>> >   I am having a problem working with graphics mode 13h.  When I work
>with
>> > the palette or write to the screen it flickers a lot.  This doesn't
>happen
>> > on my p200 but I tried it on a K6-400 because a friend said they had
had
>> > problems on their 350 and it left my program useless!

>> >   Can anyone help me?  I'm not a superb programmer and I would be
really
>> > greatful if you could.

>> go and look up code that checks the vsync, and only does pallete changes
>then.
>> other wise you're in the middle of drawing to the screen, and different
>parts
>> of the screen
>> get different colors for the same pallete index.

>> Also, it might help to do double buffering.

begin 666 Vsync.pas
<encoded_portion_removed>

Re:Graphics flicker


Double buffering your screen will help;
1) grab 64000bytes of memory
2) dont write to sega000, write to your buffer (minor change to your
existing code i suspect).
3) when the frame is complete, copy your buffer to sega000

you may want to try searching for pascal rather than vsync  ( try yahoo - im
sure there are some pascal sites under its computer/programming/languages
section).

Kenn.

Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention) wrote
in message <81p1a8$s...@tech.port.ac.uk>...

Quote
>Hi,
>  Thanks for the prompt response.  I did a search for +vsync +source pascal
>and I didn't get anything.  Could you point me in the right direction for
>some code to do that or perhaps an overview of checking for vsync or an
easy
>fix for my problem?  It would be more than appreciated.

>  The screen writes are done simply by using Move and copying images from
>one buffer to the appropriate offset in segment $A000.  It doesn't flicker
>on my pentium 200 and works fine but it wont work on the two faster (350
and
>400) machines its been tested on.

>  The palette is faded using service 10h of interrupt 10h.  Again, works
>alright on my p200 but not on the faster machines.  Heres the code for the
>palette fades as requested:

>Type
>  TColor    = Record
>    Red,Green,Blue : Byte;
>  End;
>  TPalette  = Array[0..255] Of TColor;

>Procedure DoVPalette(PalSeg,PalOfs : Word); Assembler;
>Asm
>  Mov Ax, $1012
>  Mov Bx, $0000
>  Mov Cx, $0100
>  Mov Dx, PalOfs
>  Mov Es, PalSeg
>  Int $10
>End;

>Procedure FadeFromBlack(Var APalette : TPalette; Cycles : Word);
>Var
>  FadePal : TPalette;
>  Count   : Byte;
>  ColCount: Word;
>Begin
>  For ColCount := 0 To Cycles Do
>  Begin
>    For Count := 0 To 255 Do
>      With FadePal[Count] Do
>      Begin
>        Red := Round(APalette[Count].Red / Cycles * ColCount);
>        Green := Round(APalette[Count].Green / Cycles * ColCount);
>        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
>      End;
>    DoVPalette(Seg(FadePal),Ofs(FadePal));
>  End;
>End;

>Procedure FadeToBlack(Var APalette : TPalette; Cycles : Word);
>Var
>  FadePal : TPalette;
>  Count   : Byte;
>  ColCount: Word;
>Begin
>  For ColCount := Cycles DownTo 0 Do
>  Begin
>    For Count := 0 To 255 Do
>      With FadePal[Count] Do
>      Begin
>        Red := Round(APalette[Count].Red / Cycles * ColCount);
>        Green := Round(APalette[Count].Green / Cycles * ColCount);
>        Blue := Round(APalette[Count].Blue / Cycles * ColCount);
>      End;
>    DoVPalette(Seg(FadePal),Ofs(FadePal));
>  End;
>End;

>Robin Johnson <NOSPAMrobb...@home.comNOSPAM> wrote in message
>news:383F7C8B.16C5C99B@home.comNOSPAM...
>> "Jimmy the magic fruit (organiser of the cute {*word*141} fruit convention)"
>wrote:

>> > Hi everyone,
>> >   This is my first post on a message board so please be tolerant.

>> >   I am having a problem working with graphics mode 13h.  When I work
>with
>> > the palette or write to the screen it flickers a lot.  This doesn't
>happen
>> > on my p200 but I tried it on a K6-400 because a friend said they had
had
>> > problems on their 350 and it left my program useless!

>> >   Can anyone help me?  I'm not a superb programmer and I would be
really
>> > greatful if you could.

>> go and look up code that checks the vsync, and only does pallete changes
>then.
>> other wise you're in the middle of drawing to the screen, and different
>parts
>> of the screen
>> get different colors for the same pallete index.

>> Also, it might help to do double buffering.

Other Threads