🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #5006

Re: Generating delays

#5006
From: Doug Dougherty
Date: Mon, 04 Mar 1991 14:45
30 lines
1268 bytes
melling@cs.psu.edu (Michael D Mellinger) writes:


>I need to be able to generate delays of around 1/2 second.  Anyone
>have a good way of doing this?  I'm using MS C 6.0.  The best I can
>come up with is a 1 second delay.

When I need a delay, I just do something like this:
(This is for the A86 assembler, and assumes a .RADIX 16, since all
values are in hex)

delay:	xor ax,ax
	mov ds,ax
	les bx,[1C*4]
	mov [1C*4],offset int1c
	mov [1C*4+2],cs
L1:	cmp word cs:[ticks],9		; 9 for 1/2 second delay
	jb L1
	mov [1C*4],bx
	mov [1C*4+2],es
	mov ds,cs
	ret
ticks:	dw 0

int1c:	inc word cs:[ticks]
	iret

You oughta be able to get this to work in C somehow.  Note that this isn't 
100% right, since I don't chain to the original INT1C vector, but it is,
as they say, good enough for government work...
Technical Details
Message-ID: <valley.668097920@gsbsun>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!haven!mimsy!midway!valley
References: <sg2Gwuw?@cs.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!haven!mimsy!midway!valley
From: valley@uchicago (Doug Dougherty)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Generating delays
Message-ID: <valley.668097920@gsbsun>
Date: 4 Mar 91 14:45:20 GMT
References: <sg2Gwuw?@cs.psu.edu>
Sender: news@midway.uchicago.edu (News Administrator)
Distribution: comp
Organization: University of Chicago
Lines: 30