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.10 Cooperation between MagiC and the MacOS TOS MagiC Mac hooks itself directly into all interrupt vectors that the Macintosh uses. If MagiC is running and a hardware interrupt occurs, MagiC Mac switches the MMU back into the normal Macintosh-mode. At the end of the IntrRoutine one will be switched back into the Atari-mode and the programs running under MagiC will continue. As long as the Mac-mode is active, MagiC Mac does not meddle further with the Intr- processing, but does so only when the Atari-mode is active. Whenever a switch is made from the Mac-mode back to the Atari-mode, a check is made whether a given amount of time has passed (measured in ticks; a tick is around 1/60s), in order to then perform periodic tasks. These tasks are called Mac-tasks here. Mac-tasks perform the following, amongst others: . Poll the Mac events (functions GetOSEvent or WaitNextEvent) . Evaluate [Command]-[Q] and [Command]-[W] . Evaluate external Apple events, e.g. Suspend/Resume (switch MagiC Mac into the background) and terminated externals . Cede CPU time to other Mac applications (with WaitNextEvent) The decision whether to use GetOSEvent or WaitNextEvent (WNE) for polling the events can be set via 'Preferences' and also by a cookie function. Only if WNE is used will CPU time be allocated to other Mac applications as well. Mac-tasks can be executed only if it is certain that no other MacOS function is being processed at the time, since the MacOS is not reentrant. Mac-tasks are therefore performed only if all of the following conditions apply: . After the interruption (an interrupt or a modeAtari call) the Atari-mode will be active and the interrupt-level mask is zero, i.e. there is no other interrupt being handled (to ensure this, Intr-handlers that switch from Mac-mode into the Atari-mode have to use intrLock correctly, see below) . No routine in the Mac-context is being executed at the time (callMacContext) . MagiC Mac is not in the process of terminating itself