1. Waiting for a retrace..

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.
        I need this for my virtual screens and sprites library, so things
are drawn with no flickering....
        It will be finished tomorrow (i hope)
        I just finished CopyVS and it took me really long, about 5 hours!!
        (It's 9 and a half of screens in the Editor from David Cuny!)
        STill not much code is executed each time, and it is REALLY fast..
        (You can have memory, sequence and image screens)
        In pixel modes, images screens (2D sequences) are the fastest
        In modes with a video memory accasible, memory is zillions times
faster, i've noticed.
        The screen can be of any size too, and you can set the view, that's
a section where all input and output of the screen happens, really
need for scrolling effects...!!
        Does anyone know how to calculate a new position from on old when
you have an angle (360 degrees, no radians) and a distance?

        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

new topic     » topic index » view message » categorize

2. Re: Waiting for a retrace..

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 message » categorize

3. Re: Waiting for a retrace..

>         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.

Been there, done that...

------------------------------------------------
----    Wait for screen proc by Gargoyle    ----
----  (Anders Eurenius <c96aes at cs.umu.se>)  ----
------------------------------------------------
--      waittof() (tof=top of frame) suprised there
--      isn't any support for this already!

include ports.e

global procedure waittof()
 while not and_bits(Input(#3DA),8) do end while
 while not and_bits(Input(#3DA),8) do end while
end procedure

/Anders
--------------------------------------------------------------
Anders Eurenius <c96aes at cs.umu.se> ICQ UIN:1453793
Computer Science/Engineering student at the university of Umea
--------------------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu