Mar 90 Mousehole
Volume Number: | | 6
|
Issue Number: | | 3
|
Column Tag: | | Mousehole Report
|
System 7.0 and Memory
By Larry Nedry, Contributing Editor
From: Sysop
Re: finding source code to articles
The monthly sources from MacTutor are now available in the File Library. Each file is a Stuffit file containing all of the sources for a given article. There is a $5.00 charge for each file downloaded.
From: Walrus
Re: Think C and System 7.0 and...
Maybe some of the Symantec folks can answer this. System 7.0 is due to require 2 megs. Think C 4.0 with Debugger requires 2 megs. When the new system comes out, how much will I need to run C, 4 megs? Could I squeak by with 3?
On a related subject, how difficult is it to self-install SIMMs in a Mac SE? What if youre strong suit is NOT hardware? Since Im in Silicon Valley I do suppose I can find dealers to do this, but I might be interested in doing it myself. Any horror stories out there about memory expansion?
From: Btoback
Re: Think C and System 7.0 and...
Ive installed SIMMs and Radius expansion cards into my SE, as well as changing the disc drive. The hardest part is removing the back. The second hardest part is getting all the cables plugged back into the motherboard without removing most of the skin on your knuckles. The third hardest part is waiting for the self-test to complete after you put the system back together - especially since the self-test takes longer after you put more memory in!
There are some locking connectors on cables that need special care, as does the connector on the back of the CRT. The only thing you may need to force is the back: if you force anything else, youre about to break it. In short, you dont have to be a hardware expert, but some mechanical intuition helps. If you dont know about proper static precautions, ask someone first. And youll get a good look at one the most compact and clever packaging jobs around.
From: Siegel
Re: Think C and System 7.0 and...
THINK C will probably work on a minimal System 7.0 configuration, but itll be sort of like running it on a 1MB system is now; you wont be able to write or debug really huge programs. You cant have 3MB in your system; the hardware architecture doesnt allow for that.
From: Noisy
Re: Think C and System 7.0 and...
Cant help you with the 2-3-4 megs question, but I will pass on a fable about a software developer who decided that the hardware jocks were overpaid, and he could put SIMMs in his Mac+ all by himself, thank you very much. Theyre not overpaid...I destroyed a rack of SIMM pins on the motherboard and ended up paying for a new motherboard...just to save a $25 installation fee. Let an expert do it - theyve got to eat too.
From: Walrus
Re: Thanks for the Memory (advice)
I know, thats a bad pun, but what could I do?
Many thanks to the people that responded to my memory/Think C/System 7.0 question. I now have a Mac SE with 2.5 megs (I got the old .5 chip cards for old times sake) and it is wonderful. By the way, I did not do it myself. I have been busily learning the Toolbox AND the C language at the same time (I know Pascal, but C is the current wave) and not having a source level debugger to lean on is toooooo much (MS-DOS C neophytes can use printf statements, the most common debugging tool. That method is not so simple for the Mac programmer (yeah, maybe open another window, but that aint so easy at the beginner level). So, if you are a Mac C beginner, USE A DEBUGGER! I stepped thru a problem I was having in a program, and it was like my IQ went up by about 20 points. Even if $$$ is holding you back, get it anyway, you will save hours and hours of your time, and your progress will go much faster. (A method of using Think C and the Debugger in 1 meg that was posted was tried, but I just couldnt get it to go.)
From: Matt
Re: Well, Ive got these SIMMs...
I just bought 2 1meg SIMMs (Microtech International, $75 each). But now what? When I try to install them I run into MAJOR problems. If I put one of them in SIMM slot 1, my Mac doesnt find the other 75meg! If I put both of them in (slots 1&2), with or without the .5meg in the front slots, the system wont start up - it gives me a sad-Mac and 0000 00003 0000 FFFF !?*@#! What do I do?
From: Matt
Re: And Ive got these other SIMMs.....
Well, now that Im installing 2meg in my SE, I have 2 1mBit SIMMs. Is there any market for them? Should I just throw them in a closet? How much are they worth?
From: Apage
Re: Well, Ive got these SIMMs...
First of which flavor of Mac are we talking about? Mac II, Mac Plus, Mac SE, or SE/30? This makes a big difference. For Mac IIs, there is a certain order that the SIMMS must go in, I think that it is the largest SIMMs goes in the first bank, and you must install them in sets of 4. For pluses and SEs (not the SE/30) you can install in sets of two, but there is also a resistor that must be moved from one location to another. I do not have my hardware reference manual from Addison Wesley, and a good idea if you see yourself doing a lot of this) my slime ball best friend borrowed it and has yet to return it. Otherwise I could tell you how these devices should be set. Good Luck. Let me know how it turns out.
From: Matt
Re: Well, Ive got these SIMMs...
Hm... Addison-Wesley... In fact Inside Mac V has a chapter on SIMMs in SEs and IIs, which details exactly which resistor must be removed (Labeled 256k Bit in the RAM Size area of the SE motherboard). Thatll teach me to read the manuals before asking dumb questions.
From: Guido
Re: VBL/Sound
Help!!! Im am currently writing my own sound routines (because Apples have just a little too much overhead for me!!!) and am coming across a little problem with my VBL task (I believe). My sound routines simply take a sampled sound and play it back. My VBL task simply takes 370 bytes from my buffer and crams them into the sound buffer. When I reach the end of my buffer, I fill the rest of the buffer with 0x80. This seems to work EXCEPT for a little noise. My sample plays back, but I get a little static along with it. Some things I AM doing: getting the address of the sound buffer and the VIA chip from low-memory globals, start my VBL with a SetUpA5() and end with a RestoreA5(). Some things I am NOT doing: doing ANY trap calls, calling SysBeep or anything like that. If you have any ideas, please let me know. THANKS!!!!!!
From: Guido
Re: Sound/VBL
I am writing my own sound routines to playback samples and Im running into a small snag... It seems that if I call GetNextEvent while my sound is playing, I get a little static (noise) along with my sound. If I dont call GetNextEvent, the sound plays back perfectly. I guess GetNextEvent is also doing something I dont know about and messing up my vbl task. Anyone have any comments?
From: Macdts
Re: Sound/VBL
This not a good idea. It would be incompatible with System 7.0 and will cause the current Sound Manager to fail. Also, consider that _SysBeep is a Sound Manager call. If you need help playing samples with the Sound Manager, Im the expert. Playing sounds in a VBL is also warned against in Tech Note #19.
From: Guido
Re: Sound/VBL
Thanks for your reply. What I didnt say is that Im writing these routines for an arcade-style game, and want them to be as FAST and efficient (not general-purpose) as possible. From what I can tell, many others are doing the same thing Im trying to do (eg. Crystal Quest, SoundEdit, etc.) If you know whats causing the problem, PLEASE HELP!!! If not, please upload an example of SoundMgr calls to playback samples FAST. Thanks...
From: Macdts
Re: Sound/VBL
If you show me some code or describe the problem I could help. Im nearly finished with a sample application that demonstrates the Sound Manager. Ill upload it when it done.
The fastest way to have a sound channel allocated and use the bufferCmd. You also need System 6.0.2 or later. In fact 6.0.4 contains an optimized Sound Manager and it wont get any faster.
From: Guido
Re: Sound/VBL
Thanks for your reply. Ive uploaded my sound routines for your viewing pleasure(?!?!). As you will see, they are very quick and dirty. (But, thats what they have to be for an arcade game) The way they are used is: SND_get() read in a snd type 1 resource. SND_open() then installs my vbl task and turns on sound in the VIA chip. SND_play then sets up some variables for the vbl task to playback. SND_close() closes everything. This all plays back just fine UNLESS I call GetNextEvent() while the sound is playing. Then I get some extra pops and crackles. What could GetNextEvent be doing to mess up my vbl task? SoundEdit (from Farallon Computing, MacRecorder) seems to be using routines similar to mine, but without the extra noise. Thanks again for the help.
From: Rhoglund
Re: Hiding the menu bar
I am currently writing an application that has a modeless dialog box as its primary window. Since I have no menu items, I would like to be able to turn of the menu bar. Is there a call I can make to accomplish this task, such as HideMenuBar, or do I need to perform some Quickdraw magic?
From: Macdts
Re: Hiding the menu bar
This is not a good idea. The user interface states the menu bar must always be available. There are only a couple reasons to hide it. One would be a slide show/presentation application. An application that does not use the menu bar should NOT hide it from the user. Doing so confuses the user, and it presents a number of technical difficulties.
Under MultiFinder the menu bar is in use. MultiFinder owns the Apple menu. It is used to switch to other applications. It also contains the switch icon in the upper right corner.
The Notification Manager uses the menu. Applications in the background that need to notify the user, such as the Print Monitor, use the Apple menu to do so.
System 7.0 uses the menu at all times.
Finally, there was an article in Apple Direct that stated the Human Interface problems of hiding the menu bar. This is the official Apple position. Dont hide the menu bar unless you need the full screen.
From: Nicks
Re: How do you hide the Menu Bar?
So just how does Hypercard and other programs hide the menu bar? I know that I could obliterate it by just drawing over the screen memory for it, but as soon as I call Get/WaitNextEvent and the user clicks in a menu, the menu item will be drawn and mess up the screen. Do I have to patch the Event Mgr? or is there some obvious thing that Im missing here?
From: Spud
Re: How do you hide the Menu Bar?
Hmmmm, I think Bill Atkinson and the gang play around with a low-memory global that controls the menu bar height. My guess is that they set it to zero and *poof*, the menubar is gone.
From: Turing
Re: How do you hide the Menu Bar?
Get a GrafPort directly through the OpenPort call (rather than through the Window Manager calls). The visRgn of that port will be set to the entire screen, rather than just the grayRgn.
From: Rsimmons
Re: Menu Snapshots
In the August, 1986 issue of MacTutor there was a assembly language article on how to restore the ability to take Macintosh screen shots that include pulled down menus (Macpaint image files of the screen) that was lost in the Mac-OS system version long ago. I understand from later reading that the patch is not recommended. Can anyone help me out with a way to capture screen shots with a menu pulled down? Where do I get it and how soon can I get it?
From: Jesse
Re: Menu Snapshots
Ive got an Init that allows snap shots to take place with a menu down. It works fine on my Mac+ with System 6.03, Ill go ahead and post it.
From: Tomt
Re: Menu Snapshots
If youre interested in a commercial product that can capture screens with menus down I know that Exposure from Preffered Publishing does. I think several others do as well.
From: Gigabit
Re: Print Orientation
I would like to change the default page orientation of my app at startup to be landscape instead of portrait. An example application that does this is MacProject.
From: Aggie
Re: Print Orientation
Fiddling with the editor in LSP I discovered a way of doing this that seems to work. You essentially change the page orientation within the hPrint after it is set in the default mode. The code excerpt for this is as follows:
hPrint := THPrint(NewHandle(SIZEOF(printRec)));{allocate Print Record}
PrintDefault(hPrint);{stuff default values in Print Record}
HLock(handle(hPrint));
r := hPrint^^.rPaper;
setRect(hPrint^^.rPaper, r.top, r.left, r.bottom, r.right); {set
for
landscape mode}
hPrint^^.PrStl.wDev := 837;
HUnLock(handle(hPrint));
if PrStlDialog(hPrint) and prError = noErr then
etc...
r is of course defined as a rect. The hPrint^^.PrStl.wDev :=837; I stumbled upon in the editor and could not find any documentation to support this, but it does seem to work. How robust this is I cannot guarantee, however, I have not had a problem with it.
From: Turing
Re: memory manager
Normally we cannot access the heap, directly or indirectly, in the interrupt time. But if I setup a separate heap for an interrupt-time routine. On the entrance of that routine I will set the current heap to that dedicated heap and set A5 to the proper address, and on the exit I will restore the current help and A5 to the original value. Now can I use the Memory Manager to access the blocks in that heap at the interrupt time? Can I use the Resource Manager, QuickDraw, and other Toolbox routines that touch to the heap at the interrupt time now?
From: Macdts
Re: memory manager
Normally we cannot access the heap, directly or indirectly, in the interrupt time. No. You have access to the heap. You can allocate a block of memory, lock it down, and then use is at interrupt time. What you cannot do is call any routine that will move or purge memory. Also, you cannot call a routine that accesses a low memory global. That list is very large and covers most of the toolbox. This does mean that you cannot use the Memory Manager, Resource Manager, Quickdraw, etc.
From: Turing
Re: memory manager
I know I have access to the locked blocks at the interrupt time. But I want to know whether I have access to the UNLOCKED blocks at the interrupt time if I setup a dedicate heap for an interrupt driven routine and touch that heap only in that routine, either directly or indirectly through other Toolbox calls.
From: Turing
Re: memory
I know I have access to the locked block at the interrupt time. What I asked is: Can I dedicate a separate heap to my interrupt routine, then have access to the UNLOCKED blocks in that heap at the interrupt time? For example, can I use the QuickDraw routines (OpenPicture, etc.) to record a picture into that dedicated heap at the interrupt time?
From: Macdts
Re: memory
The answer still is no. You cannot call any routine that moves or purges memory, or accesses a low memory global while at interrupt time. Another problem is that you should not be performing time consuming processes at interrupt time. Recording a picture is a time consuming process. This causes problems by holding off other interrupts too long.
From: Aggie
Re: MacTutor Help
I have just downloaded the Mactutor Help source from the Jan. issue. I am using LSP 2.03 and cannot get this help utility to work in my program. I am using the HELP code resource method as described in the documentation. I get the message InitGraf needs @thePort as its parameter at the statement Call_code(h^);.HELP! I have no idea what to do since I have a feeling that it is referring to the InitGraf statement inside the HELP code resource. Any enlightenment would be appreciated.
From: Tomc
Re: Mac II ci
MacsBug 6.1 works fine on IIcis. SADE works when you get MultiFinder 6.1b9 from APDA.
Tom Chavez
MacsBug and ResEdit Product Manager
Development Tools Product Marketing
From: Dstamey
Re: LSP limitations
I have been programming with the object-oriented extensions of LSP for six months now and have not found the source file size limitation to be problem yet. Typically I put the parent object in one unit by itself and each time I subclass it, I put the subclass in its own unit. In this manner, my source files never get too large (Im sure youve noticed how the editor slows down as the file size increases, so I try to keep them medium sized). As for the 32K segment size limit, theres not much you can do about that for now. You probably have already encountered the bug (really a design problem) with the method dispatcher. If a method belongs to a segment that is not currently loaded the method dispatcher does NOT call LoadSeg to load it, and you get an error. Thinks tech support has given me the impression that this will be fixed in the next release. Fortunately my objects are designed so that this has been only a minor inconvenience.
From: Jhannah
Re: C books
I dont suppose the book Programming C on the Macintosh by Terry A. Ward, (Scott, Foresman & Co.) has been mentioned yet... this is a great book that compares some of the prominent C compilers and also has the complete C source code of the first version of the game Megaroids.
I have this and the Cummings & Pollack book, and I am borrowing the Kernighan & Ritchie book from work... I am still searching for the Huxham-Burnard-Takatsuka book.
From: Jhannah
Re: C books
Woops, I forgot to mention what the Kernighan & Ritchie book WAS! They co-wrote the book The C Programming Language (Prentice Hall)... this is THE book of C in general, and is now in its 2nd version (the new C approved by the American National Standards Institute)
From: Thehulk
Re: C books
I think the Wards book really doesnt cover much of anything in the way of C or Mac programming. Even though there is an excellent source listing for Megaroids, it is outdated for the new Macs and nobody uses the MegaMax compiler any more. The Megaroid source code listing is full of code that is used for handling alternate screen buffers and assembly code for glue (and speed). Try porting this code to MPW or THINK C for fun on a Mac II...
From: Gigabit
Re: Object Pascal vs LSC
Break out the VISA and buy MacApp/MPW. Its expensive and a difficult development system to learn, especially for the novice of which Im one, but the depth of the class libraries are well worth it. I have reviewed LSPC class libraries, and they are not nearly as complete as MacApp. As a beginning programmer you need all the help you can get
From: Bryce
Re: TExtendedText?
Spud, I know its been a while since you left the message on TExtendedText, but I just saw it. Anyway, the class was defined in a FrameWorks article back in late 88. The problem with that implementation was that any view resource incorporating a TExtendedText view had to be DeRezed -- assuming that the view was created by ViewEdit -- so that a few new fields such as precision could be added to a standard TNumberText view. This method of changing TnumberText to TExtendedText made the view no longer editable in ViewEdit...not desirable. Since the enhancements gained by implementing the TExtendedText view were pretty minor, I still just handle and convert plain old TEditText to and from extended numbers on the fly. Maybe someday Apple will add TExtendedText to MacApp, but for now...
From: Teisen
Re: TCL list manager class
Being a vanilla UNIX programmer professionally, I was hesitant to jump into THINKs TCL on my home machine. Ive just now taken the plunge and all I can say is WOW! If I come across a LM Class, Ill upload it for you (I could sure use one myself and, frankly, am surprised that one was not included!)
From: Unclejim
Re: Disk Based Scrolling
Yes I would be interested in your Big TEdit. However the problem Ive had with some other things I thought I would buy is I really dont need a complete word processor. I dont mind getting more than I need but it usually becomes quite problematic to turn things off etc. I certainly understand not giving away your source. if I could simply find something object or source doesnt matter that I could pass a file ID or whatever and have it manage scrolling and possibly cut/copy/paste that would be great. many months later I still have nothing. Word processors are not my are. Yes I am interested in anything that might help. I have CAPPs LSP from a long time ago but the scrolling (PEScroll) etc are all apart of interface libs and inaccessible. Thanks for responding you have been the only one who did in 3 months. Happy new year and good luck on your project.