add: { snooze(4); timeout++; }  timeout = 0; while ((ISARB(INSTAT1) & 0x08) && (timeout < (25000/4)))
context: status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp) {	uint8 val;	uint32 timeout = 0;	LOG(2,("CRTC: relative startadd: $%06x\n",startadd));	LOG(2,("CRTC: frameRAM: $%08x\n",si->framebuffer));	LOG(2,("CRTC: framebuffer: $%08x\n",si->fbc.frame_buffer));	/* make sure we are in retrace, because otherwise distortions might occur	 * during our reprogramming them (no double buffering) (verified on NM2160) */	/* we might have no retraces during setmode! So:	 * wait 25mS max. for retrace to occur (refresh > 40Hz) */	//fixme? move this function to the kernel driver... is much 'faster'.	while ((!(ISARB(INSTAT1) & 0x08)) && (timeout < (25000/4)))	{		snooze(4);		timeout++;	}	/* set standard VGA registers */	/* (startadress in 32bit words (b2 - b17) */    ISACRTCW(FBSTADDH, ((startadd & 0x03fc00) >> 10));    ISACRTCW(FBSTADDL, ((startadd & 0x0003fc) >> 2));	/* set NM extended register */	//fixme: NM2380 _must_ have one more bit (has >4Mb RAM)!!	//this is testable via virtualscreen in 640x480x8 mode...	//(b4 is >256Kb adresswrap bit, so that's already occupied)	val = ISAGRPHR(FBSTADDE);	/* we need to wait a bit or the card will mess-up it's register values.. (NM2160) */	snooze(10);	if (si->ps.card_type < NM2200)		/* extended bits: (b18-20) */		ISAGRPHW(FBSTADDE,(((startadd >> 18) & 0x07) | (val & 0xf8)));	else		/* extended bits: (b18-21) */		ISAGRPHW(FBSTADDE,(((startadd >> 18) & 0x0f) | (val & 0xf0)));	/* set byte adress: (b0 - 1):	 * Neomagic cards work with _pixel_ offset here. */	switch(bpp)	{	case 8:		ISAATBW(HORPIXPAN, (startadd & 0x00000003));		break;	case 15:	case 16:		ISAATBW(HORPIXPAN, ((startadd & 0x00000002) >> 1));		break;	case 24:		ISAATBW(HORPIXPAN, ((4 - (startadd & 0x00000003)) & 0x03));		break;	}	return B_OK;}