From: lonniem AT mail DOT utexas DOT edu Newsgroups: comp.os.msdos.djgpp Subject: Re: Synchronising graphics with the screen Date: Tue, 10 Dec 1996 22:27:50 GMT Organization: The University of Texas at Austin, Austin, Texas Lines: 30 Message-ID: <58kh54$jgq@geraldo.cc.utexas.edu> References: <32AD6A7A DOT 41C67EA6 AT ic DOT ac DOT uk> NNTP-Posting-Host: slip-4-12.ots.utexas.edu DJ-Gateway: from newsgroup comp.os.msdos.djgpp Apparently-To: djgpp AT delorie DOT com Richard Hopkins wrote: >I am useing DJGPP, and have written several graphicsy type programs. >Unfortunately the plotting commands are completely out of synch with the >monitor. Consequently the image looks crap. Please help. >Is there some internal register or variable which can be monitored using >inline assembly? An interrupt? >thank you >Hoppy Yes you can wait for vertical retrace. This is the time during which the monitors electron beam is returning to the top left hand corner from the bottom right hand corner and it gives you quite a bit of time to do many screen oriented things such as blitting a double buffer or various other things. Here's some code: asm ("movw $0x03DA, %%dx \n\t" // 03DAh is the port "wait_for_retrace: \n\t" "inb %%dx, %%al \n\t" // in status register "testb $0x08, %%al \n\t" // test if retracing "jnz wait_for_retrace \n\t" // if no do it again ... do what ever you want after this. Hope this helps Lonnie Mcullough lonniem AT mail DOT utexas DOT edu