Main
   Home
   About
   DiscussionBoard
Files
   About
   Submit
   Search
Downloads
   Action
   QB64
Links
   Link to us
QB45.org
[ Back to QB45 | FAQ | Search a message | Reply to this message | Back to messages ]

Lennie Tofft on 06/24/12 - 16:37:20

Does anyone know ifit is possible to configure ntvdm to always give full CPU power to qbasic, even when it is in a loop? I have discovered that when a QB program is in a loop, ntvdm notices this and cut down CPU power, unless a key is stroked. Perhaps there are older versions of ntvdm or vdm which doesn't analyze the dos program in this way?

Todd on 06/25/12 - 12:10:28

I think it might be possible in DOSBox but I'm not certain. NTVDM is only an emulator for DOS applications in Windows NT-based platforms (like Windows XP and 7).

Just curious, but why would you want it to kill your CPU if it's in a loop? I'm just not sure what you're trying to accomplish if the program isn't doing anything in a loop.

Lennie Tofft on 06/26/12 - 12:50:08

One reason may be to measure the speed of the computer. If you know how far the computer counts in a given time interval, you can use counting, in a loop, to control time delays in a program.

Another reason is to create a true random number generator. I use to do this with the following code:
T = TIMER
WHILE TIMER - T < 1
X = X + TIMER - T
WEND
X = X - INT(X / 10) * 10
This generates a random number between 0 and 9.

Todd on 06/26/12 - 16:14:40

Unfortunately for the case of newer Windows platforms, the only way you can measure processor speed through a DOS program is by having your program run something like XOR and then subtracting the XOR time from it (estimated), or you can try making interrupt calls to the BIOS to get a more approximate time or even finding the CPU speed (although NTVDM probably won't let you get away with that easily).

Random number generators are never truly random. You can make one by taking a seed (time or date is a good way to start) and then generating a pseudo-random number by modding the number repeatedly by the limit (10 in your example).

Marco V on 09/30/14 - 07:20:23

Even when NTVDM doesn't throttle the app to give back more timeslices back to the system,
that doesn't guarantee that NTVDM gets enough ticks from het system scheduler at all.


Reply to this message
Name:
Message:
Please enter this number:
No HTML allowed. You may use BB-code in your posting.
Members
Login
Register
QB45 Members
Member List