Path: utzoo!attcan!uunet!mcvax!enea!kth!draken!tut!santra!kampi!jmunkki From: jmunkki@kampi.hut.fi (Juri Munkki) Newsgroups: comp.sys.mac.programmer Subject: Re: Text Drawing at speeds in excess of 1200baud Keywords: help, software, terminal, DrawChar, QuickDraw, ack Message-ID: <18719@santra.UUCP> Date: 15 Jan 89 14:03:05 GMT References: <2220@uokmax.UUCP> Sender: news@santra.UUCP Reply-To: jmunkki@kampi.UUCP (Juri Munkki) Organization: Helsinki University of Technology, Finland Lines: 55 In article <2220@uokmax.UUCP> srpenndo@uokmax.UUCP (Sean Richard Penndorf) writes: >I am writing a terminal program in LSP, and in my development have found >that the DrawChar routine bogs down when you are connected at speeds >greater than 1200baud. My ultimate goal is to be able to write to the >screen at 2400baud. > >I have tried saving the font being used in a BitMap, then stamping it to >the screen with CopyBits. I have also tried using DrawText, and the lower >level routine StdText (?). So far, everything I have tried bogs down >at 2400baud. I am currently writing a terminal program and it can currently do about 95% of what MacTerminal does (including the ability to scroll back and copy stuff). The program easily supports 19200 baud on a Mac II, but I haven't tried it on a Plus or SE yet. I think you are experiencing a very commong beginner's problem. You are probably handling the characters one at a time. You get your character, look at it (to see if it's part of an escape sequence) and then draw it on the screen. This is not the efficient way to do it. I think you can get very close to 2400 baud with this technique, so you might be doing something else wrong too. (You might be drawing & erasing the cursor every time you draw a character.) I did some research before starting to write my terminal program. I tried drawing a string by drawing one character at a time and drawing it with a single call to drawstring or drawtext. In my tests, drawing the string was about six times faster than drawing a single character. When you have characters in the incoming buffer, do this: 1) Read all the characters with FSRead. 2) Hide the cursor. (Not the arrow, the block/underline in the terminal) 3) Remember the first character you are processing. 4) Process the characters looking for characters that QD can't handle. 5) If you find you have to move to another place on the screen, (you might be processing a return or a linefeed) draw the characters you have already handled with one call to DrawText. remember the next character you will be processing. else just advance to the next character. 6) When you have looked at all the characters, call drawtext for the remaining text. 7) Display the cursor at the new position. When receiving characters at a slow rate this routine will move the cursor for every character and draw the characters individually. At higher speeds the buffer tends to contain more characters and you end up drawing a whole line of characters with a single call to drawtext. I hope this helps. _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | Juri Munkki jmunkki@hut.fi jmunkki@fingate.bitnet I Want Ne | | Helsinki University of Technology Computing Centre My Own XT | ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~