Board index » delphi » How to do page-flipping in Borland Pascal ?

How to do page-flipping in Borland Pascal ?

Hi,

I'm trying to work out how to implement flicker-free animations under
Borland's Turbo-Pascal. I know what the pseudo-code oughta be like, I
only have serious trouble trying to convert it into working Pascal
code. Here are the things I do know...

- You have to be in a graphics mode which support multiple pages
  (like 320/240 pixels, 256 color mode)

Pseudo code:

1. Define a virtual page and clean it
2. Put the desired images on the virtual page
3. Wait for a vertical blank
4. Swap the screen with the virtual screen

Now, how do I do all this ? How to define, draw on and swap a virtual
page ? How to wait for a vertical blank ? I you know how to do it,
please write it to me. I would appreciate it very much.

                        Thanks in advance,
                        Edgar van Oostrum
                        edg...@telebyte.nl

ps. Please write your answer by means of E-mail. The News-server of my
local server is quite unstable, so I won't be able to check it every
day.

 

Re:How to do page-flipping in Borland Pascal ?


Here's what you need to do very simply:
To create the virtual screen:
type  virtscreentyp=array[0..63999] of byte;
var virtscreen:^virtscreen;
...
and before you use it:
getmem(virtscreen,64000);
and when your done with it:
freemem(virtscreen);

to write to the virtual screen just write to it like it was the VGA memory
but use the segment returned by: seg(virtscreen^[0])

to swap the screens use the move command:
Move (Virscr^,mem [$a000:0],64000);

To wait for a retrace to prevent filcker use this procedure - note that it
is not mine but one that I got somewhere.

procedure waitretrace;assembler;
asm
  mov    dx,$3da
@@1:
  in       al,dx
  and    al,$08
  jnz     @@1
@@2:  
  in       al,dx
  and    al,$08
  jz       @@2
end;

              Jeff

Re:How to do page-flipping in Borland Pascal ?


In article <44sd71$...@rubens.telebyte.nl>, edg...@telebyte.nl (Edgar van Oostrum) writes:

Quote
> Hi,

> I'm trying to work out how to implement flicker-free animations under
> Borland's Turbo-Pascal. I know what the pseudo-code oughta be like, I
> only have serious trouble trying to convert it into working Pascal
> code. Here are the things I do know...

  You want to look at this FTP-site:
  ftp://x2ftp.oulu.fi/pub/msdos/programming/gpe/00index.html

  There you'll find the PC Game Programmers Encyclopedia, which answers those
  questions a lot more besides.

  --Lars M.

Other Threads