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.19 stackLoad TOS stackLoad activates a new CPU stack (a7). This is required when one wants to call a routine in the Atari context from a Mac context during which an arbitrary CPU stack is active, i.e. before a mode-change with 'modeAtari' has been performed. A switch to another stack is necessary then, because the memory area that a7 is currently using may be blanked out through the switch to Atari-mode, which could lead to the CPU freezing (see also the relevant parts of 'Exceptions under MagiC Mac'). Instead of simply placing the a7 onto the new stack, one should use 'stackLoad'. Basically this function does the same thing, but it also informs the MacOS about this (by setting some global variables). As a result the MacOS does not check a7 periodically in the meantime. The reason is because otherwise, with certain MacOS versions (prior to 7.5 and again as of 7.5.3), the MacOS would issue a stack overflow message even though this has not occurred. If virtual memory is active, this call also prevents this stack area being offloaded, which could result in the computer freezing in some circumstances. Usage: In a0 one should pass a pointer to a MemArea structure (see above). This must contain a pointer to the start (lowest address) of the stack as well as its length (respect 'minStackSize'!). The routine will destroy the registers a0 and a1 and sets a7 to the value of <MemArea.start+MemArea.length>.