A quirk in the Motorola 68030 processor inadvertently enabled the Mac Classic II to boot despite its ROM lacking proper 32-bit addressing support. The Classic II's ROM mistakenly used a "MOVEA" instruction with a 32-bit address, which should have caused a failure on the 24-bit address bus. However, the 68030, when configured for a 24-bit bus, ignores the upper byte of the 32-bit address in this specific instruction. This unintentional compatibility allowed the flawed ROM to function, making the Classic II's boot process seemingly normal despite the underlying programming error.
Doug Brown's blog post, "An invalid 68030 instruction accidentally allowed the Mac Classic II to successfully boot up," details a fascinating discovery related to the boot process of the Mac Classic II. This compact Macintosh model, released in 1991, utilized the Motorola 68030 processor. Brown, an enthusiast of retro computing, was investigating a peculiar behavior he observed while experimenting with the machine.
The Classic II, as shipped, is equipped with a specific ROM chip. Brown had replaced this original ROM with a modified one. This modified ROM contained code designed to patch certain aspects of the system software. During the boot sequence with this modified ROM, an unexpected and seemingly erroneous instruction was being executed on the 68030 processor. This instruction, specifically a "MOVE from SR," attempted to move the contents of the status register (SR), a critical processor register holding flags and other control bits, into a data register. According to official Motorola documentation, this particular form of the instruction, involving a direct move from the status register, is undefined and should not function correctly on a 68030. One would typically expect such an illegal instruction to trigger an exception, halting the boot process.
Remarkably, instead of crashing, the Mac Classic II continued to boot successfully. Brown's meticulous investigation revealed that, due to a specific quirk in the 68030's microcode implementation on the Classic II, this normally invalid instruction was actually being interpreted and executed as a legal, albeit different, instruction: "MOVE from CCR." The CCR, or Condition Code Register, is a subset of the larger SR, holding only the condition code flags. This unintentional substitution allowed the boot process to proceed unimpeded, despite the presence of the erroneous instruction.
Furthermore, Brown discovered that the errant "MOVE from SR" instruction was a remnant of code designed for older Macintosh models that used the Motorola 68000 processor. On the 68000, this instruction was valid. When the ROM code was adapted for the 68030-based Classic II, this particular instruction was inadvertently left unchanged.
The serendipitous outcome, where an invalid instruction was misinterpreted as a valid one with similar functionality, highlights the subtle complexities and occasional unintended behaviors that can arise within computer systems. It underscores how seemingly minor differences in processor microcode can have significant, and sometimes unexpected, consequences. The incident provided a unique learning experience for Brown, shedding light on the intricacies of the Mac Classic II's hardware and the legacy code it ran.
Summary of Comments ( 1 )
https://news.ycombinator.com/item?id=42824562
Hacker News commenters on the Mac Classic II boot anomaly generally express fascination with the technical details and the serendipitous nature of the discovery. Several commenters delve into the specifics of 680x0 instruction sets and how an invalid instruction could inadvertently lead to a successful boot, speculating about memory initialization and undocumented behavior. Some share anecdotes about similar unexpected behaviors encountered during their own retrocomputing explorations. A few commenters also highlight the importance of such stories in preserving computer history and understanding the quirks of older hardware. The overall sentiment reflects appreciation for the ingenuity and occasional happy accidents that shaped early computing.
The Hacker News post discussing the article "The invalid 68030 instruction that accidentally allowed the Mac Classic II to boot" has generated several interesting comments.
Several users discuss the nature of the undocumented
movc
instruction and its behavior on different Motorola 680x0 processors. One user highlights the difference between the 68020 and 68030 behavior regarding the CCR and SR registers, pointing out that setting specific bits in the SR unintentionally enables MMU functionality on the 68030, which wasn't intended for the Classic II. This accidental side effect is what allowed the machine to boot. The discussion expands to cover how these subtleties often lead to unexpected discoveries in computing.Another commenter reminisces about working with early Macintosh ROMs and the challenges of debugging without source code or comprehensive documentation. They mention the use of disassemblers and the process of painstakingly figuring out the purpose of various memory locations and instructions.
A separate thread delves into the specific MMU configuration enabled by the errant instruction. Commenters analyze the resulting address mapping and speculate on how this setup might impact performance and memory access. They also discuss the implications of running code designed for a simpler memory model on a system with an active MMU.
One user shares an anecdote about a similar "happy accident" in embedded systems development, where an undocumented behavior of a peripheral chip led to a performance boost. They draw a parallel with the Mac Classic II situation, emphasizing how unintended consequences can sometimes have positive outcomes.
The conversation also touches upon the broader history of Macintosh development and the constraints faced by engineers at the time. One comment mentions the limited resources and tight deadlines that often led to unconventional solutions and "hacks."
Finally, several comments simply express appreciation for the article and the insights it provides into the inner workings of early Macintosh hardware. They praise the author's ability to explain complex technical details in a clear and engaging manner.