From: Brian Osman Newsgroups: comp.os.msdos.djgpp Subject: Re: Help improving function sped needed. Date: Tue, 18 Feb 1997 17:48:43 -0500 Organization: Rensselaer Polytechnic Institute, Troy NY, USA Lines: 37 Message-ID: <330A31CB.28CB@rpi.edu> References: <5eccbc$f31 AT lion DOT cs DOT latrobe DOT edu DOT au> Reply-To: osmanb AT rpi DOT edu NNTP-Posting-Host: darkwing.stu.rpi.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hello, I just read the post about the direct acces windowing system. I have one idea, though I didn't read the source code entirely, so I may something really stupid. Try redefining the idea of a string. (Like XWindows does.) Internally, store your strings as: [Char][Attrib][Char][Attrib]... It takes two bytes instead of one for all storage, but memory is cheap. This way, when you want to write, you can do things like memcpy() to simply transfer the entire string to video memory. As for clipping and word wrapping, do a little while loop: (pseudocode) n = length(str) while (n > WindowWidth){ use memcopy to move WindowWidth characters to vid mem increment row index. } This would require writing a few basic functions to go between the two formats, but it shouldn't be hard, and those would be easy to write so that they are very fast. For example, to convert a normal string to an "attrib'd string" you could try something like: for every character in string NewString[i] = (attrib << 8) & (OldString[i]); There are probably some serious problems in my logic, as I just made this up. Still, this may have potential. Oh well, good luck, Brian P.S. I worked a little on something like this in Pascal years ago, but I never got nearly this advanced (ie no real Windowing.)