🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #424

Re: TP/BP7 CRT bug - no source code available - a possible fix

#424
From: Osmo Ronkanen
Date: Tue, 10 Nov 1998 00:00
124 lines
3932 bytes
In article <2RfxPAA3kDS2Yw$s@pedt.demon.co.uk>,
Pedt Scragg  <newsmaster@pedt.demon.co.uk> wrote:
>There have been a number of requests for solving the RTE 200 bug in the
>CRT unit when source is not available.
>
>ISTM that Osmo Ronkanen's code for the fdelay unit could also be used as
>a program (similarly to the Loadfix program supplied with DOs 6.xx) to
>intercept the relevant interrupts then release them when the TP/BP7
>program loads.
>
>Test code below. It works on my machine, some code could be, I'm sure,
>improved - all thoughts welcomed. I will upload the source to a suitable
>location when and if appropriate. I would appreciate anyone who is able
>to test the code to do so.

I have to test it.  I just made the same thing myself:

{$M 1100,0,0}

uses dos;  { better not use CRT :-) }


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



Procedure Int0; assembler;
          asm
          cmp byte ptr oldints+8,0     { Done with the fix? }
          jnz @old

          cmp cx,55       { If CX<>55 we are at some other point }
          jne @x
          cmp dx,cx       { If DX<CX we are at some other point }
          jae @ok

@x:       mov byte ptr oldints+8,1     { unexpected division overflow }
                                       { we probably have a slow machine }
                                       { and are done with the fix }

@old:     jmp dword ptr oldints

@ok:
          mov dx,54                    { slowest possible delay }
          mov ax,65535
          mov byte ptr oldints+8,1     { we are done with the fix }
          iret                         { return to the DIV (286+) }
          end;



Procedure Int21h; assembler;
          asm
          cmp byte ptr oldints+8,0
          jnz @old

          cmp ax,$2500
          jne @x
          mov word ptr oldints,dx
          mov word ptr oldints+2,ds
          iret

@x:
          cmp ax,$251B
          jne @old                      { Not setint 1Bh? }
          mov byte ptr oldints+8,1      { inavtivate! }


@old:     jmp dword ptr oldints+4

          end;


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

     ps=^string;

var i,j:integer;
    pname,cline:string[128];
    i21save,i00save:pointer;

begin
  cline:=ps(ptr(prefixseg,128))^;
  while (cline<>'') and (cline[1]=' ') do delete(cline,1,1);

  i:=1;
  while (i<=length(cline)) and (cline[i]<>' ') do inc(i);
  pname:=copy(cline,1,i-1);
  for j:=1 to length(pname) do pname[j]:=upcase(pname[j]);
  if copy(pname,length(pname)-3,4)<>'.EXE' then pname:=pname+'.EXE';
  pname:=fsearch(pname,getenv('path'));

  if pname<>'' then begin
     swapvectors;

     GetIntVec(0,i00save);
     GetIntVec($21,i21save);

     with pr(@oldints)^ do begin
       int0:=i00Save;
       int21:=i21save;
       flag:=0;
     End;

     SetIntVec(0,@int0);
     SetIntVec($21,@int21h);

     exec(pname,copy(cline,i,255));

     SetIntVec($21,i21Save);     { Note the order, int 21h first so }
     SetIntVec(0,i00Save);       { it does not catch setting of int 0}

     swapvectors;
  end
  else begin
         Writeln('TFix: Error: program not found');
         Writeln('Usage: Tfix program [parameters]')
       End;

end.

Osmo
Technical Details
Message-ID: <729rab$dr2@myntti.helsinki.fi>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <2RfxPAA3kDS2Yw$s@pedt.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111659,4890ac44b7387456
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,4890ac44b7387456
X-Google-Attributes: gid108ebd,public
From: ronkanen@cc.helsinki.fi (Osmo Ronkanen)
Subject: Re: TP/BP7 CRT bug - no source code available - a possible fix
Date: 1998/11/10
Message-ID: <729rab$dr2@myntti.helsinki.fi>
X-Deja-AN: 410373142
References: <2RfxPAA3kDS2Yw$s@pedt.demon.co.uk>
Organization: University of Helsinki
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal