Xref: news-dnh.mv.net comp.os.msdos.djgpp:4109 Path: news-dnh.mv.net!mv!news.sprintlink.net!hk.gin.net!news.hk.net!hpg30a.csc.cuhk.hk!news.cuhk.edu.hk!agate!islay.ssl.berkeley.edu!korpela From: korpela AT islay DOT ssl DOT berkeley DOT edu (Eric J. Korpela) Newsgroups: comp.os.msdos.djgpp Subject: Re: Easy Asm Conversion? Date: 3 Jan 1996 21:36:23 GMT Organization: Cal Berkeley-- Space Sciences Lab Lines: 36 Message-ID: <4cessn$pen@agate.berkeley.edu> References: <4cct14$62v AT sisko DOT dnaco DOT net> NNTP-Posting-Host: islay.ssl.berkeley.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4cct14$62v AT sisko DOT dnaco DOT net>, Eric Heft wrote: > >Here is the TC code: If some kind soul would translate this >It should be easy but I've never really learned asm :( > >void WaitForRetrace(void) >{ > asm MOV DX,3DAh >WR1: > asm IN AL,DX > asm AND AL,0008h > asm JNZ WR1 >WR2: > asm IN AL,DX > asm AND AL,0008h > asm JZ WR2 >} > Then don't learn to write asm. But learning how to read it is very important. The following should work. void WaitForRetrace(void) { while (inportb(0x3da)&0x8); while (!(inportb(0x3da)&0x8)); } If for some reason you need the speed of the assembly call you can rewrite inportb as an inline function. -- Eric Korpela | An object at rest can never be korpela AT ssl DOT berkeley DOT edu | stopped. Click here for more info.