Re: Waiting for a retrace..

new topic     » goto parent     » topic index » view thread      » older message » newer message

Ralf Nieuwenhuijsen wrote:
>         I have some assembly code i like to translate...
>         I dunno asmebly, i just know that this piece of code waits until a
> screen redraw is done. The automatic refresh rate says how many times
> per sec this is done.
>         With this you will have no flicker on ANY Fast computer and the same
> speed on all fast computers. On the slower ones (386 & slow 486)
> there may be still some flickering.
<snip>
>
>         The WaitRetrace Code:
>         Well here's the code as is should be typed in C:
>         What's the Euphoria equilevent?
>
> Ralf Nieuwenhuijsen
> nieuwen at xs4all.nl
> ---------------------------Code: Turbo C -------------
> void WaitRetrace() {
>
>   _DX = 0x03DA;
>
>   l1: asm {
>  in  al,dx;
>  and al,0x08;
>  jnz l1;
>   }
>
>   l2: asm {
>  in  al,dx;
>  and al,0x08;
>  jz  l2;
>   }
> }
> ------------------------------
> BTW This is from the Asphyxia Tutorials by Denthor updated by SnowMan

ok, Ralf.  Here it is:

---- code begins ----

include ports.e

procedure wait_retrace()
---- wait for a vertical retrace to start
  while and_bits(Input(#3DA), #08) != 0 do  end while
---- then wait for it to end
  while and_bits(Input(#3DA), #08) = 0 do  end while
---- now it's safe to write to the screen
end procedure

---- code ends ----

Pete Eberlein <xseal at harborside.com>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu