•  Back 
  •  MagiC Mac specifics 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : TOS - The Operating System
Author      : 
Version     : tos.hyp (December 19, 2008)
Subject     : Programmieren/Atari
Nodes       : 3010
Index Size  : 93790
HCP-Version : 5
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Title
@help       : 
@options    : +g -i -s +x +zz -t4
@width      : 70
View Ref-File12.1.1  General remarks about MagiC Mac                            TOS

The core of the 'emulation' of the Atari environment on the Macintosh 
lies in the reprogramming of the PMMU. Both Atari as well as Macintosh 
programs assume that they will find certain variables (the so-called 
system variables) in the lowest 2 kB of the address space. However, 
when an Atari program is running it expects other values there than, 
say, the Mac operating system. The so-called kernel of MagiC Mac makes 
sure that - depending on whether a Mac or an Atari routine is running 
at the time - suitable system variables are present in that lower 
address space. This is done with appropriate programming of the PMMU, 
a coprocessor for memory management.

So there are two MMU modes: The Mac- and the Atari-mode. By means of 
two routines one can switch back and forth between them. Starting from 
taking the Mac-mode as the normal mode, the following changes occur 
when switching to the Atari-mode:

   . A memory block that was allocated somewhere on the Macintosh heap 
     is inserted from address $0 into the Atari address space. This 
     block is between 4 and 32 kB long and is guaranteed to hold only 
     the exception vector table and the documented system variables.

   . Address space from $00FF8000 to $00FFFFFF (and correspondingly 
     $FFFF8000 to $FFFFFFFF) is blanked out. On the Atari this is the 
     I/O address space, which is not normally available on the 
     Macintosh (which at most has RAM there).

     So that programs do not erroneously address this space as RAM, if 
     the Macintosh has some there, this blanking out leads to a bus 
     error at each access. It is however possible that special Atari- 
     compatible hardware has been installed in the Macintosh, 
     whereupon this hardware then blends in this address space at the 
     relevant positions. This means: A program that recognizes that it 
     is running under MagiC on the Mac should not automatically assume 
     that no Atari hardware is present in the I/O area, but should 
     continue to check with a test access (by diversion of the bus 
     error vector) whether access to the module is possible.

   . RAM that belongs neither to the TPA of MagiC, nor to the MagiC OS 
     or the kernel data and routines is not present in the Atari 
     address space, i.e. accesses outside the area specially reserved 
     for Atari programs lead to a bus error. This protects other 
     Macintosh applications better from faulty Atari programs. This 
     protection however works only with 68k machines, not with 
     PowerPCs!

See also: Program launch and TPA