Xref: utzoo comp.sys.ibm.pc:43991 alt.msdos.programmer:1185 Path: utzoo!attcan!uunet!bnrgate!bigsur!bnr-rsc!mlord From: mlord@bnr-rsc.UUCP (Mark Lord) Newsgroups: comp.sys.ibm.pc,alt.msdos.programmer Subject: Fix for TURBO-C 2.0 Text I/O Keywords: turboc borland c text gotoxy video Message-ID: <2125@bnr-rsc.UUCP> Date: 8 Feb 90 15:12:56 GMT Organization: Bell-Northern Research, Ottawa, Canada Lines: 37 Hi. While converting my copy of STEVIE ("vi" knockoff) to use the built-in Turbo-C text routines (conio.h), I discovered that the library routines are hardcoded for exactly 25 rows of text. The number of columns seems to be correctly obtained from the bios, but the number of rows is fixed at 25 in the video initialization. Since I often edit with 30, 40, 50 or 60 lines of text, this was not cool. I used TLIB and READOBJ together to get a segment listing of the video initialization module from the libraries, and found an undocumented data segment called _video . Some further probing with TD revealed that this segment holds the internal copy of the screen/window sizes, as normally queried using getttextinfo(). This makes it trivial to correct this deficiency after startup in any program. Here is what to do, if YOU want Turbo-C routines to work correctly, regardless of the number of lines/columns in text mode (mode 3): extern struct text_info _video; _video.winbottom = *(char far *) MK_FP(0x40,0x84); _video.screenheight = _video.winbottom + 1; The first line gives you access to the hidden "_video" structure, the second line reads the actual bottom text row number from the bios data area, and the third line completes the fixup. After doing this (like really early in the code eh?), the standard library gotoxy/insline/deline... routines will then work correctly for screen sizes other than just the 25-line modes. That oughta hold us over until May/90.. -- ______Mark S. Lord______________________ ______________________________ | ..uunet!bnrgate!carrsc!mlord | These are only MY opinions. | | or: bnr-rsc!mlord@bnrgate | I charge for official views. | |________________________________________|______________________________|