System Error Alert Table

From Computers Wiki
Jump to navigationJump to search

The System Error Alert Table (resource type DSAT, allegedly short for Deep Shit Alert Table) describes startup text and fatal error dialogs for the classic Mac OS.

Specification

See Inside Macintosh: Operating System Utilities, Chapter 2 - System Error Handler, The System Error Alert Table Resource.

Reading it

ResEdit doesn't support DSAT and only shows a hex editor despite having a custom icon for the resource type.

Here is an extremely rough Python script for dumping the alerts, their IDs, and their error messages. Despite DSAT definitions being polymorphic, there is no type information, so it determines what is an alert by process of elimination (correct size, text pointers are valid, pointed-to text is ASCII). Copy-paste the hex editor output from ResEdit into a text file, then pass its filename to this script:

dsat.py contents

from argparse import ArgumentParser
from pathlib import Path
import struct
from typing import NamedTuple

parser = ArgumentParser()
parser.add_argument('hexfilepath')
buffer = bytes.fromhex(Path(parser.parse_args().hexfilepath).read_text())
offset = 0

def read_short():
    global offset
    number = int.from_bytes(buffer[offset:offset + 2])
    offset += 2
    return number

definition_count = read_short()
definitions: dict[int, 'Definition']

class Alert(NamedTuple):
    text1_id: int
    text2_id: int
    icon_id: int
    proc_id: int
    button_layout_id: int

    @property
    def text1(self):
        return definitions[self.text1_id].as_text().replace('/', '\n') if self.text1_id else None

    @property
    def text2(self):
        return definitions[self.text2_id].as_text().replace('/', '\n') if self.text2_id else None

    @property
    def text(self):
        if not self.text1:
            return None

        if self.text2:
            return self.text1 + '\n' + self.text2

        return self.text1

class Definition(NamedTuple):
    id: int
    data: bytes

    def as_alert(self):
        return Alert(*struct.unpack('>HHHHH', self.data))

    def as_text(self):
        return self.data[4:-1].decode('ascii')

def read_definition():
    global offset
    id = read_short()
    length = read_short()
    data = buffer[offset:offset + length]
    offset += length
    return Definition(id, data)

default_alert = read_definition().as_alert()
definitions = {(definition := read_definition()).id: definition
               for _ in range(definition_count)}

for error_id, definition in definitions.items():
    if len(definition.data) == 10:
        alert = definition.as_alert()
        try:
            print(error_id, '-', alert.text)
        except (KeyError, UnicodeDecodeError):
            pass

print('Default - ', default_alert.text)

Notes

  • The System Error Alert Table isn't just for fatal errors! The text below shows that the Force Quit dialog, among other things, is implemented here.
  • Sometimes, there is no error text, or the text is cut off; this is due to a custom procedure being used for that alert.
    • Post-boot (when DSAT ID = 2 is loaded), "out of memory", "unimplemented trap", and friends are printed by a procedure.
  • Entries in the table are not in order.
  • The "Power PC" and "System" (instead of Mac OS for >= 7.6) typos are in the original text.
  • The PC Card warning exists on the PowerBook version of Mac OS 8.6 but not the generic version of Mac OS 9.2.2 (on a Power Mac G4). Is this a one-off for this version, or does this table get dynamically generated at install time?

Contents in different system versions

System Software 6.0.8

DSAT ID = 0
Error ID Text
65526 MacsBug installed.
65525
102 This startup disk will not work on this Macintosh model. Use the latest Installer to update this disk for this model. (System 6.0.8 does not work on this model; you need a newer version that does.)
103 This Macintosh is set for 32-bit addressing. You may switch to 24-bit addressing and use this disk or restart and use a newer startup disk. (System 6.0.8 does not work with 32-bit addressing.)
101 Sorry, a system error occurred.

RAM parity

Default Welcome to Macintosh.
DSAT ID = 2
Error ID Text
30 Please insert the disk:
28 Sorry, a system error occurred.
26 The following application is busy or damaged:
42 You may now switch off your Macintosh safely.
20000 If you wish to continue using your Macintosh, press Restart. If not, press Shut Down.
20001 You may now switch off your Macintosh safely. If you wish to continue using your Macintosh, press Restart.
20002 Unsaved changes will be lost.
101 Sorry, a system error occurred.

RAM parity

Default Sorry, a system error occurred.

Mac OS 8.6 (PowerBook G3)

DSAT ID = 0
Error ID Text
102 This startup disk will not work on this Macintosh model. Use the latest Installer to update this disk for this model.
104 This disk must be unlocked in order to perform one-time housekeeping. If you wish to use this disk to start your Macintosh, unlock it.
116 This startup disk will not work on this computer. A Power PC based computer is required to startup from this disk.
118 The system software on the startup disk only functions on the original media, not if copied to another drive.
105 System 8.6 needs more memory to start up.
Default Sorry, a system error occurred.
DSAT ID = 2
Error ID Text
28 Sorry, a system error occurred.
25 Not enough memory is available while using
42
20000 If you wish to continue using your Macintosh, press Restart. If not, press Shut Down.
20001 It is now safe to switch off your Macintosh. If you wish to continue using your Macintosh, press Restart.
20002 Clicking Force Quit causes you to lose any unsaved changes. To avoid further problems, restart your computer after you click Force Quit.
99 The System file on this startup disk may be damaged. The Installer can be used to repair this disk.
98 The System file on this startup device does not contain the resources necessary to boot this Macintosh. Please use the Installer to update the System file.
101 Sorry, a system error occurred.

RAM parity

20010 Hard Disk Cable Warning

You must first shutdown the Macintosh before attaching any SCSI hard disk cables. Disconnect the cable from the back of the machine right now.

29205 Please reinsert the PC Card

It is currently in use and must be reinserted immediately to prevent damaging a document, file or the card.

Before ejecting a PC Card, you must close all documents and applications using the PC Card.

1010 Code Fragment could not be prepared.
1011 Internal Mixed Mode failure.
Default Sorry, a system error occurred.

Mac OS 9.2.2

DSAT ID = DSAT ID = 0
Error ID Text
102 This startup disk will not work on this Macintosh model. Use the latest Installer to update this disk for this model.
104 This disk must be unlocked in order to perform one-time housekeeping. If you wish to use this disk to start your Macintosh, unlock it.
116 This startup disk will not work on this computer. A Power PC based computer is required to startup from this disk.
118 The system software on the startup disk only functions on the original media, not if copied to another drive.
105 System 9.2.2 needs more memory to start up.
Default Sorry, a system error occurred.
DSAT ID = DSAT ID = 2
Error ID Text
28 Sorry, a system error occurred.
25 Not enough memory is available while using
42
20000 If you wish to continue using your Macintosh, press Restart. If not, press Shut Down.
20001 It is now safe to switch off your Macintosh. If you wish to continue using your Macintosh, press Restart.
20002 Clicking Force Quit causes you to lose any unsaved changes. To avoid further problems, restart your computer after you click Force Quit.
99 The System file on this startup disk may be damaged. The Installer can be used to repair this disk.
98 The System file on this startup device does not contain the resources necessary to boot this Macintosh. Please use the Installer to update the System file.
101 Sorry, a system error occurred.

RAM parity

20010 Hard Disk Cable Warning

You must first shutdown the Macintosh before attaching any SCSI hard disk cables. Disconnect the cable from the back of the machine right now.

1010 Code Fragment could not be prepared.
1011 Internal Mixed Mode failure.
Default Sorry, a system error occurred.