home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / atari / st / tech / 4196 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  3.8 KB

  1. Path: sparky!uunet!mcsun!uknet!edcastle!hwcs!neil
  2. From: neil@cs.hw.ac.uk (Neil Forsyth)
  3. Newsgroups: comp.sys.atari.st.tech
  4. Subject: Re: Is page flipping safe, and I need to know about syncing
  5. Message-ID: <1992Jul30.151057.26935@cs.hw.ac.uk>
  6. Date: 30 Jul 92 15:10:57 GMT
  7. References: <Bruq9M.FI7@acsu.buffalo.edu> <1992Jul23.184657.5699@wam.umd.edu> <1992Jul23.222019.27222@infoserver.th-darmstadt.de>
  8. Sender: news@cs.hw.ac.uk (News Administrator)
  9. Organization: Dept of Computer Science, Heriot-Watt University, Scotland
  10. Lines: 51
  11.  
  12. In article <1992Jul23.222019.27222@infoserver.th-darmstadt.de> 
  13. wallmann@backus.pu.informatik.th-darmstadt.de (Natuerlich!) writes:
  14. >In article <1992Jul23.184657.5699@wam.umd.edu> dmb@wam.umd.edu
  15. (David M. Baggett) writes:
  16. >>The Setscreen and Vsync (X)Bios calls work fine for double buffering
  17. >>(aka "page flipping").  There are some subtleties but for most
  18. >>practical purposes you'll get good results using these calls and your
  19. >>code will work with all versions of TOS (including, in theory, those
  20. >For most practical purposes you do get good results with this.
  21. >
  22. >BUT: the disadvantage is that you don't have precision page flipping. It 
  23. >just may happen that on screen1 you are done drawing in 2 screens and flip 
  24. >then, while on screen2 you need 3 screens. The net effect of that would
  25. >be that if your flip rate is 4 that screen 1 will be displayed 5 VBIs, where 
  26. >screen2 will be displayed only for 3 VBIs. If your game nears completion
  27. >and you are not 100% satisfied with the animation I'd suggest that you
  28. >use the VBL directly to flip pages (you can use Setscreen()) there too.
  29. >Until then Setscreen() + Vsync() + frclock will suffice.
  30.  
  31. The trick is to set the physical screen base before the last frame that you
  32. are waiting for. ie. If you are running at 3 frames per turn then set the
  33. new screen address when you reach a count of two (which means the current
  34. screen is being displayed for a third time) so that it takes effect at the
  35. end of frame three. "Why?" I hear you ask (or maybe I don't:-).
  36. Well if you set the physical screen base the SHIFTER chip will not use that
  37. address until it finishes scanning the current screen. However this happens
  38. before SHIFTER causes the vertical blank interrupt so if you change the
  39. screen address in a VBL interrupt then you are too late.
  40.  
  41. You want more proof? Take a look at the system variable 'screenpt' ($45E).
  42. The system VBL routine copies this to the physical screenbase if it's non-zero
  43. but foolishly neglects to zero it afterwards. You might think that this is
  44. the variable that Setscreen sets. Nope. Setscreen blasts the hardware itself
  45. and ignores screenpt. In fact TOS *NEVER* writes to screenpt. If you do
  46. then your in trouble because that means that the screen address is getting
  47. changed to screenpt every VBL thereafter EVEN after a soft reset. Can you
  48. imagine coming up with a 4MB machine in which the video RAM is at a low
  49. address in memory belonging to no-one. Why did Atari do this? Because they
  50. originally thought that screenpt/VBL would be the way to ensure a clean
  51. screen change but in the end the video hardware took care of it and the
  52. method became redundant/unworkable. However there are dark grey clouds on the
  53. horizon regarding this issue ...
  54.  
  55. +----------------------------------------------------------------------------+
  56. ! DISCLAIMER:Unless otherwise stated, the above comments are entirely my own !
  57. !                                                                            !
  58. ! Neil Forsyth                      JANET:  neil@uk.ac.hw.cs                 !
  59. ! Dept. of Computer Science         ARPA:   neil@cs.hw.ac.uk                 !
  60. ! Heriot-Watt University            UUCP:   ..!ukc!cs.hw.ac.uk!neil          !
  61. ! Edinburgh, Scotland, UK           "That was never 5 minutes!"              !
  62. +----------------------------------------------------------------------------+
  63.