TweetFollow Us on Twitter

Mar 95 Tips
Volume Number:11
Issue Number:3
Column Tag:Tips & Tidbits

Tips & Tidbits

By Scott T Boyd, Editor

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

TIP OF THE MONTH

Set Breakpoints In ROM

About a year ago I wrote a little control panel called AV Turbo ROM. What it does is set an undocumented bit in PRAM that the ROMs of Power Macs and AV class machines (840AV and 660AV) check upon restart. If the bit is set, the ROM is copied down into RAM.

While this may or may not speed up things a little (I’ve listened to several people debate this issue), that’s not why I wrote it. I wrote it because now that the ROM code is in RAM, I can set breakpoints in “ROM” code. This is very handy when debugging or for those times when you are wondering, “how does that work?”

There are a few gotchas to be aware of:

1) Now that the ROM is in RAM, RAM Doubler from Connectix and The Debugger from Jasik Designs won’t work because they expect the ROM code to be where it’s supposed to be. Sorry about that, but remember that AV Turbo ROM is simply a tool to be used in special circumstances, and it’s quite reasonable to expect system products of their nature to make certain assumptions about the ROM.

2) Restarting on a PowerMac sometimes doesn’t work. Here’s the workaround - just hit the reset button again; it usually works the second time.

3) Since the ROM can be written to now, errant code could trash things. It’s too bad that The Debugger can’t help out with it’s memory protection technology, but sometimes it’s worth making the tradeoff.

I’ve been running this for a year and haven’t had any problems, just lots of fun walking through the ROMs. AV Turbo ROM is available on most online services. Here’s one place to get it:

ftp://freebsd.cdrom.com:/.13/mac/umich/system.extensions/cdev/avturborom1.0.cpt.hqx

Another Quick Tip

Do you use TMON Pro? Do you know about trap record? If not, find out. It’s a very useful debugging tool if you are debugging code other than your own.

- Steve Kiene, mindvision@mindvision.com

Copy Bits Quicker

If you are using custom color palettes in combination with lots of calls to CopyBits, you can speed up your graphics routines by making sure that the ctSeed of both the source and destination PixMap’s color tables are the same.

If the ctSeed values are different, QuickDraw will map each color in the source color table to colors in the destination color table, slowing down the CopyBits operation. If the ctSeed values are the same, QuickDraw will assume that both PixMaps use the same color table, and it will simply copy the bits directly. This has the disadvantage that if the palettes are completely different, you will end up with the wrong colors in the destination.

- Jeremy Vineyard, jeremyv@farallon.com

Hey, Finder, Pay Attention!

I have run into several things which change a file’s creator, but the finder doesn’t update the file’s icon right away. The user often has to close and reopen the Finder window to get the proper icons to appear. If your application needs to fiddle with a file’s creator type or other attributes, you can solve the above problem by changing the ioDrMdDat field of your file’s parent directory. This “tricks” the Finder into updating the window.

void ForceFinderToUpdateFileIcon(
 FSSpecPtr theFile) 
{
CInfoPBRectempPB;

if(theFile != 0L)
 {
 tempPB.dirInfo.ioNamePtr = 0L;
 tempPB.dirInfo.ioVRefNum=theFile->vRefNum;
 tempPB.dirInfo.ioFDirIndex = -1;
 tempPB.dirInfo.ioDrDirID = theFile->parID;

 if(PBGetCatInfoSync(&tempPB) == noErr) 
 {
 tempPB.dirInfo.ioDrMdDat = LMGetTime();
 tempPB.dirInfo.ioDrDirID = theFile->parID;
 PBSetCatInfoSync(&tempPB);
 }
 } 
}

- Craig Marciniak
TemplarDev@aol.com

Hot Tip for Hot Keys

One of the things I appreciate in applications is the ability to select buttons with keystrokes (the keyboard shortcut is known as a hotkey). The following code example adds hotkey functionality to alert dialogs and can be easily added to modal dialogs. The next time you use an alert, add AlertKeyProc to the function and you will have instant hotkey functionality. Simply change

 CautionAlert(ALERT_ID, NIL) 

to

 CautionAlert(SAVE_ALERT_ID, AlertKeyProc)
 
#include <Dialogs.h>
#define kEnterKey               3
#define kReturnKey              13
#define kEscapeKey              27

pascal Boolean AlertKeyProc(DialogPtr theDialog, 
  EventRecord *e, short *itemHit)
{
   char         theChar;
   short        num, i, iType;
   Handle       iHandle;
   Rect         iRect;
   Str255       iText;
   long         finalTicks;
 
   switch( e->what )
   {
      case keyDown:
      case autoKey:
         theChar = (e->message & charCodeMask);
         if(theChar == kReturnKey || theChar == kEnterKey)
         {
            *itemHit = 1;
            return( TRUE );
         }
         else if(theChar == kEscapeKey)
         {
            *itemHit = 2;
            return( TRUE );
         }
         else
         {
            num = CountDITL( theDialog );
            for(i=0; i<num; i++)
            {
               GetDItem(theDialog, i, &iType, &iHandle, &iRect);
               if(iType == ctrlItem + btnCtrl)
               {// If the button is a push button
                  GetCTitle((ControlHandle )iHandle, iText);
                  if(theChar == iText[1] || 
                     theChar == tolower(iText[1]))
                  {
                     *itemHit = i;
                     HiliteControl((ControlHandle )iHandle, 1);
                     return( TRUE );
                  }
               }
            }
         }
         break;
   }
   return( FALSE );
}

- Jeff Beeghly, jbeeghly@u.washington.edu

 
AAPL
$111.78
Apple Inc.
-0.87
MSFT
$47.66
Microsoft Corpora
+0.14
GOOG
$516.35
Google Inc.
+5.25

MacTech Search:
Community Search:

Software Updates via MacUpdate

NeoOffice 2014.6 - Mac-tailored, OpenOff...
NeoOffice is a complete office suite for OS X. With NeoOffice, users can view, edit, and save OpenOffice documents, PDF files, and most Microsoft Word, Excel, and PowerPoint documents. NeoOffice 3.x... Read more
LibreOffice 4.3.5.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
CleanApp 5.0.0 Beta 5 - Application dein...
CleanApp is an application deinstaller and archiver.... Your hard drive gets fuller day by day, but do you know why? CleanApp 5 provides you with insights how to reclaim disk space. There are... Read more
Monolingual 1.6.2 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
NetShade 6.1 - Browse privately using an...
NetShade is an Internet security tool that conceals your IP address on the web. NetShade routes your Web connection through either a public anonymous proxy server, or one of NetShade's own dedicated... Read more
calibre 2.13 - Complete e-library manage...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Mellel 3.3.7 - Powerful word processor w...
Mellel is the leading word processor for OS X and has been widely considered the industry standard since its inception. Mellel focuses on writers and scholars for technical writing and multilingual... Read more
ScreenFlow 5.0.1 - Create screen recordi...
Save 10% with the exclusive MacUpdate coupon code: AFMacUpdate10 Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your... Read more
Simon 4.0 - Monitor changes and crashes...
Simon monitors websites and alerts you of crashes and changes. Select pages to monitor, choose your alert options, and customize your settings. Simon does the rest. Keep a watchful eye on your... Read more
BBEdit 11.0.2 - Powerful text and HTML e...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more

Latest Forum Discussions

See All

Galaxy Trucker Pocket (Games)
Galaxy Trucker Pocket 1.0.8 Device: iOS iPhone Category: Games Price: $2.99, Version: 1.0.8 (iTunes) Description: Galaxy Truckers Wanted!================================================================= (5/5) "Galaxy Trucker isn’t... | Read more »
Make your own Tribez Figures (and More)...
Make your own Tribez Figures (and More) with Toyze Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
So Many Holiday iOS Sales Oh My Goodness...
The holiday season is in full-swing, which means a whole lot of iOS apps and games are going on sale. A bunch already have, in fact. Naturally this means we’re putting together a hand-picked list of the best discounts and sales we can find in order... | Read more »
It’s Bird vs. Bird in the New PvP Mode f...
It’s Bird vs. Bird in the New PvP Mode for Angry Birds Epic Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Telltale Games and Mojang Announce Minec...
Telltale Games and Mojang Announce Minecraft: Story Mode – A Telltale Games Series Posted by Jessica Fisher on December 19th, 2014 [ permalink ] | Read more »
WarChest and Splash Damage Annouce Their...
WarChest and Splash Damage Annouce Their New Game: Tempo Posted by Jessica Fisher on December 19th, 2014 [ permalink ] WarChest Ltd and Splash Damage Ltd are teaming up again to work | Read more »
BulkyPix Celebrates its 6th Anniversary...
BulkyPix Celebrates its 6th Anniversary with a Bunch of Free Games Posted by Jessica Fisher on December 19th, 2014 [ permalink ] BulkyPix has | Read more »
Indulge in Japanese cuisine in Cooking F...
Indulge in Japanese cuisine in Cooking Fever’s new sushi-themed update Posted by Simon Reed on December 19th, 2014 [ permalink ] Lithuanian developer Nordcurrent has yet again updated its restaurant simulat | Read more »
Badland Daydream Level Pack Arrives to C...
Badland Daydream Level Pack Arrives to Celebrate 20 Million Downloads Posted by Ellis Spice on December 19th, 2014 [ permalink ] | Read more »
Far Cry 4, Assassin’s Creed Unity, Desti...
Far Cry 4, Assassin’s Creed Unity, Destiny, and Beyond – AppSpy Takes a Look at AAA Companion Apps Posted by Rob Rich on December 19th, 2014 [ permalink ] These day | Read more »

Price Scanner via MacPrices.net

Holiday sale: 13-inch 128GB MacBook Air for $...
 Best Buy has the 2014 13-inch 1.4GHz 128GB MacBook Air on sale for $849.99, or $150 off MSRP, on their online store. Choose free home shipping or free local store pickup (if available). Price valid... Read more
13-inch 2.6GHz Retina MacBook Pro on sale for...
Best Buy has lowered their price on the 2014 13″ 2.6GHz/128GB Retina MacBook Pro to $1149.99 on their online store for a limited time. That’s $150 off MSRP and the lowest price available for this... Read more
Kodak Returns to CES With New Consumer Produ...
Former photography colossus Kodak is returning to CES for the first time in three years where the Kodak booth (#21818 South Hall 1) will showcase a wide range of innovative, imaging-related products... Read more
Invaluable Launches New Eponymously -Named A...
Invaluable, the world’s largest online live auction marketplace, hhas announced the official launch of the Invaluable app for iPad, now available for download in the iTunes App Store. Invaluable... Read more
IDC Reveals Worldwide Mobile Enterprise Appli...
International Data Corporation (IDC) last week hosted the IDC FutureScape: Worldwide Mobile Enterprise Applications and Solutions 2015 Predictions Web conference. The session provided organizations... Read more
Hello Vino Wine App Launches “Safe Ride Home”...
Hello Vino has announced addition of a new “Get a Safe Ride Home” feature in its Food & Drink app with a direct connection to Uber, the technology platform that connects users with rides. The... Read more
DEVON-technologies Releases DEVONthink To Go...
Coeur d’Alene, Idaho based DEVON-technologies, LLC has updated DEVONthink To Go, its mobile companion to DEVONthink, to version 1.5. The update includes an iOS 8 extension, compatibility with the... Read more
The Apple Store offering free next-day shippi...
The Apple Store is now offering free next-day shipping on all in stock items if ordered before 12/23/14 at 10:00am PT. Local store pickup is also available within an hour of ordering for any in stock... Read more
It’s 1992 Again At Sony Pictures, Except For...
Techcrunch’s John Biggs interviewed a Sony Pictures Entertainment (SPE) employee, who quite understandably wished to remain anonymous, regarding post-hack conditions in SPE’s L.A office, explaining “... Read more
OtterBox Defender Series Case For iPad mini 3...
With their innovative Touch ID technology and ultrathin profile, the latest tranche of Apple iPads are more desirable than ever, and OtterBox has just announced the Defender Series custom-engineered... Read more

Jobs Board

*Apple* Store Leader Program (US) - Apple, I...
…Summary Learn and grow as you explore the art of leadership at the Apple Store. You'll master our retail business inside and out through training, hands-on experience, Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.