Board index » delphi » why flickers this ??

why flickers this ??

Hi !

I wrote a simple test program that scrolls 3 colored lines accross the
screen. I always draw the line, wait for vertical retrace and re-draw it
with same color like background.
(Black) My problem is, it only scrolls good, when one line is showed. By two
or more, the lines flickers on screen. I don't know what's wrong.

Thanx for help.

you may get the source from

http://www.centralnet.ch/userpages/omsec

file size 834 bytes

 

Re:why flickers this ??


Quote
Roger Bieri wrote in message <347c38e...@news.centralnet.ch>...

|Hi !
|
|I wrote a simple test program that scrolls 3 colored lines accross the
|screen. I always draw the line, wait for vertical retrace and re-draw it
|with same color like background.
|(Black) My problem is, it only scrolls good, when one line is showed. By
two
|or more, the lines flickers on screen. I don't know what's wrong.
|
|Thanx for help.
|
|you may get the source from
|
|http://www.centralnet.ch/userpages/omsec
|
|file size 834 bytes
|

Send your program as a attachement!! There is nothing on your web page!!

Re:why flickers this ??


Quote
Roger Bieri wrote:
> Hi !

> I wrote a simple test program that scrolls 3 colored lines accross the

> screen. I always draw the line, wait for vertical retrace and re-draw
> it
> with same color like background.
> (Black) My problem is, it only scrolls good, when one line is showed.
> By two
> or more, the lines flickers on screen. I don't know what's wrong.

> Thanx for help.

> you may get the source from

> http://www.centralnet.ch/userpages/omsec

> file size 834 bytes

Well, I havent seen the file, but I think your line procedure might be
to slow and you need to use a "virtual page"...a virtual page can be
easily done be creating a pointer to 64000bytes memory segment, and then
draw on that
in stead of the $A000... then wait for the retrace and copy the virtual
page onto the $a000 VGA memory, and you
have a virtual-page, wich should be faster, and get rid of the
flickering..

Greets,
--
Pascal Bestebroer
Just4Fun Productions
internet: http://people.zeelandnet.nl/rpb/
e-mail  : just4...@zeelandnet.nl
ICQ : 2309110

Re:why flickers this ??


create a virtual screen!

type

        virtualp=^virtuals;
        virtuals=array[1..64000] of byte;

get the memory and offset in mem of the virtual screen,
like:

var
      virtual:virtualp;
      virtseg:word;

getmem( virtual,64000 );
virtseg:=seg(virtual^);

then you should just write to the virtual screen
then swap your virtual page onto the real screen.

{ eg, swap(virtseg,vgaseg); vgaseg=$a000}
Procedure Swap( Source, Destination : Word ); Assembler;
Asm
    push    ds
    mov     ax,   [Destination]
    mov     es,   ax
    mov     ax,   [Source]
    mov     ds,   ax
    xor     si,   si
    xor     di,   di
    mov     cx,   32000
    rep     movsw
    pop     ds
End;

{ clear screen}
Procedure Cls(w:Word); Assembler;
Asm
        push    es
        mov     cx, 32000;
        mov     es,[w]
        xor     di,di
        mov     al,[0]
        mov     ah,al
        rep     stosw
        pop     es
End;

{ putpixel }
Procedure PutPixel( Where : Word; X,Y : Integer; Color : Byte );
Assembler;
Asm
    mov     ax, [where]              { 8  }
    mov     es, ax                   { 2  }
    mov     bx, [X]                  { 8  }
    mov     dx, [Y]                  { 8  }
    mov     di, bx                   { 2  }
    mov     bx, dx                  { 2  }
    shl     dx, 8                   { 8  }
    shl     bx, 6                   { 8  }
    add     dx, bx                  { 3  }
    add     di, dx                  { 3  }
    mov     al, [color]               { 8  }
    stosb                          { 11 }
End; { PutPixel() }

Other Threads