The Apple II MouseCard's interrupt requests (IRQs) are indeed synchronized with the vertical blanking interval (VBL). Through oscilloscope analysis and examining the MouseCard's firmware, the author confirmed that the card cleverly uses the VBL signal to time its counter, ensuring consistent IRQ generation every 1/60th of a second. This synchronization prevents screen tearing and jerky mouse movement, as updates are coordinated with the display refresh. Despite prior speculation and documentation suggesting otherwise, the investigation conclusively demonstrates the VBL-synced nature of the MouseCard's IRQ.
This blog post by Colin Holgate meticulously investigates and confirms a long-held assumption about the Apple II MouseCard: its interrupt request (IRQ) signal is indeed synchronized with the vertical blanking interval (VBL) of the Apple II's display. The VBL is the period during which the electron beam in a CRT monitor returns to the top of the screen after refreshing the image, a time when the system can perform updates without causing visual artifacts.
Holgate begins by outlining the common belief that the MouseCard IRQ is tied to the VBL and explaining why this synchronization is beneficial. It allows the mouse driver software to update the cursor position during the VBL, preventing flickering or tearing that might occur if the update happened mid-refresh. He then notes that while this synchronization was generally accepted, definitive documentation proving it was lacking.
To investigate this, Holgate employs a logic analyzer to capture and analyze the timing signals of both the MouseCard IRQ and the Apple II's VBL. He details his experimental setup, which involved connecting the logic analyzer probes to the appropriate pins on the MouseCard and using a simple program on the Apple II to trigger the mouse IRQ.
The resulting captured data, visualized in the blog post as a logic analyzer trace, clearly demonstrates the temporal relationship between the two signals. The MouseCard IRQ is shown to consistently occur within the VBL window. Holgate explains how the trace reveals that the IRQ is not only within the VBL but occurs at a specific and consistent point within it. He elaborates on the significance of this precise timing, highlighting that it further strengthens the evidence of intentional synchronization.
Finally, after presenting and analyzing the empirical data, Holgate concludes that the long-held belief is indeed correct: the Apple II MouseCard IRQ is demonstrably synchronized with the VBL. He underscores the importance of this finding for developers working with Apple II emulation or those interested in the low-level hardware operation of this vintage system. The post effectively provides conclusive evidence for a previously undocumented but important aspect of the Apple II MouseCard's functionality.
Summary of Comments ( 11 )
https://news.ycombinator.com/item?id=43925414
HN commenters discuss the intricacies of the Apple II MouseCard's interrupt handling, particularly its synchronization with the vertical blanking interval (VBL). Some express admiration for the clever engineering required to achieve stable mouse input within the constraints of the Apple II's hardware. One commenter recounts experiences with similar timing challenges on the Atari 8-bit and C64, emphasizing the difficulty of accurate timing without dedicated hardware support. Others delve into the specifics of the MouseCard's design, mentioning the use of a shift register and the challenges of debouncing button presses. The overall tone is one of appreciation for the ingenuity required to implement seemingly simple features on older hardware.
The Hacker News post titled "Yes, the Apple II MouseCard IRQ Is Synced to the VBL" has generated a modest discussion with several insightful comments.
One commenter highlights the cleverness of syncing the MouseCard interrupt request (IRQ) with the vertical blanking interval (VBL). They explain that this synchronization prevents visual artifacts or "snow" that could occur if the interrupt happened during active screen drawing. This method effectively utilizes the VBL's inherent downtime for interrupt handling, maximizing the efficiency of the system.
Another commenter dives deeper into the Apple II's hardware limitations, explaining the rationale behind the chosen IRQ method. They point out that the 6502 processor lacked sophisticated interrupt handling capabilities, making a simple, synchronized approach like tying the IRQ to the VBL the most practical solution. This constraint forced elegant design choices that leveraged existing system timings.
A further comment contrasts the Apple II's method with other systems that used periodic interrupts for mouse input. While acknowledging the potential for slight inaccuracies in the Apple II's approach, they emphasize the simplicity and effectiveness of the VBL-synced IRQ within the context of the Apple II's hardware.
Another commenter shares a personal anecdote about their experience with the Apple II MouseCard, highlighting the surprisingly good performance despite the seemingly rudimentary interrupt mechanism. They suggest that this positive user experience is a testament to the effectiveness of the VBL synchronization.
The overall sentiment in the comments is one of appreciation for the ingenuity and practicality of the Apple II's design choices, particularly in light of the hardware constraints of the era. The discussion provides a fascinating glimpse into the challenges and solutions of early computer engineering.