Hi Daniel and All,
In <3s9260$...@mars.darmstadt.gmd.de>, Daniel Tietze
Quote
<tie...@darmstadt.gmd.de> writes:
>Hi!
>Users wanting to use one of my programs under OS/2 recently
>told me that it was using up processor resources to 100%. I
>tried it and - sure enough - pulse showed 100% load when executing
>the program under Warp in a DOS box.
>Are there tried and trusted methods of
>a) detecting that the program is running under OS/2, and
>b) giving time slices to the OS when in idle mode?
Yes, and Yes.
I had a similar problem running a compiled BASIC program under OS/2. It
should be very simple to port to Pascal. I assembled a zip file
(qbslice.zip) and posted it to ftp-os2.nmsu.edu in /dos.
Here are the relevant BASIC routines:
FUNCTION DOSVersion! STATIC
' This routine determines the OS version that the program is runing under.
' Needed, e.g., in case we are running graphics in a window in OS/2 (many
' graphics modes aren't virtualized in a window if runing WPS in high
' resolution)
DIM reg AS RegType
reg.ax = &H3000
Interrupt &H21, reg, reg
major% = reg.ax MOD 256
minor% = reg.ax \ 256
DOSVersion! = major% + minor% / 100 ' 20.3 for OS/2 Warp version 3
END FUNCTION
SUB SliceMe
' This subroutine gives up a time slice to Warp.
' It is documented in IBM's OS/2 Virtual Device Driver manual, part
' of the OS/2 Technical Library, and in Ralf Brown's Interrupt List.
DIM reg AS RegType
reg.ax = &H1680
Interrupt &H2F, reg, reg ' Give up the time slice to OS/2
END SUB
More information is available in the .zip file.
Quote
>Any hints on this would be greatly apreciated.
I know it's not Pascal, but it should give the necessary information for
you to solve your problem. I hope this helps.
Cheers,
Scott.
------
D. Scott Katzer - NRL Code 6856 - Washington, D.C. 20375-5347 USA
My time, my computer, my opinions.
Naval Research Lab WWW Home Page: http://www.nrl.navy.mil