---------------------------------------------------- |Andreas 'Yup' Schneider's Vertical Blanc Interrupt| ---------------------------------------------------- Released in April 1998 (by Yup of Offence) http://www.aysec.com/ Introduction ------------ Like the name says AYS_VBI is a Vertical Blanc Interrupt that works under DOS and WIN95. It was one of my first tries to code on the PC, so be patient when you go through the code. I know there are things which could be done better but I'm to lazy to change it, as I did this routine some time ago ( 1-2 years ). Another result of my lazyness is that I never released a product using this routine (10-20 hours work a year isn't enough, I know). So I decided that it's time to release this routine to the public. A second reason is, that I don't want to read the message, please go to DOS, the VBI doesn't work under WIN95 anymore. PLEASE USE THIS LIBRARY AND GIVE ME SOME CREDITS FOR IT !! NO MORE GO TO DOS TO RUN THE DEMO. Please send me a copy of the Programm you used it in. Problems -------- The VBI doesn't work correct anymore (under Win95) when there is a Background-Programm running that needs too much time or generates an own Timer-Interrupt. For example the Systemmonitor or Memsnoop with activated Timer are making trouble because they interrupt the System from time to time and use too much cycles for their purposes. Simply deactivate the Timer or stop the Programm. Also Paintshop Pro for example uses the Timer. Just exit the Programm before you watch any demos. The Examples ------------ There are two simple examples included to show you that it works. A third example is available on my homepage. It's exactly the same as simple2 but with music included. I did it in an extra pack because the player needs 70 KB of space and the music 80 KB, so 150 KB more. In this pack the source is included, too. The ASM-Files are made with WASM the C-Files with Watcom-C. The Source of the LIBRARY is included, too. How to use ---------- Take a look at the simple1.c example. It shows how easy it is to use the Lib. First you must set the graphic-mode you want and call the TimerIrqInit()-Function. Now the VBI is active and every Frame 'lFrameCount' gets increased. The simple-example shows you how to use this behavor in your progy. The only thing left to do is to call TimerIrqClose() when you exit. Functions & Co. --------------- (int) TimerIrqInit( Ticks , Iterations ) ---------------------------------- This Function initialises the Vertical Blanc Interrupt. It uses the Interrupt-Vector 8. 'Ticks' should normaly be 0. This means that the cycle-ticks per Frame is calculated using 'Iterations'. Values from 1 to 65535 indicate the cycle-ticks per Frame the Lib shall use. ATTENTION. This speeds up the intialisation a lot, as no calculation is needed, but it is probable that it will not work on any other system than yours. If you proggy must be intalled you could let it calclulate ones when installing and write it to an ini-File. 'Iterations' Values from 1 to 8 are OK. How higher the number the longer the calculation needs but the calculation is exacter. As you can see in the example I often use 6. If 'Ticks' is different from 0 the value doesn't matter. After the function-call the variables cIfTimerDos and VBLTimerWert are updated. Return-Value 1 = an Error occured. TimerIrqClose() --------------- This Function restores the Interrupt-Vector. CheckDosWinTimer() ------------------ Call this Function to update the cIfTimerDos variable. (char) cIfTimerDos ------------------ if 0 then you are in DOS every other value means Win or a other OS that has virtual Interrupts. The value is updated by TimerIrqInit() and CheckDosWinTimer() (long) lFrameCount ------------------ counts the Frames since you called TimerIrqInit(). (short) VBLTimerWert -------------------- the cycle-ticks per Frame. You can e.g. calculate the refresh- rate: Round( 1193180 / VBLTimerWert). The value is updated by TimerIrqInit() if 'Ticks' was 0. (int) GetTimer0() ----------------- is an inline-Function declared in the header-File. Return-Value = Cycle-Ticks left before the next Vertical Blanc. About the Author ---------------- Well I'm a member of the demogroup Offence and I also investigate some seconds in gameprogramming every year. I started to code on the C-64 and was in several groups like WOT, Shape, NATO, Traitors, Sharks and so on. You can also find some small things for the Amiga from me in the NET, and as you can see something for the PC now, too. Maybe soon more, also for Direct-X. If you want to know more, feel free to visit my homepage: http://www.aysec.com/ If you want to contact me for any reason (e.g. you are a graphician and you want to work with me) write me some words. Contactinformations are under http://www.aysec.com/ Last Word --------- I hope you like this little release. If you find any Bug or you change something please write me a note. I hope there are no more bugs in, but if so, I'll try to fix them. Just have a look on my homepage from time to time. If you use the routine in a Programm I also hope to get a copy of it. I'll make a link to it then and you'll get more hits, too. CU Andreas 'Yup' Schneider / Offence