[comp.lang.pascal] TP BUG

wsinpp@lso.win.tue.nl (Peter Peters) (01/22/90)

Dear fellow TP users,

I had a close encounter of the bug kind a few days ago and I
wonder if this TP bug is known, and if so if a solution is
available.

The problem is as follows :

Any window defined using the Window procedure from the Crt Unit
with a height of 1 line (in textmode) will scroll erroneously.
A program demonstrating what I mean follows this text.
This bug was present in TP 3.x. If I remember correctly is was
fixed in TP 4.x. Since I'm using TP 5.x (currently 5.5) it seems
to be back again. I'm quite sure it's not a "feature", but a bug.
Any advice/comment (that makes sense) is gladly accepted.

--Here's the program -- Here's the program -- Here's the program --

Program BugAgain;
(*
 * Demonstrate a bug which was present in TP 3.x (I patched it out
 * myself), was corrected in TP 4.x and seems to be present again
 * in TP 5.x
 *)

Uses
  Crt;

Const
  Xloc   = 10;
  Yloc   = 10;
  Width  = 30;
  Height = 1;   (* This is the troublesome height !!! *)

Var
  i : Word;

Begin
  Window(1,1,80,25);       (* Whole screen *)
  ClrScr;                  (* Clear *)
  For i := 1 To 80*24 Do   (* Fill it up with dashes to *)
    Write('-');            (* clearly show what happens *)
  Window(Xloc,Yloc,Xloc-1+Width,Yloc-1+Height);
  ClrScr;
  (* Watch what happens when this window scrolls if it's 1 line high !!! *)
  For i := 1 To Width+10 Do Begin
    Write('a');
    Delay(100);
  End;
End.

-- Ttttthat's all folks ----------------


| Peter Peters                              | UUCP : wsinpp@lso.win.tue.nl  |
| Eindhoven University of Technology (TUE)  | SURF : heithe5::wsdcpp        |
| Dept. of Mathematics and Computer Science | VHF  : PA0PPE                 |
| Disclaimer : I said WHAT ???              | TUE  : HG 8.86 tst. 4283      |
-- 
| Peter Peters                              | UUCP : wsinpp@lso.win.tue.nl  |
| Eindhoven University of Technology (TUE)  | SURF : heithe5::wsdcpp        |
| Dept. of Mathematics and Computer Science | VHF  : PA0PPE                 |
| Disclaimer : I said WHAT ???              | TUE  : HG 8.86 tst. 4283      |

wsinpp@lso.win.tue.nl (Peter Peters) (01/24/90)

Fellow TP pascal users,

I did some more testing on the window bug I claimed to have found.
The next program will show what I've come up with so far. Any
comments (about the problem) are welcome....

			Peter.


-----------------------------------------------------------------
{$define test}
Program BugAgain;

(*
 * Demonstrate a bug which was present in TP 3.x (I patched it there)
 * Was corrected in TP 4.x and seems to be present again in TP 5.x
 *)

Uses
  Dos,Crt;

Const
  Xloc   = 10;
  Yloc   = 10;
  Width  = 5;
  Height = 1;   (* This is a troublesome value !!! *)

Var
  i : Word;
  R : Registers;

Begin
  ClrScr;
  For i := 1 To 80*24-1 Do Write('-');
  Window(Xloc,Yloc,Xloc-1+Width,Yloc-1+Height);
  ClrScr;
  For i := 1 To Width-1 Do Write('a');

  (*
   * Here comes trouble...
   * somewhere in the next write('a'), scrolling is done via the bios
   * INT 10h with register AX set to $0601. The $01 in register AL is
   * the number of empty lines to move in.
   * Apparently this goes wrong as can be shown by replacing the
   * write('a') statement by the alternative piece of code.
   * Watch what happens when this window scrolls !!!
   *)

{$ifdef test}

  Write('a');

{$else}

  (*
   * This is an exact functional copy of what the TP compiler generates
   * to scroll a window up !!
   *)

  R.ax:=$0601;
  R.bh:=TextAttr;
  R.cx:=WindMin;
  R.dx:=WindMax;
  Intr($10,R);

{$endif}

 (*
  * Now this could be called :
  *
  * 1 - a bios bug.
  * 2 - a TP bug.
  *
  * Scrolling up a 1 line window should be the same as clearing it !.
  * If all bios-es are like the one in my machine, (showing the same
  * erroneous scroll in the example above) I tend to calling this a
  * TP bug, because they (Borland) should have known this bios-"feature"
  *)
End.

---------------------------------------------------------------------

-- 
| Peter Peters                              | UUCP : wsinpp@lso.win.tue.nl  |
| Eindhoven University of Technology (TUE)  | SURF : heithe5::wsdcpp        |
| Dept. of Mathematics and Computer Science | VHF  : PA0PPE                 |
| Disclaimer : I said WHAT ???              | TUE  : HG 8.86 tst. 4283      |

leonard@bucket.UUCP (Leonard Erickson) (02/01/90)

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes:

>In article <1936@bucket.UUCP> leonard@bucket.UUCP (Leonard Erickson) writes:
>>
>>You are using a CGA card. The bug *only* appears on CGA cars and is due to
>>a BIOS bug. The bug is in the CGA scrolling routines... EGA BIOSes fix it.
>>
>>If the above is *not* true, then you have discovered a new bug. But most
>>likely you've re-discovered the old bug. 

>The bug also shows up on my ATI VGA Wonder.  That doesn't prove it's a new
>bug, though...  1/2 :-)

Well, a couple years back when I had more that for that sort of thing
I followed the goings on on the Borland Forum on CIS. At that time there
was quite a thread from programmers cursing ATI for their non-compatible
BIOS (as in BIOS call xx on an EGA is *supposed* to do this, on an ATI
card it does something else [or justr didn't work]). There were also
complaints about the "bios update of the week"....

ATI may have cleaned up their act, but I doubt it. *EVERYONE* who did
low-level access to video boards had horror stories. "My program runs
just fine... except on ATI cards. They *think* they fixed it with last
weeks update, but it's still broken..."
-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I'm all in favor of keeping dangerous weapons out of the hands of fools.
Let's start with typewriters." -- Solomon Short

ddavidso@mqccsunc.mqcc.mq.OZ (Dean Davidson) (02/06/90)

In article <822@tuewsd.lso.win.tue.nl> wsinpp@lso.win.tue.nl (Peter Peters) writes:
>The next program will show what I've come up with so far. Any
>comments (about the problem) are welcome....

>  Height = 1;   (* This is a troublesome value !!! *)
>
>  Window(Xloc,Yloc,Xloc-1+Width,Yloc-1+Height);
>  ClrScr;
>  For i := 1 To Width-1 Do Write('a');
>
>  Write('a');

It would seem to me that this is doing exactly as per design
That is on the last character to fill the window, the window is
scrolled.  There being only one line the window is cleared.
Or did you expect to see a line of a's completely filling
the window?

BTW were both methods supposed to give the same result?

On my machine - phoenix bios 3.10, dos 3.3, turbo 5.5
there was no discernible difference!
 
D

webb@uhccux.uhcc.hawaii.edu (Thomas Webb) (02/08/90)

Attributes deleted to protect the innocent...
>
>>The bug also shows up on my ATI VGA Wonder.  That doesn't prove it's a new
>>bug, though...  1/2 :-)
>
>Well, a couple years back when I had more that for that sort of thing
>I followed the goings on on the Borland Forum on CIS. At that time there
                                 ^^^^^^^^^^^^^^^^^^^^^
>was quite a thread from programmers cursing ATI for their non-compatible
>BIOS (as in BIOS call xx on an EGA is *supposed* to do this, on an ATI
>card it does something else [or justr didn't work]). There were also
>complaints about the "bios update of the week"....
>

A while back I posted an address for Borland at compuserve
(76703.764@compuserve.com).  The address is for Larry Kraft, and he
suggested that he thought it would be a nifty idea for people to send
copies of their borland product related problems to him and then
summarise the answers they got to the net.  His idea is, of course,
that such posts would be a form of word-of-mouth advertising.  I'm not
quite sure if that would violate the non-commercial charter of the
net, but it sounds reasonable to me;  not really different then
summarising any other information to the net.  Anyway, it would be
nice to know if those types of posts would be kosher or useful.

-tom

f
o
d
e
r
-- 
===============================================================================
webb@uhccux.uhcc.Hawaii.edu  "The first duty in life is to assume a pose.
                              What the second is, no one has yet
					discovered."            -Oscar Wilde