Turbo Pascal gets 100% Windows NT CPU 
Author Message
 Turbo Pascal gets 100% Windows NT CPU

Hello,

I have an old Turbo Pascal (version 7, I think...)
application that runs Ok under DOS / Win95 / Win98.

But when I run it under Windows NT Workstation/Server,
the app gets almost 100% cpu time. Windows NT sometimes
freezes.

I know that some old programs have this behavior under
Windows NT, and I want to know if there is any patch
for this problem.

I have the compiled EXE and I can get the source code.
So I can recompile it, if necessary.

Thanks for any help

Marcos Augusto
Brazil

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Pascal gets 100% Windows NT CPU
Hello,

I have an old Turbo Pascal (version 7, I think...)
application that runs Ok under DOS / Win95 / Win98.

But when I run it under Windows NT Workstation/Server,
the app gets almost 100% cpu time. Windows NT sometimes
freezes.

I know that some old programs have this behavior under
Windows NT, and I want to know if there is any patch
for this problem.

I have the compiled EXE and I can get the source code.
So I can recompile it, if necessary.

Thanks for any help

Marcos Augusto
Brazil

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Pascal gets 100% Windows NT CPU

Quote:

> Hello,

> I have an old Turbo Pascal (version 7, I think...)
> application that runs Ok under DOS / Win95 / Win98.

> But when I run it under Windows NT Workstation/Server,
> the app gets almost 100% cpu time. Windows NT sometimes
> freezes.

> I know that some old programs have this behavior under
> Windows NT, and I want to know if there is any patch
> for this problem.

> I have the compiled EXE and I can get the source code.
> So I can recompile it, if necessary.

> Thanks for any help

Someone posted this a while back. I don't have the message, only this source
file, so I can't credit the author. I use a slightly modified version of it
under BP.EXE all the time, because Win95 shortcuts were taking a long time
to get to the OS, this seemed to fix it.

FP

{$A-,B-,D+,E-,F-,G+,I-,L+,N-,O-,P-,Q-,R-,S-,T-,V-,X+,Y+}
{$M 4096,0,0}
Program BP7;  uses dos;

{***********************************************************************
Version 0.91

This little program was designed to save CPU time in Windows 95/98/NT
running Borland Pascal.

It also works brilliantly in programs (run in the IDE) that do a
"repeat until keypressed".

Copy the executable into the same directory as BP.EXE.

The program grabs interrupt 16 (keyboard interrupt) and performs a task
switch whenever bp queries the keyboard buffer (if it's empty).
***********************************************************************}

VAR oldint16:pointer;

Procedure newint16;far;assembler;asm


    push ds                   {save DS}
    push ax

    mov  ds,ax                {Make DS = our DS}
    pop  ax
    cmp  ah, $11

    cmp  ah,1                 {Set flag if Keyboard buffer query}


    Pushf                     {push dummy on stack to simulate intxx call}
    call dword ptr (oldint16) {call farr old interrupt routine}
    pop DS                    {Restore data segment}
    pushf                     {flags are vital-save them}



    popf
    pushf                     {Was the buffer empty?}

    push ax                   {Yes, so program is idle. Save AX,}
    mov  ax,1680h             {Do a taskswitch now,}
    int  2fh
    pop  ax                   {and restore AX again}

    POPF                      {these are the flags from old int16}
    RETF 2                    {and ready!}
end;

begin
  Swapvectors;
  getintvec($16,oldint16);

  dos.exec(GetEnv('ComSpec','');
  setintvec($16,oldint16);
  Swapvectors;
  Writeln('IdleKey terminated - type Exit again to leave DOS shell');
end.



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Pascal gets 100% Windows NT CPU

Quote:

>But when I run it under Windows NT Workstation/Server,
>the app gets almost 100% cpu time. Windows NT sometimes
>freezes.

>I know that some old programs have this behavior under
>Windows NT, and I want to know if there is any patch
>for this problem.

Adding the following  statement in some loops solved the problem in my
program. Especially in a loop polling for keyboard input.

      asm    int $28   end;

Via int $28 the timeslice is returned to windows NT.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Turbo Pascal gets 100% Windows NT CPU

2. Fehler 100 bei Turbo 7 unter NT 4.0

3. Fehler 100 bei Turbo 7 unter NT 4.0

4. 100 % of CPU time during SQL query !!!

5. Turbo pascal 6 in windows NT?

6. Getting the user name from Windows 95 or NT 4.0

7. Need high speed CPU fix for Pascal for Windows 1.5

8. HELP: Turbo Pascal for Windows - Object Windows

9. Anyone seen a Pascal Patch for windows NT?

10. Long Filenames (LFN) under Windows NT using Borland Pascal

11. Getting direct access to more than 1 Meg In Turbo Pascal

12. compiling Borland Pascal 7.0 DOS code on Windows NT

 

 
Powered by phpBB® Forum Software