13

I have some old Macs that I would like to remove their clock batteries so that I don't have to worry about them leaking and destroying logic boards. That being said I do want to operate them from time to time.

I've been toying around with the idea of writing a system extension to address some of the issues that come from having no battery in a Mac. In fact, I've already gotten started.

My goal is to create a system extension that detects if the date is set to something prior to 2016, and pops up a dialog on startup asking for the time and date. I would install this on 68k machines from the SE onward. So I'm shooting for System 6 compatibility.

I've purchased a copy of Inside Macintosh (volumes I through VI) on amazon and I've managed to write a program that opens a dialog asking for the time and date, which in turn sets the system clock and then quits. I could drop this in the startup folder but I REALLY want to do this as a system extension. I've managed to convert it to an INIT resource but when it runs on startup it just bombs and I have to disable it (bus error).

My understanding is that a bus error happens when a pointer points to an address outside of the available memory. so this has something to do with the system environment during startup. Does anyone know what I should do to debug this?

2 Answers 2

10

Turns out the solution was to open ResEdit and lock the INIT resource within my compiled extension. Everything worked as expected after doing this.

3

The usual way to debug a program is with a debugger. The usual low-level debugger for classic MacOS was MacsBug. I've never tried using it to debug an extension during startup, but I see no reason why it wouldn't work.

As for the specific cause of your bug, I'm guessing you're trying to use the windowing system before it's been initialized.

1
  • The window opens and displays correctly, the bus error occurs after the window is open. Commented Nov 8, 2016 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .