home .. forth .. colorforth mail list archive ..

Re: [colorforth] precision delay


I usually just use port 61h on the keyboard controller.. it's supposed to give 
a consistent 15.085 microsecond delay on any PC (and in my experience, it 
does). It goes like this:

(ecx = number of 15-085us cycles)
	in al,61h
	and al,10h
	mov ah,al
1	  in al,61h
	  and al,10h
	  cmp al,ah
	    jz .1
	  mov ah,al
	  loop .1

I've also reworked the floppy code to run on my 386 (with an old 765A 
controller).. It's from my own forth-OS.. in its latest incarnation it's 
basically "colorForth for old computers".. anyway, someone might find it 
useful. There's 320x200 VGA code in there too, which could be dropped into 
colorForth.
http://retro.tunes.org/pub/retro4/


Tom


Mark Slicker <maslicke@xxxxxxxxxxx> said:
> Hello,
>    I was wondering if anyone has had the need for a precision delay
> yet in colorForth? My own use in my graphics initialization requires a
> greater than or equal to 200 microsecond delay, and also a 100 millisecond
> delay. I noticed in Linux they use a udelay routine quite frequently
> throughout the kernel. The code for this is quite elaborate, they use one
> of two different methods based on cpu detection. Does anyone have a better
> way? Otherwise I will probably just use a simplified method based on a 
> calibrated time stamp counter (TSC) which available on my CPU.
> 
> Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
List problems, e-mail:  list-admin@xxxxxxxxxxxxxxxxxx
Main web site:  http://www.colorforth.com