|Column Tag:||MidWest Report
Chicago Visited & TMON Re-Visited!
By Paul Snively, Columbus, Indiana, MacTutor Contributing Editor
Darrin Adler's User Area for TMON
Some of you may remember my review of TMON from ICOM Simulations, Inc. in the September, 1985 issue of MacTutor. If you do, you should be aware that I said two things which were incorrect, for which I apologize to ICOM and MacTutor's readers.
First, I said that TMON was the name of the first machine language monitor that I ever used. In fact, the name of the monitor was T-BUG, which was a terrible little tape-based monitor for the Model I TRS-80. My apologies to ICOM for associating their product with this primitive piece of code.
Secondly, and more importantly, I said that I thought that it would be a while before anyone came up with a way to improve upon TMON's pre-defined user area routines. The folks at ICOM have done their level best to make a liar out of me.
If the name Darin Adler rings a bell, it's probably because he's a co-author of Déjà Vu, the innovative Macintosh adventure game, and is the author of the SkipFinder desk accessory, which is one of the more elegant Finder bypassing tools around. SkipFinder is in the public domain, as is the Extended User Area that Darin wrote, which is the subject of this article. [The Extended User Area is available on the source code disk for this issue. Latest Version is 665. -Ed.]
Now its probably as good a time as any to write this disclaimer: the TMON Extended User Area was written by Darin Adler in a capacity not directly related to ICOM Simulations. The Extended User Area is not a product of ICOM Simulations, is not sold by ICOM Simulations, and most importantly, is not supported by ICOM Simulations. If you want a copy of the Extended User Area, you can get it from MacTutor, me, Darin Adler, and the Delphi and CompuServe information systems. If you need help with the Extended User Area, your best bet is to write to Darin Adler at the address given in the source file. Failing that, you can ask me. Incidentally, the Extended User Area is not completely documented anywhere other than here, so if there's something that I don't cover well enough, you'll have to talk to Darin or myself [Write Paul care of MacTutor. -Ed.]
The Extended User Area came to me on a disk which includes three files: PackIt II, EUA 662.pit, and EUA 662 Source.pit. PackIt II is the second version of the de facto standard Macintosh file packer program. The program is shareware, so please send the requested contribution. EUA 662.pit is a combination of User Area, EUA , and PatchTMON. User Area is the ready-to-load user area file for TMON; EUA is some skimpy (very skimpy) documentation, and PatchTMON is a little program that fixes TMON so that it will allow user areas as large as EUA version 662. EUA 662 Source.pit contains a lot of files which collectively make up the EUA 662 MDS source code ("for the curious and ambitious ones," says Jay Zipnick of ICOM).
Features of this new User Area
The Extended User Area (hereafter called EUA for the sake of my fingers) goes quite a bit above and beyond the call of duty for a TMON user area. It's so big that TMON must be patched to accomodate it. Among other things, it patches TMON itself to do things like show the application's screen behind TMON's windows and eliminate the schizophrenic cursor (there are no longer two separate cursor positions, one for the application and one for the monitor; the cursor is an entity distinct from any operational mode).
The EUA also adds some nice little features like implementing the _Debugger trap (the lack of which in the standard TMON Darin called an "oversight" when I talked to him), embedding the System.MAP globals in the user area (no more reserving space for the label table and loading the .MAP file), and making the distinction between what the system global TopMem says and what it really is (this appears to be crucial for proper operation under Switcher).
These, however, are just the icing on the cake - the "sexy" features, to borrow an idiom from The Soul of a New Machine. The real guts of the EUA lie in the things that you can see - new features used from the "User" mode within TMON.
Since the "E" in EUA stands for "Extended," you may have concluded that Darin has added on to the existing user area routines. This is true, and I won't bore you by rehashing what the existing routines do. Rather, I'll concentrate on the new ones.
First of all, there is the "Toggle screens" function. Since Darin has added several new functions to the user area, he had to provide the capability of getting to them all. Since the user window has no scroll bar (another oversight, says Darin), he had to split the functions into three separate screens. This function, which is present on all screens, is the mechanism for moving among the three sets of functions.
Templates for Key Data Structures
"Template" is a major new function which, when given the address of a data structure that it knows about, displays the names and contents of the pertinent parts of the data structure. For example, you can give the WindowRecord template the address of a WindowRecord and it will tell you the window's bounds, title, whether or not it's visible, highlighted, or has a close box, and a lot more. The other data structures that Template recognizes are ControlRecords, TERecords, and ParamBlocks.
"Stack addresses" simply displays the addresses on the stack from the top down. If the address is within a recognizable distance of a label, this function will display the label and its offset also.
Tracing Stack Activity
"Stack crawl" is a fascinating function. It's based on the fact that local variables for Macintosh programs are generally built around the LINK instruction using the A6 register. These local frames can also be nested; that is, any new frame points to the one that was there before it. Stack crawl threads its way through these local variable frames on the stack, showing you exactly where in the code these frames were created (i.e., where the program was executing when you entered the monitor). Since this function follows the linked list on the stack all the way to the end, it can show you a blow-by-blow account of what has executed up to the point that you entered the monitor. Keep this in mind the next time you enter TMON because of a 68000 exception!
The "Click mouse outside TMON" function is simply the "Show screen" function renamed, since the application screen can now be seen behind TMON's windows.
The "Launch" function purportedly allows you to either launch the Finder or relaunch the current application. Both fail miserably in version 662. Darin is working on a fix.
"Shut Down" reboots the system. The disks can be ejected before restarting or they can be left in.
"Windows" is one of those things that really should have been a part of TMON to start with. It allows you to define which windows you want to be open when you enter the monitor. The way this is done is a) enter TMON, preferably by double clicking, b) open your favorite windows, anchor them, and position them, c) open the user window and place the cursor by the windows function (it's on the second screen). Now you need to decide whether you want the user window open or not. If you do, choose 0, otherwise choose 1. Then exit to the TMON application (the dialog with all of the options). Press the "configure" button and save the user area back out to disk. Now whenever you launch TMON with that user area the windows that you selected will already be up and waiting for you (as will whatever choices you have made for such user area functions as Trap Intercept, Trap Signal, etc.)
Does it follow the Rules?
Now for the real biggie, the function that makes Darin's EUA completely worthwhile, even with the bugs that haven't been completely worked out. It's called Trap Discipline.
A bit of history is in order. There is an application called "Discipline" which was written by Steve Capps for the purpose of helping him avoid obvious bugs in new versions of the Finder. (Unfortunately for Mr. Capps, even Discipline can't find logic errors). Mr. Capps' version of Discipline was really intended for his own personal use, and from what I understand of the program from Darin - I don't actually have a copy - it reflects that fact in that it only checks some of the more esoteric and obscure elements of some of the more esoteric and obscure toolbox traps and OS traps.
Darin took the concept, extended it greatly, and made it an integral part of the EUA. Like most trap functions, Trap Discipline takes a trap number or range and optionally a PC address or range. As the trap and PC conditions are met, an appropriate routine is called which makes sure that the parameters to that trap are valid. If they are not, TMON is entered and a message displayed, which is usually nothing more than a question mark followed by the data type of the bad data ("handle," "string," "rect," etc.). Sometimes Discipline goes into more detail - "NIL address," it might say. The PC will be pointing to the trap that Discipline had problems with. Be aware that the fact that Discipline didn't think a parameter was kosher doesn't mean that it isn't. In particular, Discipline may think that a rect "makes no sense" - it may be off the screen or something. This may or may not be a bug in the use of a rect - it depends upon the application.
There are two styles of Discipline - strict and lenient. Darin recommends using strict discipline during program development and using lenient to look for idiosyncracies and bugs in existing programs.
Surprise! Apple's Stuff Flunks!
It's interesting to note that when I tell TMON to discipline all traps, some of Apple's own code doesn't make the grade. The MDEF code in particular seems to be prone to bad strings on a _StringWidth trap. Continuing execution, though, seems to have no ill effect. Trying to use Discipline on MacWrite results in a great number of Discipline entries to TMON and, eventually, in a crashed system! MacWrite breaks a lot of Mac programming rules and seems to still have a great number of insects lurking in its innards.
Speaking of bugs lurking, using Discipline on ResEdit prototype #0 (the old ResEdit) reveals why ResEdit seems to run out of memory so quickly. For some reason, after closing the window for a particular resource, ResEdit #0 tries to _HUnlock an invalid handle. Obviously, the real handle is still lying around in the heap, locked up tight as a drum. Open enough windows on individual resources, close them, and violá - you have a Mac filled with handles that should have been unlocked so as to make heap compaction possible. They weren't, so the result is heap fragmentation, rapid out-of-memory conditions, and a lot of headaches for ResEdit #0 users. Give yourself a break and use a newer ResEdit (1.0D11 seems to be current as of this writing; it's not without its flakeys, either, but that's another story).
Of course, another important EUA feature is that it goes a good way toward making TMON function properly with the new ROMs. It's not solid yet, and not all of the new ROM routines are named, and certainly not all of the low RAM globals are named, but it's a good start.
New Super Debugger on the Way
Note: TMON with EUA is NOT the last word on Mac+ debuggers. I have it from a reliable source that ICOM Simulations has planned and is working on a new debugger for the Mac+ that will completely blow away everything that has come before it, including the current version of TMON. In fact, it's been suggested that a lot of the ideas implemented in EUA are experimental versions of things that will be standard in this new debugger!
All of this is starting to sound rather unreal, isn't it? My vote for the most useful developer's tool on the Macintosh goes to TMON with Darin's EUA hands down. If you are a 512K Mac programmer and you are programming in a language which generates 68000 machine code as its end result (as opposed to M-CODE; direct, indirect, or token threaded code; or straight interpreted systems - sorry MacModula-2, MacFORTH, Neon, and MS-BASIC programmers), you owe it to yourself, now more than ever, to be using TMON and Darin Adler's Extended User Area.
On the down side, the documentation for the EUA is sketchy. There are a few bugs in version 662. Darin is also a prolific programmer. I got a copy of his EUA without Trap Discipline from him, and within a matter of less than three weeks I got a copy that had it. Since this is public domain software and is Darin's pet project, it is subject to change without notice and it may change at an alarming rate. I will keep informed of any further upgrades to TMON and Darin's EUA, and I will pass that information along to you.
Now, if you don't own TMON, aren't you just a little jealous? [If so, you can get it from MacTutor's mail order store. TMON is a commercial product, only the EUA is shareware. -Ed.]
MacExpo '86 Chicago Report
It was an interesting event.
MacExpo '86 took place from ten in the morning Friday, April 25 to five in the afternoon Sunday, April 27 (with very brief periodic breaks to do things like eat and sleep - not all in attendance were programmers).
Ironically enough, I was at the expo as a private concern - I had no idea at all as to whether MacTutor would be there in an official capacity or not. I decided that even if MacTutor wasn't an exhibitor that I could write about what I saw and therefore deserved at least press standing. Apparently the organizers agreed; I received my press kit and ID badge with no problems.
The first booth to appear upon entering the hall was the MACazine's, which makes sense; they were in large part responsible for this expo taking place.
I decided that the best way to tackle the floor was simply to wander around until I saw something interesting. Fortunately, one of the first things to catch my eye was a banner with our name and logo on it (I had never really realized how distinctive our MacTutor icon is until I saw that)! At that point I had the first of what was to become a fairly common experience: seeing the face behind the voice on the phone. I had the pleasure of meeting Laura and Mona, two ladies whose names should be familiar to most of our readership. For those who don't know, Laura is Laura Smith, the manager of MacTutor, and Mona is Mona Crompton, our circulation manager. David Smith, our ever-dedicated publisher/editor-in-chief, was not able to be present because - what else? - he was busily preparing the May issue for publication.
Having met the other MacTutor folks, I started to look around the floor. Here are some people and things that I saw.
Kriya Systems was there to show off Neon version 1.5 and the new Neon assembler. I did get the 1.5 upgrade but I did not get the assembler; I was on a pretty tight budget. There are a lot of things to like about the upgrade: more of the system source is there, and there are some new classes to do even more neat things (2D and 3D arrays, for example) and some new utilities, like a decompiler.
Odesta had demos of the various versions of Helix every hour on the hour. I'm not sure that I remember all of the Helix family, but I remember Helix, Double Helix, Multi-User Helix, and RemoteHelix. The Helix system in whatever form is a very impressive package, and I recommend it very highly for anyone who needs a very powerful yet very easy to use database system.
It seems like everyone and his mother has a SCSI hard disk out for the Mac+ now. It's good from a purchasing perspective; the competition drives down prices. I was very impressed with Mirror Technologies MagNet 20. It's a small, narrow, thin drive that sits alongside the Mac and, of course, runs from the SCSI port of the Mac+. It's small, fast, and completely silent. At the show it was $995.00.
Levco was there, and of course the big deal was the Prodigy 4, Levco's 68020/math coprocessor/4 meg RAM upgrade. This is a power user's dream; a system with this upgrade is faster than a VAX 11/785, prompting Eric Zocher of Silicon Beach Software (all together now: Tah tah tah tah tah, tah tah tah tah tah) to refer to it as the "MacVAX." The upgrade is supported by at least two development systems: Consulair's Mac C and Palo Alto Shipping's Mach 1.
Silicon Beach Software was there, and they've been busy. World Builder, the system used to create Enchanted Scepters, was on display and is due to be released this summer. Likewise SuperPaint, a combination MacPaint/MacDraw program that looks very, very nice.
Ann Arbor Softworks was there to show FullPaint, their plug-in replacement for MacPaint. Seems like everyone's trying to outdo Bill Atkinson these days. With MacPaint's limitations and the unbundling of it with the Mac+, I suppose it was inevitable. FullPaint is an ambitious paint program, but it lacks SuperPaint's hybrid paint/draw capabilities. However, FullPaint is available now, whereas SuperPaint isn't. [It's also protected, a consideration that could be discouraging for a paint type utility. -Ed.]
VIP - Very Important Program?
Mainstay was there with their new product line, and quite a line it is! Mainstay has established themselves in the field of writing small, useful tools like Turbo Download, Type Now, and Disk Ranger. The most exciting thing that I saw from Mainstay is a system called VIP, which stands for Visual Interactive Programming. VIP is a structured interpreted programming system which is graphical in nature. Program constructs are entered by clicking on tools on a palette a là MacPaint. Assignment operators, looping constructs, even toolbox access is represented graphically in almost a flowchart form. Once the program is laid out, it can be run and/or debugged. This system is also slated for a not-too-distant release date. [Watch for a MacTutor column on VIP in a future issue. -Ed.]
Palo Alto Shipping was present. Their Mach 1 development system is at version 1.25, and it incorporates some new optimizations, particularly for the DO LOOP construct, that make an already fast system run like greased lightning. If you have any interest in Macintosh FORTH systems at all, and don't mind not having the object-oriented capabilities of Neon, then order Mach 1 now, because there are rumors of a future rise in price.
"The Rest of Us," a huge Chicago-area Mac users' group, was there. Not only were they there, but they had two very big names in the shareware business with them: Scott Watson, whose remarkable Red Ryder terminal program has developed a reputation that borders on mythology, and Don Brown, author of the MockPackage and numerous other shareware offerings.
Red Ryder is now at version 9.1 (or at least it was yesterday - it went from 9.0 to 9.1 at the show, and I had to trade up because of that). There have been numerous enhancements to Red lately, not the least of which is Mac+ and HFS compatibility. VT100 and VT52 emulation are there, folks, as is support for CompuServe's B protocol file transfers. People at the show could buy "pre-registered" copies of Red for the same old $40.00 price that Scott has always asked for. Scott also gave a seminar on shareware (talking primarily about Red, of course) and mentioned briefly the enhanced graphics driver, called Nautilus, that Red contains. He's working on some tools to make Nautilus useful to everyone; when those are done he'll document Nautilus completely. Sounds exciting!
Construct your own BBS!
Paying for Red now gets you something new from Scott: Red Ryder Host, which Scott refers to as "a BBS construction set." It's not a BBS; it's a set of tools that let the user create a custom BBS with multiple security levels, upload/download, multiple message centers, and so forth (are you listening, Rusty)? This is available only to registered Red owners and is NOT shareware - any non-registered Red owners operating a Red Ryder Host-created BBS are in mucho trouble. Unfortunately, Host takes up two disks all by its lonesome (Scott says it includes over seventy pages of documentation) and required too much time/expense to include with the Red packages at the show (it would have been a four disk package all together). So, registered owners need to download Host from GEnie, which is where all of Scott's support is handled now.
D2 Software was there showing MacSpin, the three dimensional statistical analysis program that has been drawing rave reviews. I'm afraid that statistics of any kind is out of my league, so I can't comment on the program myself.
Enabling Technologies was present to show Easy 3D, the novel three dimensional modeling program. This one shades very quickly and has different "light sources" for a variety of shadowing capabilities. If you need to draw shaded three dimensional images, this looks like a great system.
There were many, many other exhibitors and products there, and it is not my intention to slight anyone by not going into detail about them or their product. These descriptions here are just things that popped into my memory after the weekend was over and I had some time on my hands with which to nurse the strep throat that I developed and to write about what I remember happening.
Friends of MacTutor
Random notes: Meeting people. Jerry Daniels of the Mac Underground Doug Clapp Sitting with Silicon Beach Software at the exhibitors' party as they received an informal award for best graphics product (SuperPaint) and listening to the author muse about adding neat new features like cut and paste support Meeting John Pence of Affinity, the author of Tempo Making the acquaintance of Eric Zocher from Silicon Beach and looking at World Builder and SuperPaint - and a behind the scenes look at Lightspeed C (wow!) Meeting Scott Watson and beginning to understand his software philosophy - and why Red Ryder is making it come true, plus getting a one sentence glowing review of Lightspeed C - so glowing that it can't be repeated in a family-oriented magazine like MacTutor Running into Jay Zipnick of ICOM Simulations, trying to move TMON on his behalf, and seeing a sneak preview of Uninvited, the successor to Déjà Vu - if you liked Déjà Vu, you'll love Uninvited
And, most important of all, meeting the many MacTutor subscribers who keep us going and keep us on our toes. Some are developers for major Mac software firms, others are hackers digging into the machine for the pure joy of it. Either way, the "atta boys" and the constructive criticisms are much appreciated. Writing for a magazine is a very anonymous profession, and it's wonderful to meet the people who are reading your material. So thanks, guys.
Well, I think I'll wrap this up now. I've got a lot of stuff to look at from the expo, including a flowcharting program that looks very promising, Neon 1.5, Mach1 1.25, and soon some other things which haven't been released yet. Stay tuned! Enjoy,
Paul F. Snively