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.9 XCMDs under MagiC Mac TOS XCMDs are small external code modules for Macintosh applications. As a rule these can be created fairly easily with the development tools under MacOS (e.g. with Metrowerks' CodeWarrior or Symantec C). As of version 1.2.2 MagiC Mac also permits the simple use of such code modules by programs that run under MagiC. This greatly simplifies the development of programs or drivers that want to use the Macintosh functions, as these portions can then be created with a Macintosh compiler, rather than having to recreate the interfaces laboriously under an Atari development system. An example of such a XCMD can be found in the 'Demo XCMD' folder of the original MagiC Mac documentation. The created module can then just be placed in the MagiC Mac XCMDs folder. This folder must lie in the same directory as the MagiC Mac application. At the launch of MagiC Mac this folder is searched through for files with the filetype 'xCmd' and the XCMD resources contained in it loaded and executed. These XCMDs can then register themselves with MagiC Mac and so become available for MagiC programs. An application is shown by the Pure-C program in the 'MGMC_API' folder of the original MagiC Mac documentation. This shows how easily an installed XCMD can be opened and called. The functions offered here by the cookie (xcmdMgrPtr) go automatically into the supervisor-mode if required and switch to the Mac environment (with callMacContext), and also control parameter passing. The call of the XCMD functions in this way is therefore permitted only when the Atari-mode is active and if the call is not made from an interrupt. If the XCMD functions are to be called from interrupts or in Mac-mode, one can use 'xcmdMgrPtr->getAdr' to get the entry address of the XCMD dispatcher and then jump to it directly. Further information for XCMDs can be found in the source text 'Demo XCMD.c' of the original MagiC Mac documentation.