RDTSC in Virtual 86 mode

From: Tony Jester (nospam_at_nospam.com)
Date: 10/29/03


Date: Wed, 29 Oct 2003 00:10:40 GMT

I need to generate a random number between 1 and 6. I thought simply
reading the RDTSC would be perfect. It would be except that instruction
crashes one of my computers (a Win95 machine in virtual 86 mode) My VERY
minimal understanding is that there is a control register, CR4 that has a
bit (TSD) that must be reset else a GP(0) error will occur. I've tried to
read the CR4 register but it seems the MOV ctrl reg instruction does not
work in virtual 86 mode. I hate to add another whole routine to generate
random numbers. Is there a way I can get the RTDSC to work on all machines
that support it? Thanks!

-Tony-