Board index » delphi » Pentium II problem with programs compiled in Turbo Pascal (CRT unit)

Pentium II problem with programs compiled in Turbo Pascal (CRT unit)

        I have a problem with my new Intel Pentium II (Celeron 266)
processor. I've decided to buy this one because of compatibility with all
compilers (such as clipper, pascal, C). And i had a great surprise when i
found out that there is no program compiled in Turbo Pascal 7.0 (Borland
too) which would run properly, runtime error 200 (divide by zero). Later
it
turned out that it's caused by declaration of CRT unit in uses section,
when there is no CRT declared everything is ok.
        Now I wonder if I should write my own unit which would substitute original
one or maybe there is another way to solve this problem.
--
                                                           Micha3 Piasecki
 

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


        I have a problem with my new Intel Pentium II (Celeron 266)
processor. I've decided to buy this one because of compatibility with all
compilers (such as clipper, pascal, C). And i had a great surprise when i
found out that there is no program compiled in Turbo Pascal 7.0 (Borland
too) which would run properly, runtime error 200 (divide by zero). Later
it
turned out that it's caused by declaration of CRT unit in uses section,
when there is no CRT declared everything is ok.
        Now I wonder if I should write my own unit which would substitute original
one or maybe there is another way to solve this problem.

--
                                                           Micha3 Piasecki.

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


Micha3 Piasecki [mailto:boxm...@friko.onet.pl] decided to regale us in
clpb with

Quote
>it
>turned out that it's caused by declaration of CRT unit in uses section,
>when there is no CRT declared everything is ok.

*Sigh* Please read before writing, it saves us all time. Info:

Mini-FAQ posted weekly lists this. Copies in the newsgroup and at
                        http://www.pascal.force9.co.uk/faq/clpb-faq.txt
                        http://www.merlyn.demon.co.uk/clpb-faq.txt
                        ftp://garbo.uwasa.fi/pc/doc-net/faqclpb.zip

Also Timo Salmi's FAQ - monthly pointer posted in clpb
                        ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
                        See #124

--
Pedt

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


In article <01be367a$8605f540$LocalHost@ppp>,

Quote
Micha3 Piasecki <boxm...@friko.onet.pl> wrote:
>    I have a problem with my new Intel Pentium II (Celeron 266)
>processor. I've decided to buy this one because of compatibility with all
>compilers (such as clipper, pascal, C). And i had a great surprise when i
>found out that there is no program compiled in Turbo Pascal 7.0 (Borland
>too) which would run properly, runtime error 200 (divide by zero). Later
>it
>turned out that it's caused by declaration of CRT unit in uses section,
>when there is no CRT declared everything is ok.
>    Now I wonder if I should write my own unit which would substitute original
>one or maybe there is another way to solve this problem.

This is a VFAQ.  Use the following before CRT:

Unit Fdelay;             { Use this before CRT }

interface

const dfix:word=1;       { call delay() dfix times }

implementation

{$ifdef msdos}

uses dos;

procedure oldints; assembler; { "variables" in the code segment }
          asm dd 0,0 end;

Procedure error;
begin
  runerror(200);
End;

Procedure Int0; assembler;
          asm
          cmp cx,55       { If CX<>55 we are at some other point }
          je @ok
          sti
          call error
@ok:
          shr dx,1        { divide dx:ax by 2 }
          rcr ax,1
          shl Dfix,1      { multiply Dfix by 2 }
          iret            { return to the DIV (286+) }
          end;

{ Int21h handler removes the int0 handler (as well as itself) from the
  memory when CtrlBreak vector is set by CRT right after calculating
  the delay counter. Note DS does NOT point to the data segment when
  this is called }

Procedure Int21h; assembler;
          asm
          cmp ax,$251B
          jne @old               { Not setint 1Bh? }

          push es; push si; push di
          mov si,offset oldints
          xor di,di
          mov es,di
          cld
          segcs; movsw
          segcs; movsw           { restore int 0 }

          mov di,$21*4
          segcs; movsw           { restore int 21h }
          segcs; movsw
          pop di; pop si; pop es

@old:     jmp dword ptr cs:[oldints+4]
          end;

type tr=record int0,int21:pointer; End;
     pr=^tr;

begin
  GetIntVec(0,pr(@oldints)^.int0);
  GetIntVec($21,pr(@oldints)^.int21);

  SetIntVec(0,@int0);
  SetIntVec($21,@int21h);
{$endif}
end.

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


Czesc
widze, ze jestes Polak ;), wiec pisze po polsku
popatrz na : pl.comp.lang.pascal - zadalem pare dni temu to samo pytanie.
poczytaj sobie odpowiedzi ;))

GAD

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


uggg.... what he say?    :)
Quote
GAD wrote in message ...
>Czesc
>widze, ze jestes Polak ;), wiec pisze po polsku
>popatrz na : pl.comp.lang.pascal - zadalem pare dni temu to samo pytanie.
>poczytaj sobie odpowiedzi ;))

>GAD

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


Quote
>uggg.... what he say?    :)

heheh
That was in Polish ;)))))))

GAD

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


it read:
"Hi, I see you're Polish so I'll write in Polish.
Look at pl.comp.lang.pascal. I asked the same question a few day's ago.
You can read the answers there. "

--

Jesse van Oort
firul...@nospam.wxs.nl
(remove 'NOSPAM' for Email).

Quote
Quality wrote in message <77892p$...@enews2.newsguy.com>...
>uggg.... what he say?    :)

>GAD wrote in message ...
>>Czesc
>>widze, ze jestes Polak ;), wiec pisze po polsku
>>popatrz na : - zadalem pare dni temu to samo pytanie.
>>poczytaj sobie odpowiedzi ;))

>>GAD

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


Hey! How do you know what this means ???? Are you Polish too or what?

GAD

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


This is a problem - or better: a bug - in TURBO.TPL. You must patch it.

Mail me for more information: mbsei...@gmx.de
(perhaps I'll upload it to http://software.webset.de/mbs/ )

Re:Pentium II problem with programs compiled in Turbo Pascal (CRT unit)


mbcoder [mailto:mbsei...@hotmail.com] decided to regale us with
Quote
>This is a problem - or better: a bug - in TURBO.TPL. You must patch it.

>Mail me for more information: mbsei...@gmx.de
>(perhaps I'll upload it to http://software.webset.de/mbs/ )

Fixes are already available in well publicised locations. Mini-FAQ has
info but see http://www.geocities.com/SiliconValley/2926/tp.html for
URLs for patches.

--
Pedt

Other Threads