Newsgroups: comp.sys.apple2.programmer Path: blue.weeg.uiowa.edu!news.uiowa.edu!uunet!gatech!howland.reston.ans.net!news.starnet.net!wupost!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@atlantis.actrix.gen.nz (David Empson) Subject: Re: More Console Driver questions Message-ID: Sender: news@actrix.gen.nz (News Administrator) Organization: Actrix - New Zealand Internet Service Providers Date: Sat, 7 Jan 1995 04:36:05 GMT References: <3ejvvp$nmn@gap.cco.caltech.edu> X-Nntp-Posting-Host: atlantis.actrix.gen.nz Lines: 78 In article <3ejvvp$nmn@gap.cco.caltech.edu>, Nathan Mates wrote: > This bloody GS/OS console [abomination] driver is really starting to > get on my nerves. First it misbehaves, then it doesn't seem to be > documented right at all. [Sounds like any general 3rd party software > you rely on, but I digress :) ] There are a few errors in the GS/OS Reference regarding the Console Driver. You've already spotted one of them: RestoreTextPort is the opposite of SaveTextPort, not GetTextPort. SaveTextPort and RestoreTextPort are used to save and restore rectangular areas of text on the screen. GetTextPort gets all the output settings (the "text port record"). There is no way to directly set the text port record, but all of its fields can be set by writing appropriate characters through the console driver. The fields are set as follows: Character sequence Fields set $1E x+32 y+32 ch, cv $02 left+32 top+32 right+32 bottom+32 windLeft..windLength $15 mode consWrap..consScroll, consDLE either of $0E or $0F consVideo, consFill either of $18 or $1B consMouse The codes $01 and $04 are used to save and restore this record ($01 saves and restores defaults, $04 pops the previously saved one), so to save the prior text port, all you need to do is output character $01 before using the console driver, then output $04 when you've finished. > But, the action of putting up this text dialog plays havoc with the > host application for the CDA. From Orca/Shell (text, latest version), > the next command is not executed at all, but others after that are > fine. It sounds like a problem with the input port record rather than the output record. Try using GetInputPort and SetInputPort around your call. Note: this is where the GS/OS reference may have another error. The input port's maximum transfer count is supposedly 12, but there are 17 bytes in the record. I haven't used the console driver input routine yet, so I haven't tried experimenting with this or disassembling the relevant part of the driver. > Looking back in the history, that one command is replaced by an > appropriate number of spaces. Finder 601 goes unstable. GNO's GSH > (standard shell) is the one program that seems totally unaffected, so > I didn't notice anything until my beta testers complained about it. GNO doesn't use the console driver, so there is unlikely to be any conflict. The big question: is the Console Driver re-entrant? If not, then it isn't safe to use it from a CDA. I would expect it to increment the busy flag while it is in a non-re-entrant state. Come to think of it, assuming ORCA/Shell is using DReadGS or ReadGS to perform input, then the CDA's GS/OS call would fail, because the OS would be busy. > What the heck is up? RestoreTextPort puts back the screen; > there's no way to restore a TextPort record (16 bytes) to the screen > as far as I can tell. The byte transfer count disagrees between > SaveTextPort and RestoreTextPort. RestoreTextPort is probably wrong, since windWidth and windLength are bytes. I use (windWidth * windLength) + 2 in my calls, and I haven't noticed any problems. The minimum request count for RestoreTextPort is probably supposed to be 2. -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand