OPENSTEP 4.2 on the Libretto 100ct

Libretto at OPENSTEP login screen

This post inspired by NeXT month at r/retrobattlestations

I bought this Libretto 100ct off eBay around 10 years ago.

Specs:

  • Intel Pentium MMX 166 MHz (the Libretto 110ct is the same machine, just with a 233 MHz processor)
  • 64MB RAM (maxed out!)
  • 2GB 2.5” HDD
  • 7.1” 800x480 display

Win95 came installed on the hard drive. I saved an image of that, and installed OpenBSD. OpenBSD ran pretty well, although I haven’t used it much over the years. But now it’s NeXT month at r/retrobattlestations, and this machine fits nicely into the system requirements for OPENSTEP on Intel.

Installation

Problem: a CD drive is required to install OPENSTEP, and I don’t have a CD drive that will work on this laptop

Solution: Install OPENSTEP inside VMware Fusion, and then copy the installed OS onto the Libretto’s hard drive (installed in a USB enclosure)

I started by installing OPENSTEP 4.2 inside VMware Fusion 8.0. It’s pretty straightforward, the main details are to use the “Primary/Secondary(Dual) EIDE/ATAPI Device Controller” disk driver, and also to size the VM’s hard drive correctly (see below for more details). After installing OPENSTEP, I installed the developer tools, and then updated to Patch 4. This is a good walkthrough of the installation steps in a VM. I then booted the OPENSTEP VM with an Ubuntu ISO, and used dd to copy the VM disk onto the Libretto HD (installed in a USB enclosure and passed through to the VM). I put the HD back in the Libretto, booted, and ran Configure.app to set up devices!

Pictures

Even with the currently lousy hardware support (see below), the Libretto running OPENSTEP is still a lot of fun to play with!

Libretto with iPad Air 2

Hanging out with my iPad Air 2

Chess.app on OS X and OPENSTEP

Playing Chess.app with Uncle 15” rMBP

Grab.app on OS X and OPENSTEP

Can you see the family resemblance?

Project Builder/Xcode

Project Builder, meet Xcode

Libretto running PB with iPad Air 2

Which one is a “real computer”?

Hi /r/retrobattlestations

Hi reddit!

Storage

The Libretto’s BIOS has a built-in hibernate function which will dump the contents of RAM to disk and power the machine off in response to closing the lid or pushing the power button, all without OS support. This is cool, but obviously requires that some disk space be left unpartitioned. The Libretto BIOS lies to the operating system and reports that the disk is smaller than it actually is, to reserve this space. This works fine if the disk is partitioned on the Libretto, but when partitioning on another machine, this space needs to be manually left unpartitioned. The Toshiba Linux Utilities site describes this in more detail, but in short: for disks < 8.4GB, the hibernation space is at the end of the disk. For disks > 8.4GB, it starts at the 8.4GB mark.

I simply made my VM’s hard drive around 200 MB smaller than the physical HD I’m using (which is the Libretto’s factory original 2GB drive).

Graphics

This Libretto uses a NeoMagic NM-2160 graphics chip, which I doubt there are native OPENSTEP video drivers for. But, the VESA VBE video driver included with OPENSTEP 4.2 Update 4 does work, and provides a correctly-sized 800x480x8bpp mode. Unfortunately, the hardware is capable of thousands of colors (16bpp). I found a Linux user who said that VBE mode 295 is 800x480x16, but if I set this using the “Expert…” dialog in Configure.app, OPENSTEP gives a “VBE mode not supported” message on the console at boot :( Maybe there’s a hard-coded table of VBE modes in the driver? This is a reverse-engineering project to tackle someday.

Networking

I have a 3C575C 10/100 PCMCIA Ethernet card (a XJACK), which I think OPENSTEP has drivers for, but I’ve seen no sign that it detects the card at all. This will need more work.

Sound

The Libretto has a Yamaha OPL3-SA3 chip, which seems to support both WSS and SBPro interfaces. I set it up in OPENSTEP as a SoundBlaster 8 but it’s only working slightly (I get some noises and clicks when a sound is played). This needs more work, but should be fixable without needing extra drivers.

Disabling MacOS PowerBook Password Security, Illustrated

It’s a common problem: you boot up an old PowerBook, only to find that Password Security has been enabled on the hard drive!

Password prompt

Apologies for the poor pictures, this PowerBook 2400 has a cracked screen and the only monitor I had handy was a 50” plasma

Luckily, PowerBook Password Security is not encryption, or really much security at all. A Macintosh security group called mSec (archive.org) revealed how Password Security works, in a text that can still be found at SecureMac:

The Password Security Control Panel stores it’s settings in a file called “aaaaaaaaAPWD” in the root folder of the Hard Drive. This file is impossible to access under OS 8.5 due to the fact that it has the attribute of a disk. It can neither be moved, opened nor copied. It is, however, important to notice that this file contains a bit-flag indicating whether Password Security is turned on or off. It contains, furthermore, an encrypted version of the password.

Using an emergency startup disk (or CD) and Norton Disk Editor anyone can turn off the Password Security Control Panel and even change the password. If the PowerBook is booted up using an emergency startup disk the password dialog will appear when the Hard Drive is being mounted. If the user cancels this operation the PowerBook will still be usable, although the Hard Drive will not mount, leaving all information on the Hard Drive unavailable. However, Norton Disk Editor has the ability to display and change data even on unmounted disks. Since the settings file, aaaaaaaaAPWD, can be accessed this way, anyone can toggle the “on/off” mode of the Control Panel. This can be achieved by changing the value of the byte at offset three in the data fork from 01 to 00. Since the encrypted password is stored at offset 4 in the data fork of the file even that can be changed.

In short: by booting off another disk and using Norton Disk Editor, you can turn off password security!

I booted my PowerBook off a CompactFlash card and PCMCIA adapter, and gathered a couple different versions of Norton Disk Editor to try. If your disk is formatted with HFS+, you need to use Norton Disk Editor+. I found it included with Norton Utilities 6.0 (readily available from Macintosh Garden). HFS disks can use either the original NDE or NDE+, but I recommend NDE+ since it can handle both filesystems.

Once you’ve launched an appropriate version of Norton Disk Editor, pick the “secured” disk. With the disk open, choose Edit->Find….

Find dialog

We are looking for the hidden “aaaaaaaaAPWD” file which contains the Password Security settings. Set the parameters as shown in the picture above and click Find. With any luck, this will be the result:

Catalog node

This is the catalog tree node (think inode in UNIX parlance) for the “aaaaaaaaAPWD” file. Note the ‘pwd_APWD’ in the name and the ‘pSWD’ type code. The information needed to edit the file’s data is out-of-view, scroll down and the window should look like this:

Catalog node, scrolled down

The information needed is the 1st extent of the data fork, ‘105’ in this case. Enter this number into the “Allocation block” field at the top right of the window, and press return. The window should change to look like this:

Allocation block

You are looking at the data fork contents of the “aaaaaaaaAPWD” file! The mSec text says that the byte at offset 3 controls whether Password Security is enabled: ‘01’ for enabled, ‘00’ for disabled. The next picture shows this byte highlighted (remember, offset 3 = 4th byte).

Allocation block

Change this byte to ‘00’, quit NDE, and your PowerBook should boot without any password prompt!

With great power comes great responsibility: please be careful and respect the privacy and data of your PowerBook’s previous users

SSA Detailed Calculator 2015.2

The SSA released version 2015.2 of the Detailed Calculator on September 4, with a PowerPC binary and source code.

I incorporated the changes into my github repo, and posted a Universal Binary at github.

Unfortunately I still haven’t been able to get a reply from anyone at the Social Security Administration regarding the Detailed Calculator and this work. Thanks to David Oster for his previous work and kind words

Porting SSA Detailed Calculator to Xcode/Intel: Part 1

For the first post in this series, see Porting SSA Detailed Calculator to Xcode/Intel: Intro

Part 1: Compile the existing project and import into a Git repo

As always with an existing software project, the first step is to get the code to compile. I used my 17” PowerBook G4, running OS X 10.4 (since it’s the newest OS X version supported by CodeWarrior 9).

The existing source code can be downloaded from the SSA. Since the files are distributed in .sitx archives, StuffIt Expander is needed to expand them. In addition, the project uses Boost 1.33.1 (which I believe was the last version that supported CodeWarrior). All these directories need to be put next to each other, like:

Source directories unpacked

With that done, open the CodeWarrior project. I used CodeWarrior 9 since the project files were saved by that version, but I believe CW10 would also work. (You can find a copy of CW9 at the Internet’s favorite botany-themed Mac abandonware site 😛). Note that CodeWarrior 9 needs the latest 9.6 update installed to work correctly on OS X 10.4. Open the project file (anypiamacprojOSX/anypiamac.mcp) and the project window should appear:

CodeWarrior project opened

Now it’s time to try compiling. Click the green arrow on the top bar (2nd from the right), and it should start building:

CodeWarrior building

10 million lines later, CodeWarrior had a single compile error for me:

CodeWarrior compile error

The error is actually in Boost: a class that isn’t defined (date_time::microsec_clock) is being typedef’d. The fix is easy, put an #ifdef for BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK around the typedef (this is the same #ifdef that’s around the date_time::microsec_clock class definition):

CodeWarrior error fix

With that fixed, I ran the project again and it was successful!

CodeWarrior build works

A full build takes 13 minutes on my 1.5 GHz PowerBook G4, I suppose not bad for a single-core computer compiling hundreds of files. Keep that time in mind when we port the project to Xcode later on.


With the existing source code proven, my next step was to import it into a Git repository.

OS X 10.4 doesn’t include git (understandable for an OS released in 2004), but the excellent Tigerbrew project is a PPC Tiger-compatible fork of Homebrew, and includes formulas for the latest git version.

So this should be easy, right? Just install git, add the files, and push to github. Unfortunately, Mac resource forks make this more tricky. Dealing with resource forks is a distant memory for current Mac programmers, but code this old means that resource forks will be involved.

git has no support for resource forks: they aren’t stored in the repository, so the resource fork is effectively stripped off. Luckily, most of the files are just plain text C/C++ source code which shouldn’t need resource forks. The oactobjs folder consists entirely of text files, and I was surprised to see that so many had resource forks:

oactobjs files with resource forks

Note: since 10.4, the preferred way to access the resource fork of a file through BSD/UNIX APIs is by accessing file/..namedfork/rsrc

These are text files with resource forks. Huh? I opened one in a resource editor (Rezilla is a free one that’s OS X native) to investigate:

source file resource fork

There are only two resources, neither one containing much data. After seeing ‘Monaco’ (the classic Mac monospaced font), I believe these are just editor settings (maybe window position, font, etc) from CodeWarrior. These resources can be stripped off without a problem.

However, the other source folder (anypiamacprojOSX) contains the project files, resources, and more source files:

source file resource fork

After checking those files, I found two which have meaningful data in the resource fork: AppResources.ppob and AppResources.rsrc.

AppResources resource forks

Some solution will be necessary to ensure that these files still work correctly after having their resource forks stripped off.

  • AppResources.ppob is the PowerPlant resource file, created using Constructor. Luckily, Constructor has an option to “Save as flattened resource file” which puts everything in the data fork. I resaved AppResources.ppob using that option, and the new ppob file doesn’t even have a resource fork. AppResources resource forks

  • AppResources.rsrc contains all the app’s resources (icons, etc.) and would be edited using something like Rezilla or ResEdit. Luckily, Apple already has a flattened format for resource files, and the Rez and DeRez command-line tools are used to compile/decompile to/from the flattened format. I used DeRez to convert AppResources.rsrc, and then replaced AppResources.rsrc in the CodeWarrior project with AppResources.rsrc.r. AppResources compile with Rez

With those files fixed, I was able to git add all the files and push to my repository.

Next time: Building a Mach-O binary with CodeWarrior

Porting SSA Detailed Calculator to Xcode/Intel: Intro

Detailed Calculator running on Yosemite

The U.S. Social Security Administration maintains a Detailed Calculator (often referred to as Anypia) which is used to estimate retirement benefits. It’s a C++ application available for Windows and Mac OS X, and source code is available.

Unfortunately, the OS X version is still a PowerPC binary built with Metrowerks CodeWarrior 9 (!). This means it will not run on any version of OS X newer than 10.6 Snow Leopard (since that was the last release to include the Rosetta PowerPC translator).

The Detailed Calculator was originally ported from OS 9 to OS X in 2005 by David Phillip Oster, who detailed the process in a post on comp.sys.mac.oop.powerplant and on his website. I came across David’s newsgroup post in May 2015, and was amazed to find that the SSA was still using CodeWarrior and releasing PowerPC-only binaries. I thought it would be a fun retrocomputing and Mac development exercise to port the Detailed Calculator to Xcode in order to build universal binaries that would run on the latest Macs, and that is now complete!

If you’re reading this post and just want to download a binary of the Detailed Calculator that will run on Intel Macs, the latest binary release can be downloaded from github. Make sure to read the note and notice in the README file.


However if you want the gory details, read on! Converting a Carbon project from CodeWarrior to Xcode was a common process 10 years ago, but modern write-ups are quite rare! I’ve broken it down into 5 steps, and I’ll be publishing separate posts soon for each one.

Steve Jobs at WWDC 2005

  1. Compile the existing project and import into a Git repo
  2. Using CodeWarrior, build a Mach-O binary
  3. Import project into Xcode and start fixing errors
  4. Use open-powerplant and fix remaining errors
  5. Test functionality and tweak Info.plist

Stay tuned!

Replacing a SCSI enclosure power supply

Front view of enclosure Rear view of enclosure

Around 15 years ago, my grandparents gave me an external 12X SCSI CD-ROM drive that I believe they got from a garage sale. I’ve used it rarely in the years since: the most notable being to install OS X (back when it came on CDs) on our beige G3 after having to replace the internal CD drive with a 3rd-party one.

I recently started using the enclosure again with my classic Macs (for copying data off of old HDs, etc) but the enclosure developed a power supply problem. The power supply would put out a nominal +5V and +12V with no load, but under load the +5V drooped to +4.5V and drives wouldn’t work.

The enclosure is a very basic 5.25” external SCSI enclosure, with the power supply, rear ports, drive, and then top cover all being screwed to a baseplate. The only info I have about the enclosure is an FCC ID of KN4CD5371, which matches up to a “Dura Micro Inc” in Pomona, CA from October 1995. Internally it uses a Pioneer DR-466 12X tray-loading CD-ROM drive, and an Asian Power Devices Inc. APD-9505 power supply capable of +5V/1A and +12V/1A.

APD-9505 power supply

I took the power supply out, it’s quite small and sandwiched between the back of the drive and the vertical plate for connectors. None of the capacitors looked to be bulging or leaking. Without schematics, spare components to start swapping out, or a great understanding of how power supplies work, I didn’t do much troubleshooting on the power supply. Instead, I decided to buy a new one and fit it in.

eBay listing of the replacement power supply

I picked up a Hot USB TO IDE SATA S-SATA Converter Cable Adaptor Power for IDE/SATA Hard Disk for $9 on eBay, it came with an FZX-PWH125A external power supply (of unknown brand). One side has a standard IEC AC power connector, the other side is a short cable terminating in a standard molex PC power connector and outputs +12V/2A and +5V/2A. Getting the power supply open was not easy, there’s no screws and the plastic case is glued together at the seam. I ended up using channel locks to squeeze the case at the seams and break the halves apart.

Internals of replacement power supply

Luckily the replacement PSU is almost the same size as the old one, just slightly narrower and deeper (when viewed from the front). The old PSU was mounted on top of standoffs between the drive and the backplate, with a metal cage covering the components and the SCSI ribbon cable going over it.

Enclosure with old PSU and no drive

It was simple to de-solder the AC power connector and molex cable from the new PSU, and attach the old PSU’s molex cable and AC power lines. I can’t really mount the new PSU to the case since it doesn’t have any holes to put a screw or cable tie through, but I think it’ll be fine just sitting there. And to cover the components, I cut a square out of a paper plate and folded it around the power supply.

New PSU mounted in enclosure

With the new PSU in, the enclosure works great! The original Pioneer CD drive won’t read discs any more, but I picked up an AppleCD 600i off eBay which is working like a charm!

Fixing AMP OVERHEAT error on the Pioneer VSX 1020

I originally posted this on the AVSForum VSX-1020 thread on 4/4/2013

I fixed the “AMP OVERHEAT” error!!!

I’ve had the “AMP OVERHEAT” problem for years, starting about a year after I got my 1020. I found lots of things that seemed to help temporarily: plug it into a different wall socket, keep turning it on until it stayed on, but the problem would always recur eventually.

The root of the problem: the temperature sensor (“posistor” as it’s called in the service manual) went bad and presented a lower resistance, making the receiver think the amp heatsink was overheating. Luckily the posistor is easy to test and replace!

To get to the posistor: first remove the 10 screws (6 on sides, 4 on back) that hold the top cover on. The posistor itself is screwed to the amp heatsink, but the connector snakes through a hole in the amp board and then connects to the main/bottom board.

posistor connection

I was able to reach my hands in to push the end of the tab and pull up to disconnect it.

Warning: be careful around the amp board, it has lots of parts sticking up that could easily be broken off!

Using an ordinary multimeter, you can check the resistance of the posistor (to make sure it’s the problem)!

Working posistor: 306 ohm Bad posistor: 280 ohm

Now that you know your posistor is bad and causing the AMP OVERHEAT error, there’s two options:

  • either replace the posistor with a good one
  • or, cut the wires and solder a 306 ohm resistor to them (I didn’t try this, but I assume it would work :D)

Assuming you want to replace it: The posistor’s part # is F320121021240-IL, and Pioneer [will sell you a new one] (http://parts.pioneerelectronics.com/part.asp?productNum=F320121021240-IL) for $19.25

Removing the posistor without removing the amp board is tricky, you will need a right angle phillips bit/driver and don’t have much room to work with. There’s a hole in the amp board so you can unscrew the posistor, but there’s a bracket right behind the hole that makes it very hard to get a driver in! Luckily, by undoing 3 screws you can move the bracket back slightly. Again, be careful not to damage any components on the amp board!

I put my bit through the hole and onto the screw, and then had barely enough room to fit my right-angle ratchet loosely on the bit and loosen the screw.

I used needle-nose pliers to grab the screw once it was loose, since it could be hard to grab if it fell down. WIth the screw out, thread the wire and connector through the hole, and pull the posistor free.

Reverse the steps, and enjoy your working VSX-1020-K!

Welcome to bslabs

Welcome to bslabs, the new home for my explorations with electronics, computers (new and old), and much more.