(***** #! rnews 2944 Xref: news.demon.co.uk comp.lang.pascal.borland:3803 Path: news.demon.co.uk!demon!dispose.news.demon.net!demon! news-lond.gip.net!news-stkh.gip.net!news.gsl.net!gip.net! newsfeed1.funet.fi!128.214.205.17.MISMATCH!news.helsinki.fi!not-for-mail From: ronkanen@cc.helsinki.fi (Osmo Ronkanen) Newsgroups: comp.lang.pascal.borland Subject: Re: PASCAL - RUNTIME ERROR 200 - DIVID BY ZERO - PATCH Date: 7 May 1998 18:08:06 +0300 Organization: University of Helsinki Message-ID: <6isiom$l4m@kruuna.Helsinki.FI> References: <01bd76c7$fdaec220$090202c3@p300> <6C037FD533622A67.DF7D50D4FBED5C1B.55609112B4FF522C@library-proxy.airnews.net> <354F100B.8F602250@eunet.at> <9A8B7B139A43FD27.95BB355DD9855613.9E8C8FA977A70004@library-proxy.airnews.net> NNTP-Posting-Host: kruuna.helsinki.fi Lines: 91 In article <9A8B7B139A43FD27.95BB355DD9855613.9E8C8FA977A70004@library-proxy.airnews.net>, Larry Weiss wrote: > >Osmo's "FDelay.pas" fix is embedded in Timo's FAQ available at > > ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip > >as FAQ # 124. > >Osmo has also posted it in its entirety as a message to this >forum. Unfortunately it is not conveniently available in >anyone's Web page to my knowledge. I would hope that Osmo >might make his fix description available to you to place >in a Web page. Here is it again: *****) 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. Osmo