TweetFollow Us on Twitter

Screen Saver
Volume Number:5
Issue Number:10
Column Tag:Kelly's Corner

After Dark™ and S.P.A.M.M.

By Dave Kelly, MacTutor Editorial Board

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

A Versatile Screen Saver

Ever since the invention of the CDEV, I have been fascinated with all the ideas that have surfaced which may be accessed from the control panel. Control panel DEVices were introduced to us when System 4.1/Finder 5.5 was released. The control panel is a way to extend user control over system functions. Among my favorite CDEVs is the Pyro™ screen saver with displays fireworks or by clicking a button in the control panel, Pyro™ displays a clock. This is a lot more interesting than simply blanking out the screen. There are quite a few public domain screen saver programs around and a few are commercially available.

A new CDEV has recently been released by Berkeley Systems. After Dark™ is not just another screen save CDEV. After Dark™ picks up where Pyro™ left off. After Dark™ is unique because it allows you (the user) to select which graphics display you would like to see when the screen blanks out. Thirteen modules have been included with After Dark™ which vary from Lissajous to messages to time warps. So what? Well, the best thing about After Dark™ and the reason I’m recommending it here in MacTutor is that you (the programmer) can program your own modules for use with After Dark™.

Another feature of After Dark™ is that you may initiate “Anti-Snoop Sleep” which means that you may assign a password to After Dark™ which will prevent anyone from awakening the screen without first typing the password. This is especially good if you have children (or other co-workers some of whom may still be children) nearby when you are working and want to take a break without your work being disturbed. Like Pyro™, you can put the screen to sleep by moving the mouse to the corner which you specify.

Is there life After Dark?

You can think of After Dark as the shell of the screen saver. It provides the support to handle your unique graphics module. The graphics modules reside in a folder in the system folder named ‘After Dark Files’. The module you have selected in the control panel will be loaded into memory by After Dark when the user places the pointer in a chosen corner of the screen, or after a specified delay. You can develop your own graphics modules in any development system which allows generation of code resources. The After Dark disk contains two example graphics modules written in C and Pascal for the MPW and Lightspeed programming environments. One is a generic graphics module which may be used as a skeleton for your own module and the other shows some of the more advanced features available in After Dark.

The manual explains the programming process in detail. In fact, anyone with only a fair amount of Macintosh programming experience can use the Generic Module and turn it into an exciting graphics display. After Dark sends messages to the module which ask the module to do certain tasks. In particular, first After Dark sends an Initialize message which is the cue for the module to allocate a Handle to memory and assign it to the storage parameter. This block of memory is locked down for use by the module and unlocked when returning from the module to After Dark. When the Blank message is sent, the module should blank the screen if desired. Then subsequent calls to the module will send the DrawFrame message which will do the bulk of the graphics routine. Finally, the Close message is sent so that the module will dispose of any memory which has been allocated and free it up for use by other Macintosh programs. In addition, another procedure is used to setup parameters which the module will use.

The parameters passed to each procedure in the module contain information which can help you in determining what monitors are in use, if Color Quickdraw is available and other important information. The manual explains the structure of the parameters and how to use them. In addition, you may set up buttons, sliders, popup menus, check boxes, and text strings. Any combination of up to four of these controls may be defined in unique resource types which After Dark recognizes. When After Dark sees these resources in the module, the resource is used to draw the controls in the control panel window (when it is open). The id number of the control on the first line is 1000, the second is 1001, and so on for up to 4 lines. The resource name is displayed with the control to describe it; for example, the resource name of the check box resource which is type ‘xVal’ is the name that is used with the check box. For your convenience, After Dark includes a template file for ResEdit which supports the After Dark resources to make it easier to create them. You can even include your own ‘clut’ resource for enhancing color graphics.

I’ve included a sample module which I wrote created based on the generic module provided with After Dark. After Dark is fun! Programming After Dark is a good way to experiment with graphics designs you may have or just write a quick routine to amaze your friends. You do have to be programming aware as you acquire and dispose of memory or you could have some unexplained crashes. Several hints are provided in the manual which should help to make your module crash free.

By the way, the pricing of After Dark is reasonable too. The program lists for $39.95. It was available at MacWorld Expo and is available now. Jack Eastman wrote After Dark and many of the modules. Patrick Beard wrote much of the example code and several modules. Bruce Burkhalter wrote example code, the technical manual, and a couple of the modules.

After Dark™ is available from:

Berkeley Systems, Inc.

1700 Shattuck Avenue

Berkeley, California 94709

(415) 540-5535

Price: $39.95

NOT COPY PROTECTED!!

Introducing S.P.A.M.M.

Don’t you just love those acronyms? Ok, you ask, just what does S.P.A.M.M. stand for? S.P.A.M.M. (System Program for Accelerated Macintosh Mathematics) is an INIT that speeds up arithmetic operations on the Mac Plus and SE for most applications. I’m not going to say much about this INIT, but if you are wishing that you could speed up your Mac Plus or SE, this is a cheap way to get a little boost in performance. You may not be able to tell any difference unless your application is math intensive. Depending on the test being run, S.P.A.M.M. has shown a 20% to 60% increase in speed. I personally only measured 20%, but I have to admit that I do most of my heavy computing on the Macintosh II.

The only annoying thing is that in order to install S.P.A.M.M. the master disk must be present for the user to enter name and organization information. Once the user name/organization information is entered, the INIT is completely copyable. It doesn’t bother me to have to type in my name etc., but I don’t like the idea of modifying the master disk for any reason. If this bothers you then I recommend you make a bit-copy of the master disk and use the backup.

Bravo Technologies, Inc.

P. O. Box 10078

Berkeley, CA. 94709-0078

(415) 841-8552

Price:

User ID Copy protection!

FOR MAC PLUS & SE ONLY!

Listing: BH Module.p
{Black Hole Module Module.p}
{A very simple graphics module for After Dark™}
{ Generic Shell by Patrick Beard and Bruce Burkhalter }
{ © 1989 Berkeley Systems Inc . }
{ module by Dave Kelly, © 1989 MacTutor}
unit BlackHole;
interface
 uses
 Quickdraw, GraphicsModuleTypes;

 function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: 
GMParamBlockPtr): OSErr;

 function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): 
OSErr;

 function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: 
GMParamBlockPtr): OSErr;

 function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): 
OSErr;

 function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): 
OSErr;

implementation
 type
 BHStorage = record
 CircleRect: Rect; 
 {this is the rectangle for the circle to be drawn}
 CircleColor: integer;
 BlankingColor: integer;
 Center: Point;
 Origin: Point;
 ScreenRect: Rect;
 end;
 BHStoragePtr = ^BHStorage;
 BHStorageHandle = ^BHStoragePtr;

 function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: 
GMParamBlockPtr): OSErr;
{Allocate memory and initialize variables here}
 var
 result: OSErr;
 myStorage: BHStorageHandle;
 begin
{ allocate handle to my storage }
 myStorage := BHStorageHandle(NewHandle(sizeof(BHStorage)));

 if MemError <> noErr then
 begin
 DoInitialize := MemError;
 exit(DoInitialize);
 end;
 MoveHHi(Handle(myStorage));
 HLock(Handle(myStorage));{ Lock it down. }
 myStorage^^.circlecolor := blackcolor;
 myStorage^^.blankingcolor := blackcolor;
 storage := Handle(myStorage);
 { assign myStorage to passed handle }
 myStorage^^.screenrect := params^.qdGlobalsCopy^.qdScreenBits.bounds;
 myStorage^^.Center.h := params^.qdGlobalsCopy^.qdScreenBits.bounds.right 
div 2;
 myStorage^^.Center.v := params^.qdGlobalsCopy^.qdScreenBits.bounds.bottom 
div 2;
 myStorage^^.origin.h := 0;
 myStorage^^.origin.v := 0;
 myStorage^^.CircleRect := params^.qdGlobalsCopy^.qdScreenBits.bounds;
 InsetRect(myStorage^^.CircleRect, myStorage^^.Center.h, myStorage^^.Center.v);
 HUnlock(Handle(myStorage));
 DoInitialize := noErr;
 end;

 function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): 
OSErr;
 begin
{Blank the screen.  You could also have “credits” appear on the screen 
here}
 FillRgn(blankRgn, params^.qdGlobalsCopy^.qdBlack);
 params^.brightness := params^.controlValues[1] * 255 div 100;
 DoBlank := noErr;
 end;

 function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: 
GMParamBlockPtr): OSErr;
 var
 result: OSErr;
 myStorage: BHStoragePtr;
 { to hold dereferenced storage handle }
 dh, dv: integer; {horiz and vert change parameters}
 begin
{This function is repeatedly called by After Dark™.  This is where the 
main drawing is done.}
{lock our storage down so we can deference it once for faster access}
 MoveHHi(storage);
 HLock(storage);
 myStorage := BHStoragePtr(storage^);
 dv := -1;
 dh := -1;
 InsetRect(myStorage^.CircleRect, dh, dv);
 if PtInRect(myStorage^.Origin, myStorage^.CircleRect) then
 begin
 myStorage^.CircleRect := params^.qdGlobalsCopy^.qdScreenBits.bounds;
 InsetRect(myStorage^.CircleRect, myStorage^.Center.h, myStorage^.Center.v);
 forecolor(myStorage^.Blankingcolor);
 FillRgn(blankRgn, params^.qdGlobalsCopy^.qdBlack);
 if params^.controlValues[0] = 1 then
 case myStorage^.blankingcolor of
 blackcolor: 
 myStorage^.blankingcolor := whitecolor;
 whitecolor: 
 myStorage^.blankingcolor := redcolor;
 redcolor: 
 myStorage^.blankingcolor := greencolor;
 greencolor: 
 myStorage^.blankingcolor := bluecolor;
 bluecolor: 
 myStorage^.blankingcolor := cyancolor;
 cyancolor: 
 myStorage^.blankingcolor := magentacolor;
 magentacolor: 
 myStorage^.blankingcolor := yellowcolor;
 yellowcolor: 
 myStorage^.blankingcolor := blackcolor;
 otherwise
 myStorage^.blankingcolor := blackcolor;
 end
 else
 case myStorage^.blankingcolor of
 blackcolor: 
 myStorage^.blankingcolor := whitecolor;
 whitecolor: 
 myStorage^.blankingcolor := blackcolor;
 otherwise
 myStorage^.blankingcolor := blackcolor;
 end;
 end;
 if params^.controlValues[0] = 1 then
 case myStorage^.circlecolor of
 blackcolor: 
 myStorage^.circlecolor := whitecolor;
 whitecolor: 
 myStorage^.circlecolor := redcolor;
 redcolor: 
 myStorage^.circlecolor := greencolor;
 greencolor: 
 myStorage^.circlecolor := bluecolor;
 bluecolor: 
 myStorage^.circlecolor := cyancolor;
 cyancolor: 
 myStorage^.circlecolor := magentacolor;
 magentacolor: 
 myStorage^.circlecolor := yellowcolor;
 yellowcolor: 
 myStorage^.circlecolor := blackcolor;
 otherwise
 myStorage^.circlecolor := blackcolor;
 end
 else
 case myStorage^.circlecolor of
 blackcolor: 
 myStorage^.circlecolor := whitecolor;
 whitecolor: 
 myStorage^.circlecolor := blackcolor;
 otherwise
 myStorage^.circlecolor := blackcolor;
 end;
 params^.brightness := params^.controlValues[1] * 255 div 100;
 forecolor(myStorage^.circlecolor);
 frameoval(myStorage^.CircleRect);
 HUnlock(storage);
 DoDrawFrame := noErr;
 end;

 function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): 
OSErr;
{Deallocate your memory here.  You can also put something on the screen.}
 var
 myStorage: BHStorageHandle;
 begin
{deallocate our storage}
 myStorage := BHStorageHandle(storage);
 if (myStorage <> nil) then
 begin
 MoveHHi(storage);
 HLock(storage);
 if (params^.colorQDAvail = true) then
 begin
 end;
 DisposHandle(storage);
 end;
{check for memory errors}

 DoClose := noErr;
 end;

 function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): 
OSErr;
 begin
{This is called when the used clicks on a button in the Control Panel.}
 DoSetup := noErr;
 end;

end.

Listing:  BH Module.proj.r
data ‘STR ‘ (128, “credits”) {
 $”29 42 6C 61 63 6B 20 48 6F 6C 65 2C 20 62 79 20"      
  /* )Black Hole, by  */
 $”44 61 76 65 20 4B 65 6C 6C 79 0D 20 A9 31 39 38"       
 /* Dave Kelly¬ ©198 */
 $”39 20 4D 61 63 54 75 74 6F 72"                     
  /* 9 MacTutor */
};

data ‘xVal’ (1000, “Use Color”) {
 $”00 00"                /* .. */
};

data ‘µVal’ (1000, “Use Color”) {
 $”00 01"              /* .. */
};

data ‘sVal’ (1001, “Intensity”) {
 $”00 1E”                        /* .. */
};

data ‘sUnt’ (1001, “Intensity Units”) {
 $”00 65 00 00 02 30 25 00 01 02 31 25 00 02 02 32"    
 /* .e...0%...1%...2 */
 $”25 00 03 02 33 25 00 04 02 34 25 00 05 02 35 25"    
 /* %...3%...4%...5% */
 $”00 06 02 36 25 00 07 02 37 25 00 08 02 38 25 00"    
 /* ...6%...7%...8%. */
 $”09 02 39 25 00 0A 03 31 30 25 00 0B 03 31 31 25"    
 /* .9%...10%...11% */
 $”00 0C 03 31 32 25 00 0D 03 31 33 25 00 0E 03 31"    
 /* ...12%.¬.13%...1 */
 $”34 25 00 0F 03 31 35 25 00 10 03 31 36 25 00 11"    
 /* 4%...15%...16%.. */
 $”03 31 37 25 00 12 03 31 38 25 00 13 03 31 39 25"    
 /* .17%...18%...19% */
 $”00 14 03 32 30 25 00 15 03 32 31 25 00 16 03 32"    
 /* ...20%...21%...2 */
 $”32 25 00 17 03 32 33 25 00 18 03 32 34 25 00 19"    
 /* 2%...23%...24%.. */
 $”03 32 35 25 00 1A 03 32 36 25 00 1B 03 32 37 25"   
 /* .25%...26%...27% */
 $”00 1C 03 32 38 25 00 1D 03 32 39 25 00 1E 03 33"    
 /* ...28%...29%...3 */
 $”30 25 00 1F 03 33 31 25 00 20 03 33 32 25 00 21"    
 /* 0%...31%. .32%.! */
 $”03 33 33 25 00 22 03 33 34 25 00 23 03 33 35 25"    
 /* .33%.”.34%.#.35% */
 $”00 24 03 33 36 25 00 25 03 33 37 25 00 26 03 33"    
 /* .$.36%.%.37%.&.3 */
 $”38 25 00 27 03 33 39 25 00 28 03 34 30 25 00 29"    
 /* 8%.’.39%.(.40%.) */
 $”03 34 31 25 00 2A 03 34 32 25 00 2B 03 34 33 25"    
 /* .41%.*.42%.+.43% */
 $”00 2C 03 34 34 25 00 2D 03 34 35 25 00 2E 03 34"    
 /* .,.44%.-.45%...4 */
 $”36 25 00 2F 03 34 37 25 00 30 03 34 38 25 00 31"    
 /* 6%./.47%.0.48%.1 */
 $”03 34 39 25 00 32 03 35 30 25 00 33 03 35 31 25"    
 /* .49%.2.50%.3.51% */
 $”00 34 03 35 32 25 00 35 03 35 33 25 00 36 03 35"    
 /* .4.52%.5.53%.6.5 */
 $”34 25 00 37 03 35 35 25 00 38 03 35 36 25 00 39"    
 /* 4%.7.55%.8.56%.9 */
 $”03 35 37 25 00 3A 03 35 38 25 00 3B 03 35 39 25"    
 /* .57%.:.58%.;.59% */
 $”00 3C 03 36 30 25 00 3D 03 36 31 25 00 3E 03 36"    
 /* .<.60%.=.61%.>.6 */
 $”32 25 00 3F 03 36 33 25 00 40 03 36 34 25 00 41"    
 /* 2%.?.63%.@.64%.A */
 $”03 36 35 25 00 42 03 36 36 25 00 43 03 36 37 25"    
 /* .65%.B.66%.C.67% */
 $”00 44 03 36 38 25 00 45 03 36 39 25 00 46 03 37"    
 /* .D.68%.E.69%.F.7 */
 $”30 25 00 47 03 37 31 25 00 48 03 37 32 25 00 49"    
 /* 0%.G.71%.H.72%.I */
 $”03 37 33 25 00 4A 03 37 34 25 00 4B 03 37 35 25"    
 /* .73%.J.74%.K.75% */
 $”00 4C 03 37 36 25 00 4D 03 37 37 25 00 4E 03 37"    
 /* .L.76%.M.77%.N.7 */
 $”38 25 00 4F 03 37 39 25 00 50 03 38 30 25 00 51"    
 /* 8%.O.79%.P.80%.Q */
 $”03 38 31 25 00 52 03 38 32 25 00 53 03 38 33 25"    
 /* .81%.R.82%.S.83% */
 $”00 54 03 38 34 25 00 55 03 38 35 25 00 56 03 38"    
 /* .T.84%.U.85%.V.8 */
 $”36 25 00 57 03 38 37 25 00 58 03 38 38 25 00 59"    
 /* 6%.W.87%.X.88%.Y */
 $”03 38 39 25 00 5A 03 39 30 25 00 5B 03 39 31 25"    
 /* .89%.Z.90%.[.91% */
 $”00 5C 03 39 32 25 00 5D 03 39 33 25 00 5E 03 39"    
 /* .\.92%.].93%.^.9 */
 $”34 25 00 5F 03 39 35 25 00 60 03 39 36 25 00 61"    
 /* 4%._.95%.‘.96%.a */
 $”03 39 37 25 00 62 03 39 38 25 00 63 03 39 39 25"    
 /* .97%.b.98%.c.99% */
 $”00 64 04 31 30 30 25"                               
 /* .d.100% */
};

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Six fantastic ways to spend National Vid...
As if anyone needed an excuse to play games today, I am about to give you one: it is National Video Games Day. A day for us to play games, like we no doubt do every day. Let’s not look a gift horse in the mouth. Instead, feast your eyes on this... | Read more »
Old School RuneScape players turn out in...
The sheer leap in technological advancements in our lifetime has been mind-blowing. We went from Commodore 64s to VR glasses in what feels like a heartbeat, but more importantly, the internet. It can be a dark mess, but it also brought hundreds of... | Read more »
Today's Best Mobile Game Discounts...
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Nintendo and The Pokémon Company's...
Unless you have been living under a rock, you know that Nintendo has been locked in an epic battle with Pocketpair, creator of the obvious Pokémon rip-off Palworld. Nintendo often resorts to legal retaliation at the drop of a hat, but it seems this... | Read more »
Apple exclusive mobile games don’t make...
If you are a gamer on phones, no doubt you have been as distressed as I am on one huge sticking point: exclusivity. For years, Xbox and PlayStation have done battle, and before this was the Sega Genesis and the Nintendo NES. On console, it makes... | Read more »
Regionally exclusive events make no sens...
Last week, over on our sister site AppSpy, I babbled excitedly about the Pokémon GO Safari Days event. You can get nine Eevees with an explorer hat per day. Or, can you? Specifically, you, reader. Do you have the time or funds to possibly fly for... | Read more »
As Jon Bellamy defends his choice to can...
Back in March, Jagex announced the appointment of a new CEO, Jon Bellamy. Mr Bellamy then decided to almost immediately paint a huge target on his back by cancelling the Runescapes Pride event. This led to widespread condemnation about his perceived... | Read more »
Marvel Contest of Champions adds two mor...
When I saw the latest two Marvel Contest of Champions characters, I scoffed. Mr Knight and Silver Samurai, thought I, they are running out of good choices. Then I realised no, I was being far too cynical. This is one of the things that games do best... | Read more »
Grass is green, and water is wet: Pokémo...
It must be a day that ends in Y, because Pokémon Trading Card Game Pocket has kicked off its Zoroark Drop Event. Here you can get a promo version of another card, and look forward to the next Wonder Pick Event and the next Mass Outbreak that will be... | Read more »
Enter the Gungeon review
It took me a minute to get around to reviewing this game for a couple of very good reasons. The first is that Enter the Gungeon's style of roguelike bullet-hell action is teetering on the edge of being straight-up malicious, which made getting... | Read more »

Price Scanner via MacPrices.net

Take $150 off every Apple 11-inch M3 iPad Air
Amazon is offering a $150 discount on 11-inch M3 WiFi iPad Airs right now. Shipping is free: – 11″ 128GB M3 WiFi iPad Air: $449, $150 off – 11″ 256GB M3 WiFi iPad Air: $549, $150 off – 11″ 512GB M3... Read more
Apple iPad minis back on sale for $100 off MS...
Amazon is offering $100 discounts (up to 20% off) on Apple’s newest 2024 WiFi iPad minis, each with free shipping. These are the lowest prices available for new minis among the Apple retailers we... Read more
Apple’s 16-inch M4 Max MacBook Pros are on sa...
Amazon has 16-inch M4 Max MacBook Pros (Silver and Black colors) on sale for up to $410 off Apple’s MSRP right now. Shipping is free. Be sure to select Amazon as the seller, rather than a third-party... Read more
Red Pocket Mobile is offering a $150 rebate o...
Red Pocket Mobile has new Apple iPhone 17’s on sale for $150 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Switch to Verizon, and get any iPhone 16 for...
With yesterday’s introduction of the new iPhone 17 models, Verizon responded by running “on us” promos across much of the iPhone 16 lineup: iPhone 16 and 16 Plus show as $0/mo for 36 months with bill... Read more
Here is a summary of the new features in Appl...
Apple’s September 2025 event introduced major updates across its most popular product lines, focusing on health, performance, and design breakthroughs. The AirPods Pro 3 now feature best-in-class... Read more
Apple’s Smartphone Lineup Could Use A Touch o...
COMMENTARY – Whatever happened to the old adage, “less is more”? Apple’s smartphone lineup. — which is due for its annual refresh either this month or next (possibly at an Apple Event on September 9... Read more
Take $50 off every 11th-generation A16 WiFi i...
Amazon has Apple’s 11th-generation A16 WiFi iPads in stock on sale for $50 off MSRP right now. Shipping is free: – 11″ 11th-generation 128GB WiFi iPads: $299 $50 off MSRP – 11″ 11th-generation 256GB... Read more
Sunday Sale: 14-inch M4 MacBook Pros for up t...
Don’t pay full price! Amazon has Apple’s 14-inch M4 MacBook Pros (Silver and Black colors) on sale for up to $220 off MSRP right now. Shipping is free. Be sure to select Amazon as the seller, rather... Read more
Mac mini with M4 Pro CPU back on sale for $12...
B&H Photo has Apple’s Mac mini with the M4 Pro CPU back on sale for $1259, $140 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – Mac mini M4 Pro CPU (24GB/512GB): $1259, $... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.