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.11.5 callMacContext TOS This serves to produce the required Macintosh environment for calling any MacOS routines. The routine must be called in Mac-mode and in supervisor-mode and not from an interrupt. For this one should pass on the stack the address of the routine that is to be called as a subroutine in the Mac context. The normal user stack of MagiC Mac is used for the called routine; in addition the register a5 is loaded with macA5 and if virtual memory is active, a switch is made to user-mode. As this function alters the stack, it is not possible to pass parameters via the stack. The registers d0-d2/ a0/a1/a5/a7 are altered both at the call and also at the return of the subroutine (although a5/a7 after return from 'callMacContext' have the same values as before the call). The other registers are not altered and can be used for parameter passing and returns. The execution of this subroutine implicitly brings calls of intrLock and intrUnlock with it, meaning that during this no Mac-tasks will be processed, even if one switches into Atari-mode occasionally. To allow processing of Mac-tasks despite of this, one can call the function 'giveTimeToMac'. See also: The MagiC Mac cookie Cookie and XBRA list