uvmac/docs/hardware.html
2020-03-14 15:28:01 -04:00

1 line
37 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Emulated Hardware Reference - Mini vMac </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="hardware.html">
</head>
<body>
<div>
<i> <a href="https://www.gryphel.com/index.html">www.gryphel.com</a>/c/<a href="index.html">minivmac</a>/hardware
- <a href="https://www.gryphel.com/c/feedback.html">feedback</a> </i>
</div>
<hr>
<h3 align=center>
Mini vMac
</h3>
<h3 align=center>
Emulated Hardware Reference
</h3>
<hr>
<!--
<p> <b> * * * to be updated * * * </b> </p>
-->
<p> <b> Contents </b> </p>
<blockquote>
<p> <a href="hardware.html#rom">ROM</a> </p>
<p> <a href="hardware.html#power_switch">Power Switch</a> </p>
<p> <a href="hardware.html#floppy_drives">Floppy Drives</a> </p>
<p> <a href="hardware.html#processor">Processor</a> </p>
<p> <a href="hardware.html#ram">RAM</a> </p>
<p> <a href="hardware.html#screen">Screen</a> </p>
<p> <a href="hardware.html#keyboard">Keyboard</a> </p>
<p> <a href="hardware.html#mouse">Mouse</a> </p>
<p> <a href="hardware.html#sound">Sound</a> </p>
<p> <a href="hardware.html#vertical_retrace">Vertical Retrace</a> </p>
<p> <a href="hardware.html#rtc">Real Time Clock</a> </p>
<p> <a href="hardware.html#pram">Parameter RAM</a> </p>
<p> <a href="hardware.html#scsi">SCSI</a> </p>
<p> <a href="hardware.html#serial">Serial Ports</a> </p>
<p> <a href="hardware.html#interrupt">Interrupt Button</a> </p>
<p> <a href="hardware.html#reset">Reset Button</a> </p>
</blockquote>
<p> <a name="rom"> <b> ROM </b> </a> </p>
<p> The ROM (&ldquo;Read Only Memory&rdquo;) contains information needed for
the Macintosh Plus to function, and the emulation of the
Macintosh Plus also needs this information. A program such as
&ldquo;<a href="extras/copyroms/index.html">CopyRoms</a>&rdquo;,
when run on a real Macintosh Plus, will save
this information to a file, which can then be transferred
to the computer on which you want to run Mini vMac. Note that
the ROM image file is copyright Apple Computer, and may not
be redistributed. So to legally use Mini vMac, you need to
own a real Macintosh Plus. If you don&rsquo;t have a Macintosh Plus,
you could check the
&ldquo;<a href="https://www.gryphel.com/c/buymac/index.html">Where to buy an old Macintosh</a>&rdquo;
page. </p>
<p>
When Mini vMac launches, it will look for a ROM image file in a number
of possible locations.
If it does not find the ROM image, it will wait
for you to tell it where it is. You can drag the icon of the file onto
to the Mini vMac window. Or, in the Macintosh or Windows
versions, you can choose the &ldquo;Open Disk Image...&rdquo; command
from the &ldquo;File&rdquo;
<a href="control.html#menu_commands">menu</a>,
or the &lsquo;O&rsquo; command from the
<a href="control.html#control_mode">Control Mode</a> to bring
up the bring up the standard dialog. Once you have told Mini vMac
where the ROM image is, booting will resume.
</p>
<p>
Before giving up and asking you where the ROM image file is,
the first location Mini vMac will look for it is in the folder
containing the Mini
vMac application, with the name &ldquo;vMac.ROM&rdquo;.
In recent versions of OS X, this will not work by
default, because of &ldquo;Path Randomization&rdquo; misfeature added in
macOS Sierra (10.12), and also because of Sandboxing, when that is
enabled.
</p>
<p> The ROM image file may also be placed elsewhere, with an alias
(named &ldquo;vMac.ROM&rdquo;) to it placed in Mini vMac&rsquo;s folder.
"Alias" is the term used for Macintosh. On Windows you use
a "&ldquo;Shortcut&rdquo;" file. (It must be &ldquo;vMac.ROM&rdquo;,
not &ldquo;Shortcut to vMac.ROM&rdquo;. Actually, the file is really named
&ldquo;vMac.ROM.lnk&rdquo; internally, but what you see is &ldquo;vMac.ROM&rdquo;.)
And in the X versions you use a symlink, or "symbolic link". </p>
<p> An exception to the above is that in the Mac OS X version,
if you create a folder called &ldquo;mnvm_dat&rdquo;
inside the &ldquo;Contents&rdquo; folder within the application bundle
(control click on the application and choose &ldquo;Show Package Contents&rdquo;),
then Mini vMac will look for the &ldquo;vMac.ROM&rdquo; file, and the
<a href="hardware.html#floppy_drives">disk1.dsk, disk2.dsk, etc</a> files,
within the &ldquo;mnvm_dat&rdquo; folder.
This allows you to make a self contained Mac OS X application that
runs an application for the Mac Plus (especially when used with the
&ldquo;<a href="extras/autoquit/index.html">AutoQuit</a>&rdquo;
software.) </p>
<p> In the X version, if the folder containing the application can not be
determined, Mini vMac looks for the ROM image file in the current directory.
For example, finding the application directory is not implemented
in OpenBSD and Minix. </p>
<p> Also in the X version, if an argument of the form
&ldquo;-r [rom_file]&rdquo; is used on the
<a href="control.html#command_line">command line</a>,
that is used instead of the application directory
or current directory. Or, if there is an argument of
the form &ldquo;-d [directory_path]&rdquo;, Mini
vMac looks for the ROM image in [directory_path]. </p>
<p> If Mini vMac doesn't find the
ROM image in the locations described above, it will
also look in a specific central location. In OS X it
checks in "/Users/[your_UserName]/Library/Preferences/Gryphel/mnvm_rom/",
and then also in "/Library/Application Support/Gryphel/mnvm_rom/".
In Windows 7 and Vista, "C:\Users\[your_UserName]\AppData\Roaming\Gryphel\mnvm_rom\".
In Windows XP, "C:\Documents and Settings\[your_UserName]\Application Data\Gryphel\mnvm_rom\".
In Windows 98, "C:\WINDOWS\Application Data\Gryphel\mnvm_rom\".
In the X Versions, "~/.gryphel/mnvm_rom".
And in Macintosh Classic "System Folder:Preferences:Gryphel:mnvm_rom".
The "mnvm_rom" folder may be an alias
to where ever you keep your ROM collection. </p>
<p> Mini vMac will verify the checksum of the ROM on launch. There
is code in the ROM to do this when the Macintosh Plus boots,
but since Mini vMac patches the ROM to replace the disk driver,
it also patches the ROM to disable the checksum verification.
So Mini vMac does the check itself, before patching the ROM,
and gives a warning message if the checksum is incorrect. Since
no harm can be done no matter what is in the ROM, this is only
a warning, and Mini vMac will keep running. Mini vMac does not
check if the ROM image file is too long (it should be 128K =
131072 bytes). </p>
<p> There are three different versions of the Macintosh Plus ROM.
Versions 2 and 3 work with Mini vMac. The original (and rare)
version 1 ROM was recently reported not to work, presumably because
of problems with SCSI emulation. There are only a few
bytes different in version 2 from version 1, to fix a bug where
the Macintosh Plus wouldn't boot if an attached SCSI devices
was not turned on. </p>
<p> <a name="power_switch"> <b> Power Switch </b> </a> </p>
<p> <b>On:</b> Launching the Mini vMac application turns on the
power switch of the emulated computer. Double click on the
applications icon to launch Mini vMac in Macintosh or Windows.
The application can be launched from the command line in Linux
and Windows. There are also many other ways of launching
applications for each operating system, such as by installing
it into the dock of Macintosh OS X, the Apple menu of
Macintosh OS 9, or the start Menu of Windows. </p>
<p> <b>Off:</b> Quitting the Mini vMac application is like
turning off the power switch of the emulated computer. Just
like with the real computer, you should shut down the operating
system running within the emulated computer first. Mini vMac
can&rsquo;t tell if the emulated operating system has been properly
shut down, but it can tell whether any disk images are
currently mounted, and so uses that as the test for warnings. </p>
<p> If no disk images are mounted, Mini vMac can be quit with
Control-Q, or by clicking in the close box of the Mini vMac
window, or with the quit command in the menu
(Macintosh/Windows). </p>
<p> If a disk image is mounted, clicking in the close box or
choosing the quit command in the menu will bring up a warning
dialog. Choosing Control-Q will display a warning, with the
option of typing &lsquo;Y&rsquo; to force quit. </p>
<p> It is also possible for software running within the emulation
to cause Mini vMac to quit automatically. See
&ldquo;<a href="extras/autoquit/index.html">AutoQuit</a>&rdquo;.
</p>
<p> <a name="floppy_drives"> <b> Floppy Drives </b> </a> </p>
<p> The Macintosh Plus has one internal floppy disk drive, that
can use 3.5 inch 800K double sided disks or 400K single sided
disks. In addition, an external floppy drive can be attached.
Mini vMac does not emulate the floppy drive hardware but
instead patches the ROM with a replacement disk driver,
which can mount up to 6 &ldquo;disk image&rdquo; files. The information
on a floppy disk can be transferred to a disk image file.
The preferred disk image format for Mini vMac is a file
containing just the image data, with no header, trailer,
or resource fork (and therefore without checksums
or tag data).
Mini vMac will accept disk images in formats with
trailing information and no header, except that
it will pass an incorrect disk size to the emulated computer,
which affects programs such as Disk First Aid. </p>
<p> Mini vMac also supports disk images in
<a href="http://68kmla.org/wiki/DiskCopy_4.2_format_specification">&ldquo;Disk Copy 4.2&rdquo; format</a>,
which has an 84 byte header, and usually contains checksums
and tag data. These images are mounted read only.
The utility
<a href="extras/cnvtdc42/index.html">CnvtDC42</a>
converts Disk Copy 4.2 format images to a new
image without the tags and checksums and header,
that Mini vMac can write to. Alternatively, Mini vMac
can be compiled with full read/write support for this format.
</p>
<p> Compressed disk images are not supported. </p>
<p> Besides 400K or 800K, the replacement disk driver of Mini
vMac will also work with disk images of any other size less
than 2G. It will pretend to have something more like a hard
disk, though not exactly. This is not too authentic, but it
is very useful. Mini vMac defines its own icon for these
disks (with a &lsquo;v&rsquo;), which can be seen in the Finder on the
emulated computer. </p>
<p> Bootable disk images should use the &ldquo;Hierarchal Filing System&rdquo;
(HFS, now called HFS standard). The Macintosh Plus doesn&rsquo;t
understand the newer &ldquo;HFS extended&rdquo;. The older &ldquo;Macintosh
Filing System&rdquo; (MFS) will also work, but this mostly is useful
only for communicating with the emulation of the Macintosh
128K. Once the Macintosh Plus is booted, some Macintosh system
versions will support additional kinds of disks, such as DOS. </p>
<p> Mini vMac can boot with any system version that works on a
real Macintosh Plus, that is, up to &ldquo;7.5.5&rdquo;. </p>
<p> There are many ways to &ldquo;mount&rdquo; a disk image in Mini vMac.
(That is, to insert an emulated disk into an emulated floppy
drive.) The icon of the disk image file can be dragged on to
the Mini vMac window (Then, if the Mini vMac window isn&rsquo;t in
front, it will be automatically activated). In the Macintosh
or Windows versions, the icon of the disk image file can be
dragged on to the Mini vMac application icon (If Mini vMac is
already running, in the Macintosh version the disk image will
be opened in the existing process, while in the
Windows version a new instance of
Mini vMac will be launched). Also in the Macintosh or Windows
versions, choosing the &ldquo;Open Disk Image...&rdquo; command from the
&ldquo;File&rdquo;
<a href="control.html#menu_commands">menu</a>,
or the &lsquo;O&rsquo; command from the
<a href="control.html#control_mode">Control Mode</a>,
will bring up the standard dialog to select a disk image file. In
the X and Windows version, disk images can be specified in the
<a href="control.html#command_line">command line</a>. </p>
<p> When Mini vMac is launched, it can automatically
mount disk images named &ldquo;disk1.dsk&rdquo;, &ldquo;disk2.dsk&rdquo;, up to &ldquo;disk6.dsk&rdquo;.
Mini vMac will normally look for them in the folder containing the application.
In the Mac OS X version, if the &ldquo;mnvm_dat&rdquo; folder
exists it will look there, in the same way it looks for the
<a href="hardware.html#rom">ROM</a> image.
In the X version, if an argument of the form
&ldquo;-d [directory_path]&rdquo; is used on the
<a href="control.html#command_line">command line</a>,
Mini vMac will look in [directory_path] instead. </p>
<p> In the Macintosh version, disk1.dsk and so on
files may be aliases. In the Windows version, they may be
shortcut files. Mini vMac stops at the first image not
found, i.e. if there is no &ldquo;disk2.dsk&rdquo;, it won&rsquo;t open &ldquo;disk3.dsk&rdquo;,
even if it exists. </p>
<p> A disk image file may be locked. The emulated computer sees this
as a disk with the lock tab set. This allows you to use a disk
image and be certain the image file won&rsquo;t be modified. You can
also share a single locked image file among multiple running
copies of the emulator. </p>
<p> Never mount an unlocked disk image simultaneously in two running
copies of the emulator. And never mount a disk image in an
emulator and at the same time mount it on the real computer.
Such double mounting will usually corrupt the disk image
irreparably. Double mounting is not actually possible in Mac OS
9 or in Windows. Very old versions of OS X would allow
double mounting, but modern versions of OS X only allow
one copy of Mini vMac to get write access to a disk image,
and then allow other copies to get read access.
The X versions use advisory locking to refuse to open for writing a disk
image that has been opened for writing by another copy of Mini vMac.
</p>
<p> You can get a new blank disk image from the
&ldquo;<a href="extras/blanks/index.html">Blanks</a>&rdquo;
archive.
To transfer files from your real
computer into and out of disk image files, see the utilities
<a href="extras/importfl/index.html">ImportFl</a> and
<a href="extras/exportfl/index.html">ExportFl</a>.
</p>
<p> The save operation of a program for the Macintosh Plus would
normally force changes to be written out to disk (and not just
left in RAM caches). When running in Mini vMac the changes
will be written to the disk image, but the changes to the disk
image may not be written out immediately to the real disk. So
if the real computer crashes or loses power, saved changes may
be lost. In the Macintosh and Windows versions, changes to a
disk image are forced to be saved to the real disk when the
image is unmounted. </p>
<p> If you try to mount more than six disk images mounted at once,
Mini vMac will display an error alert. This limit can be
raised up to 32 disk images, with some memory and time
overhead, by recompiling. </p>
<p> The floppy disk drives of the Macintosh Plus have a small hole
into which a straightened paper clip can be inserted, which
will force the floppy disk to be ejected. Mini vMac doesn&rsquo;t
implement this feature. You can always force Mini vMac to
<a href="hardware.html#power_switch">quit</a>, or
<a href="hardware.html#reset">reset</a>,
either of which will unmount all disk image files. </p>
<p> All Mini vMac disk access is currently synchronous, so, for
example, mouse movement stops, and sound can be interrupted.
This might be changed in some future version. </p>
<p> <a name="processor"> <b> Processor </b> </a> </p>
<p> The Macintosh Plus has a Motorola MC68000 processor, running
at 7.8336 MHz. The emulated processor of Mini vMac can
run at approximately that speed (1x), but a number of other
settings are also available: 2x, 4x, 8x, 16x,
32x, and All out. </p>
<p> The speed setting can be controlled by the
&lsquo;S&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>,
that leads to another screen with more options.
There is also a
<a href="control.html#command_line">command line</a>
option for the Windows and X versions to start
Mini vMac at 1x speed. </p>
<p> The maximum speed depends on the speed of the real
computer on which it is running.
Setting Mini vMac to run faster than this maximum is
equivalent to setting it to &ldquo;All out&rdquo;. Otherwise
the percentage of CPU time taken by Mini vMac depends
on the speed setting. On some computers the fans will
start running very loudly if a high percentage of the
CPU time is in use. </p>
<p> So by default Mini vMac is set to run
at 8x, instead of &ldquo;All out&rdquo;, so as not to stress current
modern computers, but still feel reasonably snappy.
Setting the speed to 1x makes some older games more
playable, which weren&rsquo;t written with faster computers
in mind, and would otherwise play much too fast. </p>
<p> Also a few programs may break in other ways at faster
than 1x. When running faster, the emulated computer
thinks time is running normally for each sixtieth
of a second, but at the end of each sixtieth,
a lot of instructions get executed instantaneously.
This gives quite good, but not perfect, compatibility.
The minimum emulation speed is 1x. If the real computer
isn&rsquo;t fast enough to do 1x, the emulated computer will
still think it is running at the normal number of
instructions per time, but its sense of time will
not match the real time. </p>
<p> The speed setting is only an approximation. Mini vMac
estimates execution time using a table of
average number of cycles for each of the 65536 primary opcodes.
Less or more accurate timing can be selected at
compile time. </p>
<p> Mini vMac will automatically shift down to 1x speed
if there is no activity for a while. This is called the
"AutoSlow" feature. It helps to preserve the battery
on portable computers. </p>
<p> If the user types, or clicks or moves the mouse, or the emulated
computer draws to the screen, or reads or writes to an emulated disk,
that counts as activity that prevents AutoSlow.
AutoSlow takes effect after either 0.5 seconds of emulated computer
time, or 16 seconds worth of emulated instructions executed (usually about 2
seconds at the default 8x speed), which ever is longer. </p>
<p> It is possible that some software will not draw anything to the screen
for longer than that while doing real work, so the AutoSlow feature
can be disabled with the &ldquo;autosloW toggle&rdquo;
in the &lsquo;S&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>.
</p>
<p> Mini vMac finds the smallest rectangle enclosing the area of the
screen that has changed every sixtieth of a second. This makes Mini vMac
more efficient, since transfering images to the real screen tends to be expensive.
If this rectangle is only a single pixel wide and less than 32 pixels tall,
it is assumed to be only a blinking
insertion point, that doesn't prevent AutoSlow. </p>
<p> By default, the emulation stops when the Mini vMac window
is not front most. But the &lsquo;S&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>
includes a &ldquo;run in Background toggle&rdquo;. So you can set
some computation going in Mini vMac and then use other
programs on your computer. You can set Mini vMac to run
in the background with the speed set to &ldquo;All out&rdquo;, but
this isn&rsquo;t recommended, except on a dual processor
computer (Mini vMac can only use one processor). </p>
<p> The emulation can also be stopped even when the Mini vMac
window is front most, by using the &ldquo;Stopped toggle&rdquo;
in the &lsquo;S&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>.
This can be useful, for example, to pause a game. </p>
<p> When in <a href="hardware.html#screen">Full Screen Mode</a>,
with speed set to &ldquo;All out&rdquo;,
some versions of Mini vMac will try to prevent other
programs from running as much as possible, for the smoothest
possible emulation. This is so far implemented in the Mac OS
9 and Windows versions. </p>
<p> <a name="ram"> <b> RAM </b> </a> </p>
<p> A Macintosh Plus can have 1M, 2M, 2.5M, or 4M of &ldquo;RAM&rdquo;
(Random Access Memory). Mini vMac normally emulates a
computer with 4M of RAM, but this can be changed to one of
the other 3 values by recompiling. </p>
<p> <a name="screen"> <b> Screen </b> </a> </p>
<p> The Macintosh Plus has a 512 by 342 pixel black and white
screen, redrawn 60.15 times per second from one of two
&ldquo;screen buffers&rdquo; in RAM. Mini vMac examines the current
screen buffer 60.15 times per second, and compares it to
the previous contents. If something has changed, the current
buffer is drawn to the real screen, minus any unchanged lines
at the top and bottom. If emulation is lagging (below the
speed of a real Mac Plus), it will only redraw a part of the
screen each time. </p>
<p> When Mini vMac launches, it creates a 512 by 342 window to
display the emulated screen. This window is given the same name
as the Application.
(So if you rename the Mini vMac application, when you
launch it the window will have that new name.)
In the X version, if an argument of the form
&ldquo;-n [app_name]&rdquo; is used on the
<a href="control.html#command_line">command line</a>,
Mini vMac will use that name instead. </p>
<p> There is an option to double
the size of the display. This can be easier to read, since
modern screens often have smaller pixels than in the original
Mac Plus (about 1/74th inch). Magnify Mode can be toggled
with the &lsquo;M&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>. </p>
<p> Some computer monitors have trouble displaying the 50 percent
gray pattern commonly used on old Macintoshes.
Magnify Mode helps to alleviate this problem. </p>
<p> Magnify Mode can have performance problems on some
computers with some operating systems.
While a modern computer has no trouble
emulating the processor at ten times the speed of the original
if the screen doesn&rsquo;t need to be redrawn, drawing full screen
video at 60.15 frames a second can be a problem. </p>
<p> Mini vMac has a Full Screen Mode, where the menus and other
programs are hidden, leaving only the emulated screen.
The Magnify option is
turned on automatically if your screen has high enough
resolution (1024 pixels across or greater). Full Screen Mode
can be toggled with the &lsquo;F&rsquo; command of the
<a href="control.html#control_mode">Control Mode</a>. </p>
<p> If the emulated screen is larger than the real screen
while in Full Screen Mode, the emulated screen will be
scrolled to keep the mouse pointer in view. This
may not work well if the software running
on the emulated computer hides the mouse pointer. </p>
<p> Toggling Full Screen Mode affects more than just the
display. The design idea is that when in the regular mode,
Mini vMac should try to behave as much like a normal
cooperative application as possible, while in Full Screen
mode it will try to take over the entire computer as much as
possible. In Full Screen Mode, Mini vMac will try
to monopolize the <a href="hardware.html#processor">processor</a>,
and grab the <a href="hardware.html#keyboard">keyboard</a>.
Also, the <a href="hardware.html#mouse">mouse</a> is emulated
differently in Full Screen Mode. </p>
<p> There is not supposed to be any way to leave Full Screen
mode except for the &lsquo;F&rsquo; command of the control Mode.
However, sometimes there is no way to prevent the operating
system from bringing up some other program. Mini vMac will detect
if it is no longer the active application, and turn off Full
Screen mode. </p>
<p> The X version has a
<a href="control.html#command_line">command line</a>
option, &ldquo;-display [display_name]&rdquo; or
&ldquo;--display [display_name]&rdquo;. XOpenDisplay will be called
with [display_name] as the argument. This apparently
allows you to choose what screen the Mini vMac window
will open onto, even onto a screen of another computer.
This has never been tested. </p>
<p> <a name="keyboard"> <b> Keyboard </b> </a> </p>
<p> The Macintosh Plus has an external keyboard with its own
processor. Mini vMac emulates the protocol used to talk to
this keyboard. This protocol deals with keys being pressed
and released, so Mini vMac looks at the keys being pressed
and released on the real computer, instead of the characters
that the real computer would normally translate them into.
So Mini vMac may not be affected if the real computer is set
to use the Dvorak layout, for example. But you can make the
operating system running within Mini vMac use a Dvorak layout
if you want it.
This low level keyboard emulation has the advantage that all
the Macintosh special characters can be typed in the Windows
and X versions, and that software such as the debuggers
MacsBug and TMON will work. </p>
<p> The keyboard communication protocol will support keys not
present on Macintosh Plus keyboard (&ldquo;Page Down&rdquo; for example).
So Mini vMac goes ahead and transmits the modern keys. One
modern key not present on the Mac Plus is the &lsquo;control&rsquo; key.
Mini vMac provides a way to press the control key of the
emulated computer, even though the control key is being used
for the <a href="control.html#control_mode">Control Mode</a>.
&ldquo;Control-K&rdquo; presses the emulated control key, and
&ldquo;Control-K&rdquo; again releases it. </p>
<p> In the Windows or X versions, the &lsquo;alt&rsquo; key
is used for the emulated command key, and the &lsquo;windows&rsquo; key
(or the &lsquo;application&rsquo; key) is used for the
emulated option key. </p>
<p> In all versions, the F1 key can be used as the emulated option
key and the F2 key can be used as the emulated command key.
This provides a way to type some
key combinations that are intercepted by the OS of
the real computer. For example, F2-Shift-3 will take
a screen shot in the emulated computer, whereas
on a Macintosh, Command-Shift-3 takes a screen shot of
the real computer at the same time. </p>
<p> When you switch away from Mini vMac, all emulated keys
are released (except for the emulated caps lock
and control keys). (You can not see the change then
unless &ldquo;run in Background&rdquo; is on.)
When you switch back to Mini vMac, the emulated keys
remain released, and the real keys held down at
that moment are ignored. </p>
<p> There is an exception to this
when you drag a file onto the Mini vMac window,
so that Command-Option will work to rebuild the desktop
of a disk image. However, the keys that map to command and option
can have special meanings in other operating systems.
(For example, in OS X, clicking on the window of another application
with command and option down will hide all other applications.)
So it usually works better to press command-option right before
dropping, instead of before dragging. </p>
<p> When in <a href="hardware.html#screen">Full Screen Mode</a>, Mini vMac
will try to &ldquo;grab&rdquo; the keyboard, preventing the operating
system from intercepting keys. So in the Windows version,
the &lsquo;windows&rsquo; key can be used as an &lsquo;option&rsquo; key, instead
of popping up the &ldquo;Start&rdquo; menu. And in the
OS X version, Command-Tab won't switch away from Mini vMac.
This is also implemented in the X version. </p>
<p> <a name="mouse"> <b> Mouse </b> </a> </p>
<p> The Macintosh Plus mouse has a ball that turns two rollers
as it moves, one for horizontal and one for vertical. The
rollers are each connected to a disk with a series of small
holes. As the holes pass by a sensor, the Macintosh gets
interrupted. There is a second sensor to allow the Macintosh
to tell which edge of the hole, and so which direction the
mouse is moving. The interrupt handler keeps count of how
the mouse is moved. Then 60.15 times a second, it sees how
far the mouse has moved and updates the cursor on the
screen. </p>
<p> Mini vMac does not emulate the mouse hardware. Instead, it
has two different behaviors depending on whether
<a href="hardware.html#screen">Full Screen Mode</a> is on. </p>
<p> If not in Full Screen Mode, then 60.15 times a second Mini
vMac translates the coordinates of the mouse on the real
computer to coordinates on the emulated screen, and directly
pokes this location into low memory of the emulated computer.
This not very authentic mouse emulation is convenient in
that you can easily move the mouse from the Mini vMac
window, to click in the menu bar or to activate another
program. But this emulation is not good enough for some
programs (such as Crystal Quest, HeartQuest, Slime Invaders,
Arkenoid, MacLanding, Apache Strike, Stepping Out, and
Microsoft Flight Simulator), and for other programs (such as
Dark Castle) it is preferable to constrain the mouse to the
emulated screen, so you don&rsquo;t deactivate Mini vMac by
accident. </p>
<p> When in Full Screen Mode, 60.15 times a second Mini vMac
checks how far the mouse has moved, and pokes this into low
memory of the emulated computer in the same fashion as the
real mouse movement interrupt would do. I don&rsquo;t know of any
program for which this emulation isn&rsquo;t good enough, so there
are no plans for an even lower level emulation of the mouse
movement interrupts. The emulated Macintosh Plus is
initialized to use &ldquo;very slow&rdquo; mouse movement, and the
velocity of the real computer&rsquo;s mouse is passed directly to
the emulated computer. So the mouse in the emulated computer
behaves like the mouse of the real computer. For a more
authentic experience, you can set the real computer&rsquo;s mouse to
slow, and then increase the speed of the emulated computer&rsquo;s
mouse. </p>
<p> The method used to get the velocity (not just absolute
location) of the mouse of the real computer may not work on
all computers. Mini vMac has code that attempts to detect
when this doesn&rsquo;t work, and then switches to the absolute
position mouse emulation. However this check fails to detect
problems when running the Windows version of Mini vMac within
Microsoft Virtual PC with Pointer Integration turned on, and
when running the Mac OS 9 version of Mini vMac in classic
environment of OS X. </p>
<p> Because Mini vMac translates the real mouse coordinates to
the emulated screen, when in
<a href="hardware.html#screen">Magnify Mode</a>
the mouse moves half as fast. </p>
<p> The Macintosh Plus mouse has a single button. In the Windows
version of Mini vMac, if either the left or right mouse
buttons are pressed, the emulated mouse button is pressed.
In the X version mouse buttons 1, 2, and 3 are equivalent. </p>
<p> <a name="sound"> <b> Sound </b> </a> </p>
<p> The Macintosh Plus can play 8 bit sound at 22255 samples per
second from one of two &ldquo;sound buffers&rdquo; in RAM. It can also
toggle sound output at multiples of 1.2766 microseconds to
generate square waves. The sound volume can be set to one of
eight levels. </p>
<p> Sound is so far implemented in the Macintosh, Windows,
and Linux versions. (Emulating sound in Linux requires ALSA;
it is not part of the standard X11 protocol. Mini vMac loads
ALSA dynamically, and so will still run if ALSA is not installed.)
The volume is initially set to maximum. Square
wave sounds are approximated, being forced to fit into the
same 22255 samples per second as other sounds. </p>
<p> Sound in the Windows version will only work on computers that
can play sound at 22255 samples per second, rather than a
more standard value like 22050. If this turns out to a
serious problem, perhaps a future version of Mini vMac could
be made to just play the sound at 22050 samples per second,
on computers that don&rsquo;t support 22255, making all the pitches
off. </p>
<p> If the sound from Mini vMac sounds choppy, you could try
to quit other programs running on the real computer. And
in Mac OS 9 and in Windows, turning on
<a href="hardware.html#screen">Full Screen Mode</a> will make
Mini vMac try to take more of the real computer&rsquo;s time.
To emulate sound properly, Mini vMac needs to get time
each and every sixtieth of a second.
If Mini vMac gets interrupted now and then for a
few sixtieths of a second, then the generated sound will
have gaps, and sound absolutely horrible.
A program that simply plays music doesn&rsquo;t have the
same problem as Mini vMac, because it can generate
the sound well in advance of when it needs to be played.
Mini vMac has to play the sound as soon as possible after
generating it, or the sound will lag behind the rest
of the action on the emulated computer. </p>
<p> <a name="vertical_retrace"> <b> Vertical Retrace </b> </a> </p>
<p> The Macintosh Plus has something called the &ldquo;vertical retrace
interrupt&rdquo;, which occurs once per screen refresh, 60.15 times
per second. Each time it increments a low memory variable
called Ticks. This provides the main way the Macintosh
controls the speed of user interface elements, such as caret
blink time, scrolling speed, and window open/close zooming
speed. </p>
<p> Mini vMac tries to maintain the correct value of 60.15 times
per second, but it enforces a minimum number of instructions
executed per tick. If it notices that the emulation is
lagging, it will try to sacrifice the smoothness of video. </p>
<p> <a name="rtc"> <b> Real Time Clock </b> </a> </p>
<p> The Macintosh Plus has a clock (the RTC, for &ldquo;Real Time
Clock&rdquo;) that counts seconds since midnight January 1, 1904.
This count is a four byte value, so it wraps around after
February 6, 2040 6:28:15 AM. The RTC keeps this count even
when the computer is off, using battery power. The count is
loaded from the RTC into low memory after the computer is
turned on, and most of the time this copy is used and updated
(by incrementing it every second) without referring to the
RTC. </p>
<p> Mini vMac sets the emulated RTC from the real computer&rsquo;s clock
60.15 times a second. This may not affect the count of seconds
kept in low memory, so the time displayed on the emulated
computer can become inaccurate if its once a second interrupt
is missed, such as if the emulation is paused. </p>
<p> One workaround for this problem is to have the Alarm Clock
desk accessory open. This apparently forces the count in low
memory to be reloaded from the RTC. (I don&rsquo;t know why. Maybe
this is a bug in the desk accessory rather than its intended
behavior.) Another alternative is
&ldquo;<a href="extras/clockfix/index.html">ClockFix</a>&rdquo;. </p>
<p> You can set the time of the emulated computer in Mini vMac,
such as by using the control panel or the alarm clock desk
accessory. This doesn&rsquo;t change the time of the real computer;
the emulated RTC is changed, which then keeps a constant
offset from the time of the real computer. </p>
<p> <a name="pram"> <b> Parameter RAM </b> </a> </p>
<p> The Macintosh Plus stores various preference settings,
such as sound volume, in &ldquo;Parameter RAM&rdquo;. This small area
of memory is preserved even when the power is off. </p>
<p> Mini vMac emulates the Parameter RAM, but it does not
preserve the contents. Every time Mini vMac launches, the
Parameter RAM is reset to default values. </p>
<p> These default values are not the same as the default
values of a Macintosh Plus. The sound volume
is set to 7, instead of 3, if sound is emulated,
otherwise it is set to 0. Mouse movement is set
to very slow, so that mouse emulation scheme used
in Full Screen mode will work nicely, with the cursor
moving at the same speed as it does on the real
computer. AppleTalk is set to off, since there
is nobody to talk to.
The Macintosh version will initialize the time zone,
latitude, and longitude from the real computer&rsquo;s information.
The Windows version only initializes the time zone.
I have some code that can find the time zone for the X
version, but I&rsquo;m not sure how portable it is,
so it is disabled. </p>
<p> <a name="scsi"> <b> SCSI </b> </a> </p>
<p> The Macintosh Plus has a SCSI (Small Computer Standard
Interface) port for connecting to peripherals such as
hard drives and scanners. </p>
<p> Mini vMac tries to correctly emulate the behavior of the
SCSI port with no peripherals attached. </p>
<p> <a name="serial"> <b> Serial Ports </b> </a> </p>
<p> The Macintosh Plus has two serial ports for connecting to
peripherals such as modems and printers, and also for
connecting to an AppleTalk network. </p>
<p> Mini vMac tries to correctly emulate the behavior of the
serial ports with no peripherals attached. </p>
<p> <a name="interrupt"> <b> Interrupt Button </b> </a> </p>
<p> The Macintosh Plus can optionally have installed a
&ldquo;Programmers Switch&rdquo;, which has two buttons. The Interrupt
button will invoke any installed debugger. </p>
<p> The &lsquo;I&rsquo; command of the Mini vMac
<a href="control.html#control_mode">Control Mode</a>
presses the Interrupt button of the emulated computer.
This action must be confirmed by typing &lsquo;Y&rsquo;. </p>
<p> <a name="reset"> <b> Reset Button </b> </a> </p>
<p> The optional &ldquo;Programmers Switch&rdquo; for the Macintosh Plus
also has a Reset button. </p>
<p> The &lsquo;R&rsquo; command of the Mini vMac
<a href="control.html#control_mode">Control Mode</a>
presses the Reset button of the emulated computer. If any disk
images are mounted, this action must be confirmed by typing &lsquo;Y&rsquo;.
All unsaved changes are lost. </p>
<p> : </p>
<p> If you find Mini vMac useful, please consider
<a href="https://www.gryphel.com/c/help/index.html">helping the Gryphel Project</A>.
</p>
<a href="https://www.gryphel.com/index.html">
<img src="https://www.gryphel.com/d/gryphel-32.gif" width=32 height=32 border=0
alt="gryphel logo, 1K"
>
</a>
<p> Next - <b><a href="extras/index.html">Extras for Mini vMac</a></b> </p>
<hr>
<div>
<i> <a href="https://www.gryphel.com/index.html">www.gryphel.com</a>/c/<a href="index.html">minivmac</a>/hardware
- <a href="https://www.gryphel.com/c/feedback.html">feedback</a> </i>
<br>
copyright (c) 2015 Paul C. Pratt - last update 3/6/2015
</div>
</body>
</html>