Date: Thu, 23 Jan 1997 16:52:53 +0200 (IST) From: Eli Zaretskii To: Moo-Juice cc: djgpp AT delorie DOT com Subject: Re: A few questions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 22 Jan 1997, Moo-Juice wrote: > but whenever I search through the FAQ I always seem unable to find the > relevant information I require... maybe its just me, or maybe it is just > obscure headings. Did you try to use the indices at the end of the FAQ? If so, and if they seem obscure, I'd like to hear suggestions on how to improve them. > 1. The project I'm working on, will be text only. For this reason, > I wish to be able to switch between 80x25 & 80x50 video modes. Is > it simple just to support these two modes? Which calls would I > need to set these, or other text modes? You should read the library documentation for all the functions of the "conio" family. From the DOS prompt, type the following words of wisdom: info libc func conio You will see a menu of all the conio functions. For example, setting the 80x50 video mode takes a single call to the `_set_screen_lines' function. (Note that the FAQ isn't a substitute for the library docs, so if you know you are looking for a library function, you should search the libc docs first.) > 2. When using other C/C++ compilers, defining a pointer to the video > memory was a simple case of 'unsigned far char *video = 0xB800;'. > Now I *do* know in DJGPP, it is different. What method would be > most advantageous and quick, to define a pointer to the screen > and work with offsets from that? See section 18.4 in the latest release 2.10 of the FAQ list (v2/faq210b.zip from the same place you get DJGPP). It describes all available methods and lists their relative merits. > struct Element > { > char ASCII; // Ascii character > char Col; // Colour > }; > > And lets say I had an array of these: > > Element Line[80]; > > This could easily represent an entire line of characters. And if > you can imagine that this line array contained simply, 80 characters > how would i 'memcpy()' this array to the screen? I don't recommend this method, since structures can be padded by the compiler due to runtime penalties for unaligned access imposed by the CPU in 32-bit mode. See section 22.9 of the FAQ for the details. A better way would be to define an array of shorts and fill it with characters and attribute bytes. Then you could use a library function `ScreenUpdateLine' to quickly write that line to the screen.