home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-22 | 15.9 KB | 317 lines | [TEXT/R*ch] |
- sAVe the Disk 1.4
- -----------------
-
- Overview
-
- sAVe the Disk 1.4 is a FreeWare system extension (aka INIT) which will
- alleviate the excessive disk drive hits experienced by owners of AV Macs
- in the following circumstances:
-
- 1) Several Resource Manager operations flush the whole file to disk each
- time the length of a resource file is changed. This significantly degrades
- performance if many such changes occur in succession, e.g. while linking
- programs, using ResEdit or running resource compilers.
-
- 2) The disk cache built into the system writes back more data than necessary
- when flushed. This does not affect proper operation of the disk cache (nor
- does it help it :^) but results in superfluous disk activity and thus a slow
- down of file operations.
-
- 3) Each time a sound channel is allocated (disposed) some information is read
- from (written to) the file DSP Preferences. Applications which follow Apple's
- recommendations create and destroy such a channel for each single sound they
- produce and thus slow down while they torture your harddisk. This problem
- becomes most obvious with games.
-
- Note that the extension AV Speedup 1.0 (developed by Matt Gough and Brian Stroud)
- addresses only the first set of problems. AV Resource Manager Tuner and AV Cache
- Tuner (by Steve Kiene, MindVision Software) improve the Resource Manager and the
- disk cache respectively. Their functionality has been integrated into sAVe the
- Disk, which adds a solution for the sound related disk trashing, too.
-
- Version 1.2 of the System Enabler 088 does also fix the Resource Manager as well
- as the disk cache problems. However sAVe the Disk 1.4 will still improve the
- performance of the Sound Manager in this configuration.
-
-
- Installation
-
- Simply drop the sAVe the Disk extension onto the icon of the closed system
- folder and let the Finder place it in the Extensions folder. Then restart your
- machine. sAVe the Disk 1.4 will load and display its icon while it installs
- itself during start-up.
-
- You should also remove your other AV Mac tuning extensions like
- AV Resource Manager, AV Cache Tuner or AV Speedup: sAVe the Disk 1.4 replaces
- them all. Leaving them active will cause no harm (but no additional benefits
- either), it will only become difficult to tell which extension finally remains
- operative.
-
-
- Does it work?
-
- The following is a simple way to test if sAVe the Disk is operating properly. In
- the Finder select Page Setup from the File menu and click _outside_ the dialog
- box several times. The system beep should sound for each click. However disk
- activity should only occur prior to the first beep when the actual sound data is
- read from its resource inside the system file. There should be no disk hits for
- the repeated sounds. Compare this with the ongoing disk accesses before you
- installed sAVe the Disk. Now you could enjoy one of your former favorite games
- without disk noise and without jerky delays degrading animation.
-
-
- If it doesn't work
-
- As sAVe the Disk uses less than 2k of system memory plus the size of your DSP
- Preferences file (usually less than 0.5k), there should always be sufficient
- memory available.
-
- Other possible problems include:
-
- - the ROM version is not 1917 (0x770), e.g. you are trying to install sAVe on a
- non-AV Mac. Don't do that, sAVe provides no benefits on non-AV Macs.
-
- - your DSP Preferences file is either corrupt or incompatible with the type of
- AV Mac (660/840) you are using and cannot be deleted. Unprotect or delete the
- file manually.
-
- - the file DSP Preferences uses a newer format which sAVe does not recognize.
- Since the format of this file is not documented (only the system calls to
- store/retrieve info) Apple is free to change it. There might be an updated
- version of sAVe available or you could trash the newer prefs file and let sAVe
- maintain the info in the older format. Try this at your own risk!
-
- No icon will be displayed during start-up and no changes to the system will be
- made, if any of the above problems prevents proper installation.
-
- I developed and tested sAVe the Disk on my Centris/Quadra 660av running System
- 7.1 and version 1.2 of the System Enabler 088, but it is known to work on a
- Quadra 840av, too. Some additional testing has been done older Enablers.
- Although it has not caused me any trouble I'm not responsible for any (unlikely)
- problems you may experience.
-
- Please note that sAVe the Disk does _not_ fix the problems with games which
- write to the (on the AV Macs nonexistent) Apple Sound Chip directly and
- therefore produce no sound at all. You should contact the publisher of such
- software and ask for a fix or update.
-
- Feel free to contact me at the address given below if you encounter any problems
- related to sAVe the Disk 1.4.
-
-
- Known Problems
-
- sAVe the Disk works differently than the original system code, if the size of
- the preference data associated with a given selector changes. This should cause
- no trouble however, because the original code simply corrupts the prefs file :^)
-
- If you experience problems with the Photoshop DSP plug-in, remember that all
- existing version of RamDoubler (latest version is 1.0.2) are incompatible with
- this plug-in. As far as I know sAVe the Disk does not cause the freezes.
-
-
- How does it work?
- (optional reading)
-
- 1) Resource Manager
-
- FlushFile is head-patched to ignore all calls from the Resource Manager. It
- checks its return address on the stack against the location of the FlushFile
- call inside the Resource Manager routines in ROM. As this won't work if
- somebody tail-patched FlushFile, the patch will also search through the chain
- of open resource files maintained by the Resource Manager and will keep all
- members from getting flushed. However a flag is set/cleared by a patch to
- UpdateResFile which will cause all FlushFile calls from inside UpdateResFile
- to be still performed. Thus UpdateResFile (and CloseResFile which calls
- UpdateResFile) still flush the file to disk to ensure data integrity in case
- of a system crash. The new patching scheme is simpler than that used by
- previous versions of sAVe and keeps additional Resource Manger calls
- (SetResInfo, SetResAttrs) from flushing the file to disk each time, resulting
- in a significant performance gain while basically keeping the same level of
- data security. As a side effect revert-type commands in ResEdit should work
- now (at least more often than before).
-
- 2) Disk Cache
-
- The FlushCache trap (0xA0C0) is augmented with an additional check, which
- keeps cached disk blocks from getting written back in situations where this
- is not necessary. I cannot say how this patch works. It was modelled after
- the code used in most other Macs which, apart from this additional test, is
- identical to the code used in the ROMs of the AV Macs. Part of the test is
- present even there, but the result of the test remains unused.
-
- The above two sets of patches are only applied if a version of the System
- Enabler 088 older than 1.2 is present, otherwise sAVe the Disk lets the Enabler
- fix these parts of the system.
-
- 3) DSP Preferences
-
- Two subfunctions of the DSPDispatch trap (ABF5) access the file DSP
- Preferences inside the Preferences folder and cause the sound related disk
- hits (selector 0x121 to read info, 0x5F to update the info). Both
- subfunctions are replaced by entirely new routines modelled after the
- originals. The contents of the DSP Preferences are read into a relocatable
- block inside the system heap during start-up. Accesses to preference data
- just read the info from memory, update it in memory or grow the block and
- append new information. A shutdown handler will finally update the file on
- disk (if any info was added/updated) before you restart or shutdown your
- Macintosh. This should cause no problems as the DSP Preferences file is small
- (usually less than 500 bytes) and the updated information records past DSP
- performance data as an estimate for future uses. Thus it is no real problem
- if a system crash should keep the data from getting written back. The
- estimates used will just be slightly less accurate as they result from older
- measurements.
-
- Another subfunction of the DSPDispatch trap is used to repeatedly read a
- resource of type 'dspf' from the System Enabler 088 and will DetachResource
- in order to return a non-resource handle to its caller. Thus the resource
- data is read from disk each time, still resulting in sound related disk
- trashing under the 1.0 Enabler. With the 1.1 Enabler the system's disk cache
- was usually able to prevent actual disk access. A head-patch to the
- DSPGetResource subfunction (0x124) will handle requests for resources of type
- 'dspf' and use HandToHand in order to copy the requested data into a new
- non-resource handle. The original resource handle is marked purgable so that
- its 4.5k can be reclaimed if the system runs out of memory (the resource will
- be reread from disk the next time it is accessed). For resource types other
- than 'dspf' and in case of any error the patch invokes the original ROM code.
- The ROM code seems to support an additional special resource file, which is
- examined if a request can't be satisfied by the currently open files.
- Although this feature appears to be currently unused, the fallback to the
- original routine should guarantee 100% compatibility.
-
- If you want to trash your DSP Preferences file because it has grown too large,
- proceed as follows: restart your Mac and put the file into the trash before any
- sound is produced (except the usual noise at start-up). Hold down the SHIFT-key
- during start-up to prevent other extensions from accessing the Sound Manager
- before the Finder has been started, if required. Restart your Mac again, when
- the file has been trashed. After the first sound has been played the data kept
- in memory is updated and will be completely rewritten at shutdown (or prior to
- a restart) even if you trashed the prefs file.
-
-
- The Original Note on 840AV Disk-Trashing
- (as distributed with AV Speedup 1.0)
-
- There are at least two serious disk-related bugs in the 840AV, which have been
- verified by DTS:
-
- 1) ChangedResource now flushes the resource's entire file out to disk. This is
- first noticeable during a System install, when the Installer will take several
- minutes to construct the System file. But it is most heinous during MPW Rez
- and Link. My project takes 5 to 10 times longer to build (than on an 800)
- because the entire file is written to disk hundreds or thousands of times in
- rapid succession as each resource is added to my app. Of course, this bug will
- make any program run slower if it adds, changes or deletes resources.
-
- 2) SndDisposeChannel will hit the disk for some retarded reason. Apple says
- the DSP chip is behind this. Every time a system beep is played, for example,
- you'll notice a couple of "ca-chunks" from your hard disk. This is especially
- harsh on sound-intensive applications (like games). Many games slow down to a
- jerky crawl because they typically call SndDisposeChannel after each sampled
- sound completes. The workaround is to leave a sound channel open and reuse
- it for each sampled sound until you quit or suspend your app.
-
- Apple DTS classifies these bugs as "goofinesses", and currently offers no plans
- to fix them.
-
- Todd Ouzts
-
- Author: DAYNA
-
-
- Many Thanks To
-
- Dave Schutz for the icon (taken from his Colossal Icons collection). Otherwise
- sAVe the Disk would have to go with the default icon for system extensions and
- would have no super hero to stand behind its noble aim.
-
- Kurt Wiley for the modified icons which add the conformant look of a system
- extension to sAVe the Disk.
-
- Matt Gough and Brian Stroud who brought the Resource Manager deficiencies to my
- attention and made me put my vague ideas about a solution to the sound problem
- into actual code. From their AV Speedup distribution I got to know that there
- was no point in waiting for a fix from DTS (see note above).
-
- Steve Kiene who suggested a simpler and more effective solution for the Resource
- Manager problems and inspired the addition of the disk cache fix. Check out his
- AV Turbo ROM control panel, if you want to see your AV Mac run faster than ever
- before (and you have 2 Megs of RAM to spare :-().
-
- Malcolm Slaney from the ATG Perception Group who made the source to the DSP
- related application VUMeter publicly available. The included headers shed some
- light onto the DSP trap interface and turned mysterious entities into
- comprehensible data structures.
-
- Patrick C. Beard who placed his ShowIconFamily code in the public domain. He
- made the successful installation of sAVe the Disk visible.
-
-
- Legal Stuff
-
- sAVe the Disk 1.4 is provided free of charge but remains copyright Michael
- Thies. It may not be sold for profit but may otherwise be distributed freely in
- unmodified form and complete with this unaltered documentation. It may be
- included with ShareWare or commercial products, if I have been informed of the
- intended bundling in advance and it is made clear that sAVe the Disk itself
- comes free of charge and does not form part of the actual product sold.
-
- sAVe the Disk 1.4 is provided in the hope that it will be useful but comes
- with _absolutely_ NO warranty.
-
- It was developed with THINK C 7.0 (free upgrade from 6.0.1) so parts of it may be
- Copyright Symantec Corporation.
-
- Several terms used above are trademarks of their respective holders.
-
-
- Version History
-
- 1.0 11/23/93 Initial Version
- 1.1 11/25/93 - fixed bug which could prevent access to prefs file
- - UpdateGPBPrefFile subfunction will read prefs file into
- memory, if GetGPBModes was never called before
- - Resource Manager patches are more robust. Even in case of
- errors no call to FlushFile should get accidently ignored.
- - Icon gets displayed during start-up if installation
- successful
- - fine-tuned code
- 1.1.1 12/04/93 - added compatibility with version 1.0 of the System Enabler
- (additional work will be needed to prevent ALL disk
- trashing with the 1.0 Enabler)
- - more work done at installation time => less resident code
- 1.2 12/05/93 - work around for 1.0 Enabler added: no more disk trashing
- - no reliance on systems's disk cache with any Enabler
- - resident code nearly back to old (v1.1) size :-(
- 1.2.1 12/07/93 - create copy of 'dspf' resource in heap zone where resource
- was loaded (application vs. system heap)
- 1.3 12/18/93 - prefs file read at start-up => less resident code
- - take full advantage of sys 7 file specs => even less code
- - simpler, better, faster Resource Manager patch
- - added disk cache patch
- - more reliable if new prefs settings are to be added while
- system heap cannot grow
- - improved icons
- 1.3.1 01/05/94 - tail-patches to FlushFile no longer disable Resource Manager
- patch (more reliable but slower secondary test added)
- - only FlushFile calls from inside UpdateResFile are honored
- (and calls from outside the Resource Manager)
- - sensible behaviour if size of prefs data associated with a
- given selector changes
- - stream-lined balloon help
- 1.3.2 02/15/94 - icon plotting during start-up takes advantage of sys 7 icon
- families
- - special debug mode added, rename extension to "sAVe %"
- 1.3.3 04/30/94 - disk cache patch works even if the relevant trap has already
- been patched by other extensions
- 1.4 05/22/94 - recognizes 1.2 Enabler and suppresses redundant patches
- - removed debug mode
-
- I am always interested in comments, suggestions and bug reports (sigh).
-
- -------------------------------------------------------
- Michael Thies (thiesana@uni-paderborn.de)
- Fachbereich Informatik
- Universitaet-Gesamthochschule Paderborn
- Germany
-