Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!s.psych.uiuc.edu!amead From: amead@s.psych.uiuc.edu (alan mead) Newsgroups: comp.lang.pascal Subject: Re: difficulty filling in last square on screen Message-ID: <1991Apr29.021532.1777@ux1.cso.uiuc.edu> Date: 29 Apr 91 02:15:32 GMT References: <91116.172244TOAD@LIVERPOOL.AC.UK> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 56 TOAD@LIVERPOOL.AC.UK writes: >I'm writing an editor type program in tp 5.5. This is not a particularly >difficult task, except that in crt mode I can't plot a character into the >bottom left corner of the screen without causing the screen to scroll. Now this >... > Any suggestions? Yup. I wondered about this as well. It was a problem for me when I first wanted a "framed window". Whether or not TP uses direct screen writes in WRITE() and WRITELN(), the BIOS "ettiquite" is observed--thus if you write to the end of a line, a carridge return-line feed combination is written. If this occurs at the last row, a scroll is perfromed as well. This scroll is causing your problem. The easiest way to avoid this is to use your own direct screen writes (well, the *easiest* method is to limit yourself to the first 1999 character cells, perhaps by only supporting 79 columns). While many asembler implementations exist, like Technojock's Turbo Toolkit and Borland's WIN.PAS and the windowing unit in the book _Advanced Techniques in Turbo Pascal_ by Ohlsen & Stoker, (and many others) you can do it pretty well in TP. CAUTION: The following is from memory, but I believe the details are correct. Video *TEXT* RAM starts at either $B800 (for color) or $B000 (for mono) and is 4000 bytes long (25 x 80 x 2 = 4000; but remember that as an offset the numbering goes from 0 to 3999). The first byte is the attribute (which is exactly like the TEXTATTR byte in the CRT unit). The second byte is the ASCII (ie from the table in the back of the TP manual) character occupying the cell. So write your string to video RAM, try: Mem[ Video_base : ( 160*( Row-1 ) + 2*( Col-1 ) )+1 ] := Byte( C ); where Row and Col are Y and X as in GotoXY(); VideoBase is either $B800 or $B000; and C is the character to be written. The current screen colors of the text will not be altered. The easiest way to alter them (not the fastest) would be to set the correct colors using TextColor() and TextBackground() and then assign Mem[ Video_base : ( 160*( Row-1 ) + 2*( Col-1 ) )+0 ] := TextAttr; You should also be warned that this method will not work with screen sizes other than 80 columns x 25 rows and that it might not work on all "compatibles" and it might not work in the future. Hope this helps. -alan : amead@s.psych.uiuc.edu