America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, June 30, 1992 10:00 p.m. Eastern Time Topic: Debugging (General Questions) Forum Leader: Gary Jacobson (AFL GaryJ) AFL GaryJ Welcome to the Apple II Development Forum! Tonight's topic is.... AFL GaryJ Debugging your Software! We are expecting to have here as our special guest, AFL GaryJ Mike Westerfield from the Byte Works. Hopefully he'll be here soon. AFL GaryJ Mike has recently announced a new product called "ORCA/Debugger". AFL GaryJ It is supposed to be the "GSBug" of higher level programming (i.e. AFL GaryJ ORCA/Pascal, and ORCA/C) AFL GaryJ We can talk about debugging in general, or take some off topic questions while we keep our AFL GaryJ fingers crossed that Mike will show up tonight :) WinkieJim Anyone know what (if any) is the maximum number of directories can be nested WinkieJim under Sysy6? Also the max number of windows? Sheppy The only limit I know of (on directories) is that they have to fit within Sheppy a maximum length GS/OS pathname. ie, if each directory has a one-char name, Sheppy you can get that many directories (considering the slashes as well). I've Sheppy never heard of any other limit, although I suppose one might exist. I know Sheppy that testing Pro.FST, I tested 52 nested directories. Pest II that's 32 directories Shep ... that's also a limitation of the ProDOS FST Pest II I don't know if it applies to the others Sheppy Pest: that's only for the 64 character pathnames under P8 or the first Sheppy 8 prefixes under GS/OS. The others are something like 16K (or maybe 4). WinkieJim 8k actualy... Sheppy I can look it up real fast in GS/OS ref. GA. Jimurphy3 Well, GS/OS limits long prefixes (@ and 8 through 31) to approximately 8000 characters. AFL GaryJ Ok, next question is from Toleth. GA Toleth Ok, how do you change a font for a pop up menu. Sheppy What do you want to change? Style or the font family? Sheppy (Style is easy, family not so easy) Toleth I want to display a picture (icon type) in the pop up menu items. Sheppy Oh; that's not a font. That's an icon. Under System 6.0, you use Sheppy a special new menu structure which I haven't read about. Somebody else Sheppy take this. GA. :) WinkieJim It's basicaly a call to the menu manager to add an icon to the beginning of a WinkieJim menu item... Toleth ok, so it is set by the menu manager ? WinkieJim Yup, since a pop up menu is just another menu Jimurphy3 To simply insert an icon, you first need to make your pop-up the current menu bar... Jimurphy3 then you call SetMItemStruct on the menu item you want to add the icon to... Jimurphy3 then you call SetMIcon with a reference to your icon. It's that simple. :-) Developer1 ok... um I am trying to make a table in C.... Developer1 and I have no idea how.... :D AFA Jay Ok, so explain this table a little more :) Developer1 ok... well, it involvs the armor class and dexterity for those of you familiar AFL GaryJ Like an array Developer1 with AD&D. armor class is based on dexterity... so for example... AFA Jay is this like a two dimensional array maybe? AFA Jay are both "columns" the same thing, like integers? Developer1 yes... they will be maximum of two digits... AFA Jay ok, so you need something like Developer1 actualy, they may become negative at one point... AFA Jay int Array[10][2]; AFA Jay int = signed int ;) Developer1 ok... right. Developer1 but the 10 and 2 are what? just random numbers you picked out? AFA Jay 10 are the number of "rows" and 2 is the "columns" Developer1 OIC... ok... Sheppy (numbered 0...9) Developer1 that sounds just about perfect so far... how do I get numbers into the array? AFA Jay Are you inputting them? calculating them? AFL GaryJ Or, is it a fixed table of numbers? AFL GaryJ Steve, if you want to jump in here with your comment, Go ahead. AFC SteveB Developer, are at least one set of the numbers ordinal? Sheppy English translation: if they continuous/contiguous? AFA Jay counting numbers, 1, 2, 3, 4, :) Developer1 THANK YOU!!!! that's what I meant. AFC SteveB No... Developer1 instead of cardinal numbers... gotcha... yes both columns will be... but Developer1 they may become negative.... so they aren't unsigned... AFC SteveB If they could become negitive, then my idea's shot down... AFC SteveB I thought maybe you could do something llike: Developer1 oh... well only one column could become negative... AFC SteveB int myCoolArray[10] = {4,6,1,8,3,7,7,1,9,8}; AFA Jay I still question, how is this array going to be filled? Developer1 whatdya mean? I am asking you guys how to put numbers into the array... AFA Jay Something like this: AFA Jay Array[0][0] = 1; AFA Jay Array [0][1] = -1; Sheppy That depends, Dev. Do they have to go on the fly? Developer1 um sheppy, what do you mean "to go" on the fly? Sheppy What I mean is, do you need to change the values as the program runs or are Sheppy they constant throughout? Developer1 constant... throughout... but for example... let's say that I am a dwarf Developer1 warrior... I first base my armor class on my dexterity... (the array) but then Developer1 afterwords, I may say, if (race = dwarf) { armor class = armor class + 1; } Developer1 I think I just screwed up the array though... Sheppy I don't remember... can you define the values in Sheppy an array in the source code (array[10] = {x,y,z,...}? AFC SteveB Is there an echo? :) Developer1 guys... um, can we slip back into the question... how can you feed #'s into Developer1 an array? Barnabas Are you referring to reading the numbers from somewhere, like data stataments? AFL GaryJ I believe that is his intent (a pre-defined array) Barnabas This is a team question, actually. Sheppy Yes, it is.. :) Barnabas Sheppy? Sheppy I'm here, Greg. Let's go. Barnabas Dave Lyons, you listening? Barnabas We've been having some problems with the Resource Manager and resource apps. Barnabas OK, we found that sometimes the Resource Manager gets into a state where our Barnabas app no longer has its file open... or something along those lines. After that, Barnabas every time you launch it has that problem. We tracked through all imaginable Barnabas (and some not so imaginable) tool calls, and finally found some apparent probs. Sheppy We at first thought it was our own code that was at fault. Sheppy But it wasn't so... really. Dave Lyons Okay, shoot. (BTW, does \files or \res show anything strange [in Nifty List]?) Barnabas Specifically, when the Resource Manager was started up in _StartUpTools, Barnabas it was returning an error! But, no errors are documented for it until 6.0. Dave Lyons What error? Sheppy dupResStartup. Barnabas However, the _StartUpTools does NOT check for errors! Barnabas But we hadn't started up the Resource Manager! Someone else had... we'll get Barnabas to that later on. Barnabas (One thing at a time). Dave Lyons Okay, so tell me what you found already.... Barnabas When StartUpTools doesn't check for the error, it somehow manages to load Barnabas the Tool load table from the Resource fork... but on return to the app, Barnabas the Resource Mgr. is the current app, and our apps file was apparently closed Barnabas or put in back or something... because we get resources from other files or Barnabas garbage, but not our resources! M Wolfgram The resource manager is always started... You're simply logging in to it... M Wolfgram sounds like some other problem with startup. Sheppy Yes, Marc, that's true. We were getting resources that were not ours... Sheppy but we know whose and it makes sense when you know the whole story. Dave Lyons Okay, if you got a resDupStartup error, that ID already started the Resource Manager and never Barnabas The problem is that the we're already logged in (from another problem), and Dave Lyons shut it down--either a previous execution of your own app, or some other app that used to have Dave Lyons that ID. Barnabas Exactly, Dave. But _StartUpTools should check for that error! Sheppy Right, Dave, that's what we're doing NOW. But there's more that Greg hasn't Sheppy told yet. Barnabas As it is, it returns NO error, although it has messed things up. Barnabas (with the Resource Manager) Sheppy The reason this occurs is because _StartUpTools doesn't do a _ResourceShutDown Dave Lyons Yes, it should...it's not going to fix your problem though, just make it show up better. Sheppy if it fails, leaving our program logged into the RM on this error -- which Sheppy _StartUpTools does not tell us about! It returns NO ERROR!! Dave Lyons Interesting issue. I believe you should call ShutDownTools even if StartUpTools fails. Sheppy We do! But ShutDownTools apparently knows that the startuptools failed, Sheppy so doesn't do anything. Barnabas If OpenResourceFile (called after ResourceStartup) fails, no tools have been Barnabas started. Sheppy Exactly. Dave Lyons Okay, so what goes wrong _first_ (a StartUpTools failure at what stage causes this cascade)? Sheppy Basically, we issue _StartUpTools. Then, _StartUpTools does a Sheppy _ResourceStartUp. Whether or not an error occurs, StartUpTools then Sheppy attempts to open our resource fork and load the tools. But it can't because Sheppy the resource fork can't be opened since the RM call failed. Dave Lyons Wait-- Sheppy Oh, one more thing. This all begins becase the ToolStartup record is not Sheppy found the first time we run the program. From then on, this occurs. Dave Lyons Sure it can, it should successfully open your resource fork into the $401E search path. Dave Lyons But then soon as your app does a SetCurResourceApp to its own ID, you've resurrected the old search Dave Lyons path from before. Barnabas That's not quite right, Sheppy. Can I explain the sequence? Barnabas Ok, here's what happened: I accidentally launched our app before I copied in Barnabas the resource fork. StartUpTools was called, returned an error from Barnabas OpenResourceFile. We present a TLTextMountVol dialog, then call ShutDownTools. Barnabas But ShutDownTools doesn't shut down the Resource Manager, because StartUpTools Barnabas apparently didn't get far enough. Dave Lyons You should get $1E06 from LoadResource--it is *not* an error for StartUpTools to be unable to open Dave Lyons your resoruce fork, because you don't have toave one. Dave Lyons But it doesn't bother checking that, right? So it just returns the $1E06 error (resource not found). Sheppy Not to our application, it doesn't. It returns "no error." Dave Lyons No error after doing what inside? Failing to load your Tool Table resource? Barnabas We get the error because we can't open the Resource Fork but the tool startup Barnabas record is there. Matt DTS I think they're trying to say "If you pass a startStopRecord by resource but the resource can't Matt DTS be found, StartUpTools returns no error and doesn't do enough stuff... Matt DTS ...to let ShutDownTools remove your resource app from the system." Right? Dave Lyons Are you saying it returns no error? I'm saying you get $1E06. Dave Lyons At any rate, I'll fix ShutDownTools to always try to shut down the Resource Manager. Barnabas Not quite, Matt. It returns an error... Barnabas ...but leaves the Resource Manager logged in. ShutDownTools won't shut it Barnabas down. Matt DTS Ah. It doesn't store the right stuff in the startStopRecord so ShutDownTools doesn't shut it Matt DTS back down. Gotcha. There's an easy enough workaround if you're disgusted with it currently. Barnabas Right! Barnabas Yes, we figured out workarounds, but the problem is, it could happen to any- Barnabas body, since one app's mistake will hurt existing apps with the same ID! Barnabas When we relaunch, of course, we run into the originally mentioned problem: Barnabas _StartUpTools doesn't return the ResourceStartUp error, and weird stuff happens Matt DTS I think you're attaching way too much importance to this bug (kind of like GS+ ranting about the... Matt DTS ...tellFinderAddrBundle bug when there's a _trivial_ workaround). The whole cascade starts... Matt DTS ...when you try to pass a resource to StartUpTools and the resource isn't in your resource fork. Matt DTS This is _hardly_ a bug that will bite shipping applications -- have you ever seen someone ship an Matt DTS application and then have to recall it with "Whoops, I forgot my resource fork!"? I haven't. Matt DTS Sure, it's a bug, but it's not something likely to wreak havoc throughout the GS/OS world. Barnabas However, the next app run after the problem happens will suffer... Dave Lyons So, thanks for tracking this mess down. The two changes I'm planning to roll in are Dave Lyons these: (1) StartUpTools should give up & return any error it gets from ResourceStartUp, and Dave Lyons (2) ShutDownTools should always try to shut down the Resource Manager, even if StartUpTools didn't Dave Lyons get very far. -- This will make SUT/SDT more solid and much less confusing to debug, but it's by no Dave Lyons means an emergency sort of bug (don't expect a 6.0.0.1 next week to fix this or anything!). GA Barnabas I don't think that second one is correct, because of the way ResourceShutDown Barnabas works... Sheppy Dave & Matt: Dave hit the exact point. This is nasty to debug if you don't Sheppy know about it. I never saw this problem until I intentionally recreated it, Sheppy but to someone who doesn't know about it, it means _hours_ of strange debugging Sheppy and stuff. Dave Lyons So, what's the alleged problem with SDT always trying a ResourceShutDown? If the CurApp is $401E, Dave Lyons it will do no damage (starting with 6.0). ga Sheppy (I was wondering the same thing) Matt DTS (Dave: SDT shouldn't try to shut down if the "don't start the Resource Manager" flag was set.) Dave Lyons Matt, right I was thinking of that bit. Barnabas Well, if you implemented it right, so that you did it in conjunction with Barnabas StartUpTools, I guess it would work... I just meant, indiscriminately shutting Barnabas down the resource manager if it HADN'T been started might be problematic... Sheppy Greg: Not at all; since it's specific to an application, you don't have to Sheppy worry about it as long as you consider that bit. :) Dave Lyons Barnabas, other than the flag bit, it should always be okay. ResourceShutDown shuts down the current Dave Lyons resource application only, and if the ResourceStartUp failed then the CurApp will be Dave Lyons $401E (the RM itself), which ResourceShutDown is already smart enough not to shut down. Barnabas Well, the bit is what I was referring to... it just sounded like you were Barnabas suggesting always calling ResourceShutDown from ShutDownTools. Matt DTS Eric: It wouldn't be _hours_ of debugging for most people -- most people would try rebooting... Matt DTS ...at least _once_. :) Barnabas Matt, we were trying to figure out why it happened! It only happened occasion- Barnabas ally, so we didn't know whose fault it was. M Wolfgram Hi All... Dave, we spoke about 18 monts ago about Line Edits in SFPGetFiles... M Wolfgram I thought (mistakenly) that w/6.0 and targetable controls I could do it now M Wolfgram ... can you see if a vehicle can be implemented in the future for text type M Wolfgram things in SFPGets? Dave Lyons Yes. Dave Lyons Right now, Dave Lyons Standard File uses the Dialog Manager (and it has to keep doing that, of course, for compatibility Dave Lyons with all the stuff that requires that, like dialog hook routines passed to SF calls), Dave Lyons so the tabbing between the filename edit-line and the file list *looks* like Dave Lyons the beautiful Extended Control tabbing the Control Manager does for you, but it's actually completely Dave Lyons different inside (Standard File does the work itself). Dave Lyons So I was thinking maybe I can create an out-of-dialog Dave Lyons editLine, let the Dialog Manager handle the tabbing between edit lines, and then have SF tie the Activ Dave Lyons status of the *List* to the hidden edit line. That way an arbitrary number of editLine items in an Dave Lyons SFPxxx template would work. ga M Wolfgram Thanks... that's why they pay you the big bucks! AFC SteveB Does anyone know any good examples for writing to the 80 column text AFC SteveB firmware directly? I'd love to use the console driver, but since AFC SteveB I'm writing a CDA, I can't be sure that GSOS is present. GA Barnabas Not writing to the FIRMWARE, as such, but... Barnabas I've got some really extremely nice, fast routines that go to the HARDWARE... AFC SteveB Ack, Hardware. AFC SteveB (Sorry.) Barnabas Well, but the routines are all written already... AFC SteveB I guess I'm facing the same problem NiftyList used to. AFL GaryJ (I can't think of any examples like that in our library) Sheppy What exactly is the problem? The firmware isn't too difficult to use, just Sheppy call COut and whatnot. I guess what I mean is that I don't understand what Sheppy the problem is. Use FWEntry, maybe? AFC SteveB I've referred to the Hardware reference, but then quickly shut it in AFC SteveB fear I might lose my sanity (if I haven't already :) AFC SteveB I'm just trying to get the fastest text screen output possible AFC SteveB that would be cool in both P8 and GSOS. Barnabas As a CDA, you could probably use the Text Tools safely (although they aren't Barnabas recommended anymore). But if you want the fastest, I've got it! AFC SteveB Text tools! Noooooo :) AFL Marty What's so terrible about text tools? Sheppy (oh, nothing...) AFC SteveB (Nothing, 'cept that there are better/faster ways of doin' what they do, Mart.) Sheppy Marty: they aren't Slot Arbiter compatible, for one thing. Also, they're Sheppy slow. Sheppy (correction: not _fully_ Slot Arbiter compatible) Apple says no. Is that Sheppy good enough? :) AFC SteveB Dave-- How did you solve the problem- writing straight to the hardware? Sheppy It's not really as tough as it looks, Steve. Even _I_ can do it! :) Matt DTS (And yes, Nifty List writes directly to the display screen in banks $E0/$E1.) Later! Matt DTS (except when it needs to redirect to another slot) AFL GaryJ It's not too difficult to do your own display routines. AFL GaryJ There is lots of old code available that shows the concepts on how to do it. Sheppy Steve: It's probably the best thing to do. I wrote my own display routines Sheppy (nothing like Greg's) in a few hours. Sheppy (that's from scratch using the Hardware Ref) AFL GaryJ (Like the old monitor ROM listings that were in the old Apple II Reference, IIe reference, or AFL GaryJ IIc reference) AFC SteveB The stuff they give in the Hardware reference is a little confusing. Dave Lyons Sorry, was downloading a file. Yes, Nifty List writes directly to screen memory (in $00/$01, Dave Lyons I think). Sheppy The hardware ref. info does take some getting used to, but it's actually Sheppy told quite clearly. The _information_ is a little strange, that's all. :) AFL GaryJ If you can get a hold of one of the old technical reference manuals, they list all AFL GaryJ the monitor ROM firmware. It comes in very handy in learning how to do those kinds of AFL GaryJ things. AFA Jay I have a ][+ Reference manual, but that was before 80-columns :) Barnabas Everybody's code that I've looked at on the GS seems to use the old Apple II/ Barnabas Monitor ROM method of doing 80Store and Page1/Page2 swapping (Dave probably Barnabas remembers a bug report for the Exerciser DA involving that). But there is a Barnabas better way on the GS. It is far easier to do the 80-column text interleaving Barnabas by using a long indirect addressing mode and setting the appropriate bank byte Barnabas ($00 or $01/$E0 or $E1) AFL GaryJ IIc Technical Reference manual is the best for that. You'll definitely see 80-column AFL GaryJ text firmware ROM listings in it. Toleth What is Alternate Display Mode and what is it used for ? Sheppy On the IIGS, the text page 2 isn't automatically shadowed so that it can Sheppy be seen onscreen. The Alternate Display Mode CDA sets up a heartbeat task Sheppy so that every some number of ticks, the text page 2 screen is updated manually Sheppy so you can see it. GA AFC SteveB (On the ROM 01 IIgs) Barnabas On a ROM 03, the shadowing for Textpage 2 is handled by the hardware. Sheppy Toleth, only turn it on if you've got a screen full of "2"s showing up. Sheppy That's a good sign that you need it. :)