TweetFollow Us on Twitter

Debugging 1
Volume Number:10
Issue Number:1
Column Tag:Debugging

Ram Disks

Preserving data on RAM Disks via Macsbug

By Marek Hajek, Incline Village, Nevada

About the author

Marek Hajek has been programming the Macintosh since 1989. He programmed two and a half years for Sierra Software Innovations where he wrote several inhouse MacApp applications, participated in the development of SuperTEView, and the relational database engine - Inside Out II. Currently he is working on his bachelor’s degree in Computer Science and supports his education with contract programming. Your comments on this article are appreciated and can be sent to P.O. Box 7542, Incline Village, NV 89450.

This article is based on my experience with the product Maxima made by Connectix Corporation. I use Maxima to set up a RAM Disk on my Mac IIsi. If you are using a different RAM Disk software, consult its documentation to find out whether the RAM Disk is nonvolatile. This following information applies only to nonvolatile RAM Disks. What’s a nonvolatile RAM Disk?

Nonvolatile RAM Disks, Maxima included, have a peculiar characteristic about them. As long as power to the computer is not interrupted, the data on the RAM Disk is preserved. Restarts, shutdowns, and system crashes do not interrupt power to the RAM Disk and as a result the RAM Disk contents are preserved. On the other hand, if power is interrupted to the RAM Disk, its contents may become corrupted or wiped off. A power interrupt occurs when you reach in the back of your computer and press the power switch or someone trips over the power cord to your computer and pulls it out of the socket.

When a severe crash occurs because of a software bug, the goal is to restart your computer without having to use the power switch. This will preserve the integrity of your data. What is a safe way to restart your computer in the midst of a crash? The reset switch, that little two button box attached to the side of your computer, does a good job restarting a computer and does not interrupt power to the RAM Disk. Your RAM Disk data will be preserved every time you use the reset switch. Since the reset switch restarts a computer 99% of the time (I’ve seen bugs that disabled the reset switch), this article is mainly for those of you who either didn’t or can’t install one on your Mac. So, what are other “safe” ways to restart your computer when a crash takes place?

MACSBUG’S RS/RB - UNSAFE RESTARTING

Your Mac can be restarted with the Macsbug debugger (I assume you have Macsbug on your Mac). In the course of programming you’ve probably encountered the Macsbug display more than once. It usually shows up when a nasty bug occurs in your program. The usual way to restart your computer from Macsbug is to type in rs or rb followed by a return. Alas, sometimes the bug has done so much damage the Macsbug command rs or rb won’t work. This is the time when your probably reach in the back of the computer for the power switch. This definitely is not a safe way to restart the computer.

MACSBUG - RESTARTING the SAFE WAY

There is a safer way to restart your Mac from Macsbug. The step is simple. Set the PC (program counter) to point to the restart mechanism in ROM. The program counter keeps track the memory address of the next instruction that will be executed. How do you set the program counter? On my Mac IIsi the line I enter into Macsbug looks like this:

g 4080008C

The g means ‘go to instruction’ and 4080008C is the address of the instruction that will be executed next. The 4080008C is the IIsi’s ROM address where the code for the restart mechanism is located. Since it is in ROM, the code cannot be affected by software bugs and is safe to execute. Because your computer may have the restart mechanism at a different location in ROM than my IIsi, you need to find its address. This can be done by following the next 4 steps:

1) Save every open document and quit all running applications. After step number 4 you will have to restart your computer.

2) Enter Macsbug. I enter Macsbug using the key combination Cmd-Option-Power On Key. The Power On key has a little triangle pointing to the left and is usually located toward the top of the keyboard. If your keyboard doesn’t have the Power On Key, find another way to drop into Macsbug. There may be a different way to drop into Macsbug on your computer.

3) In Macsbug type in the next two lines, each line followed by a return. Don’t forget the ^ character (shift-6) after the closing parentheses on the first line!

PC = (Rombase)^ + 0A

S

4) Toward the bottom of the Macsbug window you should see something similar to the next two lines:

"No procedure name"

4080008C *MOVE #$2700,SR

The first number (4080008C on my Mac) under the line “No procedure name” is the address of the restart mechanism. Write it down somewhere safe. From now on, anytime a bug drops you into Macsbug and you want to safely restart your computer to save your RAM Disk data, enter the line “g 4080008C” into Macsbug, where 4080008C is the number you wrote down. To test whether this is the address of the restart mechanism, type g followed by a return into Macsbug. This should restart your computer. Next to the reset switch, using the Macsbug procedure outlined above is probably the safest way to restart your computer and safeguard the data on your RAM Disk.

 
AAPL
$476.68
Apple Inc.
+7.85
MSFT
$30.66
Microsoft Corpora
+0.31
GOOG
$609.85
Google Inc.
+3.08
MacTech Search:
Community Search:

Tweetbot Makes The Jump to iPad
As you may have already read, earlier today Tweetbot just released a fresh new release of their extremely popular iPhone Twitter client.  Going along with that, developer Tapbots has also announced that there is finally an iPad version of the... | Read more »
Tweetbot Reaches Version 2.0
Here at 148apps, we’re big fans of Tweetbot. Offering pretty much everything anyone could ever want from a Twitter client, it’s no wonder that we feel that way. I know I’m quietly hopeful that one day a desktop client as good as it will come along... | Read more »
Demolicious Review
Demolicious Review By Rob Rich on February 8th, 2012 Our Rating: :: ORDINANCE & CHAOSiPhone App - Designed for the iPhone, compatible with the iPad Nothing says “Circus” like firing cannon balls at explosives.   | Read more »
Settle in for a Serious Read with Longfo...
It may seem anathema in the early 21st century, but some people still prefer their news in-depth, thorough and well-written. But in a twitterpated sound-bite culture it’s difficult to find comprehensive news reporting much less an app that serves it... | Read more »
Elf Defense Review
Elf Defense Review By Rob Rich on February 8th, 2012 Our Rating: :: HABIT-FORMINGUniversal App - Designed for iPhone and iPad Call it a fluke or call it careful planning, but Elf Defense is a TD game that hits all the right notes.   | Read more »
Social And Location Aware News With Arou...
Regardless of the location, there’s bound to be something interesting going on somewhere. AroundNow seeks to provide an easy way of seeing exactly what’s going on locally at any time. | Read more »
Royal Trouble: Hidden Adventures Review
Royal Trouble: Hidden Adventures Review By Jennifer Allen on February 8th, 2012 Our Rating: :: CASUAL MYSTERYiPad Only App - Designed for the iPad A lighthearted casual adventure gaming experience that’s a small step up in... | Read more »

Price Scanner via MacPrices.net

15″ MacBook Pro sale prices, $101 off 15″ 2.2GHz m...
 B&H Photo has the 15″ 2.2GHz MacBook Pro on sale today for $1698 including free shipping plus NY sales tax only. Their price is $101 off MSRP. Adorama has the 15″ 2.2GHz MacBook Pro on sale for... Read more
Apple refurbished iMacs available starting at $999
The Apple Store has Apple Certified Refurbished iMacs available for up to $340 off the price of new models. An Apple one-year warranty is included with each model, and shipping is free: - 27″ 3.1GHz... Read more
MacBooks up to $200 off at Apple Store for Educati...
Purchase a new MacBook Pro or MacBook Air at The Apple Store for Education and take up to $200 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount.... Read more
13″ 2.4GHz White MacBook (refurbished) available f...
The Apple Store has restocked Apple Certified Refurbished 13″ 2.4GHz White MacBooks for $849 including free shipping. Their price is $150 off original MSRP for new models and includes Apple’s one-... Read more
Mac mini Server on sale for $942, $57 off MSRP
B&H Photo has Mac mini Servers on sale for $942.95 including free shipping plus NY sales tax only. Their price is $57 off MSRP, and it’s the lowest price we’ve seen for this model from any Apple... Read more
Apple drops prices on refurbished iPod nanos to $9...
The Apple Store has Apple Certified Refurbished iPod nanos available starting at $99 – a $10 price drop. Each nano comes with an Apple one-year warranty, and shipping is free: - 16GB iPod nano (all... Read more
Open-box special: 13″ MacBook Air for $230 off MSR...
MacMall has open-box return 13″ 128GB MacBook Airs available for $1069.21 including free FedEx overnight shipping. That’s $230 off the cost of new models. Apple’s one-year warranty and all materials... Read more
Apple now offering refurbished Oct ’11 13″ MacBook...
 The Apple Store is now offering Apple Certified Refurbished October 2011 13″ MacBook Pros for up to $230 off the cost of new models, including free shipping. Apple’s one-year warranty is standard... Read more

Jobs Board

MAC Service Desk Technician at Technisou...
Available Ref ID: 1001703119 Visit Us www.technisource.com MAC Service Desk Technician JOB DESCRIPTION MAC Service Desk ... Apple Mac OS 10.X operating systems Strong knowledge of Mac hardware... Read more
iPhone App Developer at Elance.com (Gads...
I need an iPhone app developer to update and existing application with a new design and a few feature changes. You will ... the new design PSD, feature request details, existing app files and API... Read more
Help Desk / Windows & MAC Support Te...
Superior Technical Resources is looking for a Help Desk / Windows & MAC Support Technician to work for a very successful ... Candidate will have experience working in a Microsoft and Apple... Read more
iPad and iPhone App Developer at Boxee (...
This position will be involved throughout the entire application development lifecycle. You must be confident, take ownership of your projects, work efficiently without management, be personable, and... Read more
Apple/MAC Technology Consultant at Human...
Role: Apple / Mac Technology Consultant Assignment: Technical Services Location: Louisville, KY Are you a fit? Are you ... at an enterprise scale? Assignment Capsule: The Apple / Mac Consultant in... Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.