Path: 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: Date: 4 Mar 91 14:45:20 GMT References: Sender: news@midway.uchicago.edu (News Administrator) Distribution: comp Organization: University of Chicago Lines: 30 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...