Board index » delphi » Error 200 Division by Zero

Error 200 Division by Zero

I have programmed in Turbo Pascal 7.0 and can get the application to work.
I friend opens the same application on his computer (with Turbo Pascal 7.0
installed) and when he tries to run the application (Ctrl+F9) he gets the
following message:

Error 200 Division by zero

I have a pentium computer, windows 95.

He has a pentium2 computer and windows 95.

Fredrik

 

Re:Error 200 Division by Zero


In article <01bd65ee$b7c36660$0691f482@fredriko>,

Quote
Fredrik Oleander <fredrik.olean...@swipnet.se> wrote:
>I have programmed in Turbo Pascal 7.0 and can get the application to work.
>I friend opens the same application on his computer (with Turbo Pascal 7.0
>installed) and when he tries to run the application (Ctrl+F9) he gets the
>following message:

>Error 200 Division by zero

>I have a pentium computer, windows 95.

>He has a pentium2 computer and windows 95.

Use this before CRT. If you use delay, then call it dfix times instead
of just one. If you are interested in why the error occurs, just read
previous messages from this group.

Unit Fdelay;             { Use this before CRT }

interface

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

implementation

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:     db $2e,$ff,$2e         { jmp far indirect cs:[oldints+4] }
          dw offset 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);
end.

Re:Error 200 Division by Zero


Quote
Osmo Ronkanen wrote:
> Use this before CRT. If you use delay, then call it dfix times instead
> of just one...
> Unit Fdelay;             { Use this before CRT }
>  ... code deleted ...

Thanks for your contributions!
I have some programs that generate (at initialization)

  Runtime error 208 at 0932:0062.

after your Fdelay unit is included.

(Other programs that I have run just fine with FDelay included.)

The difference that I've isolated between these two classes of
program are that the ones that fail have a

      {$O DOS     }

overlay directive in them.  When I remove that directive, then
Fdelay works great on these programs, just like the ones that
either are not overlayed or don't overlay the DOS unit.

Thanks!

 - Larry Weiss

Re:Error 200 Division by Zero


In article <938D30A11DEBF9CE.CDDDC8A669AC8AFB.3EF983B4DB89A...@library-proxy.airnews.net>,
Larry Weiss  <l...@airmail.net> wrote:

Quote
>Osmo Ronkanen wrote:
>> Use this before CRT. If you use delay, then call it dfix times instead
>> of just one...
>> Unit Fdelay;             { Use this before CRT }
>>  ... code deleted ...

>Thanks for your contributions!
>I have some programs that generate (at initialization)

>  Runtime error 208 at 0932:0062.

>after your Fdelay unit is included.

>(Other programs that I have run just fine with FDelay included.)

>The difference that I've isolated between these two classes of
>program are that the ones that fail have a

>      {$O DOS     }

>overlay directive in them.  When I remove that directive, then
>Fdelay works great on these programs, just like the ones that
>either are not overlayed or don't overlay the DOS unit.

That is strange. I have never  used overlays so I do not know much of
them. Did you try to overlay Fdelay? (That is a no no). Was Fdelay right
before CRT in the uses line?

Could you E-mail me a minimal program that causes the error?

Osmo

Re:Error 200 Division by Zero


In article <6h73hn$...@kruuna.Helsinki.FI>,
  ronka...@cc.helsinki.fi (Osmo Ronkanen) wrote:

Quote
> Larry Weiss  <l...@airmail.net> wrote:
> >I have some programs that generate (at initialization)
> >  Runtime error 208 at 0932:0062.
> >after your Fdelay unit is included.
> >(Other programs that I have run just fine with FDelay included.)
> >The difference that I've isolated between these two classes of
> >program are that the ones that fail have a
> >      {$O DOS     }
> >overlay directive in them.  When I remove that directive, then
> >Fdelay works great on these programs, just like the ones that
> >either are not overlayed or don't overlay the DOS unit.
> That is strange. I have never  used overlays so I do not know much of
> them. Did you try to overlay Fdelay? (That is a no no). Was Fdelay right
> before CRT in the uses line?
> Could you E-mail me a minimal program that causes the error?

Thanks for the reply.   Yes, Fdelay was right before CRT (at least in the
primary file of each program).   Also, I did not overlay FDelay.

I'll try to compose a minimal program to demonstrate the interaction of
Fdelay.pas and {$O DOS}
I need to zap and test about 60 programs here in the meantime
with your fix, so I might not get the time to find a minimal
demo until middle of next week, but I'll post it here and email
it to you when it's ready.

  - Larry Weiss

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

Other Threads