www.gryphel.com/c/minivmac/extras/testsync - feedback


a Mini vMac Extra


testsync-1.2.0.zip (info) a zipped hfs disk image and checksum file. The disk image can be mounted with Mini vMac. Includes source code.

TestSync is a simple application for testing Macintosh video emulation. On a real Macintosh Plus it should fill the screen with vertical bars that move smoothly to the left. (More specifically, one pixel wide bars with 7 pixels of space between bars, moving to the left at one pixel per tick, with about 60.15 ticks per second.)

For an emulator, this is about the worst possible case. It makes clearly visible any "tearing" effects cased by different screen refresh rates between the real and emulated computer. Also, if the operating system doesn't give the emulator time to run very regularly, it is very noticeable. And also, the entire screen changes with every tick, preventing the optimization where Mini vMac redraws only the part of the emulated screen that has changed, making clear just how much processing power is needed for video. Old machines such as a 400 MHz G3 iMac running OS X don't have enough, and can't run TestSync at even 1x speed.

TestSync continues running until you click the mouse or press a key. TestSync will not work on a Macintosh with Color Quickdraw, and should refuse to run.

TestSync exists thanks to Manuel Alfayate, who complained about graphics tearing in Mini vMac. I didn't see anything like that, and I thought Apple documentation implied it shouldn't happen in OS X 10.4 and later. Eventually I had the theory that it was just the software he was running, which perhaps would also tear on a real Mac Plus, or perhaps some inaccuracy of the emulation caused it to happen with this particular software. So I created TestSync to prove this theory, but instead it conclusively disproved it. The tearing was clearly visible, even though I had never noticed it before.

I haven't decided what to do about this yet, if anything. It would not generally be practical to sync the emulation and the real monitor. A Macintosh Plus screen has a specific refresh rate (about 60.15 times per second), and even modern monitors that allow changing the refresh rate probably mostly can't match that exact value. And even if it could be done, it would only make sense to do so in full screen mode, and changing the refresh rate would probably take a noticeable amount of time, and I like the current ability of Mini vMac to enter and leave full screen mode instantaneously. To prevent tearing without syncing would necessarily lose a bit of smoothness, since a real or emulated frame must occasionally be skipped. This can be done in OS X using the AGL_DOUBLEBUFFER and AGL_SWAP_INTERVAL options of OpenGL, but it is very expensive, and there might be more efficient alternatives.

By the way, redrawing the entire screen 60.15 times a second pushes the limits of what a Macintosh Plus can do. 21,888 bytes need to be changed in about 10,000 instructions. Which is why TestSync is written the way it is, with assembly language code writing directly to the screen memory.

See the Compiling page for instructions on compiling TestSync from the source code.

You can redistribute TestSync and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the included file COPYING.

TestSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.


If you find TestSync useful, please consider helping the Gryphel Project, of which it is a part.

gryphel logo, 1K
www.gryphel.com/c/minivmac/extras/testsync - feedback
copyright (c) 2010 Paul C. Pratt - last update 10/21/2010