1.5 Compiling a PSYX
Because PSYXs compiled into the PsyScope application use the A5 register for their global variables, while stand-alone PSYXs use the A4 register, it is frequently useful to define a macro that indicates whether the code is being compile for testing or stand-alone use. Most of the given examples use have the following
#define testing 1 // set to 1 for testing, 0 for stand-aloneThis macro can then be used in such places as VBL tasks and asynchronous i/o completion routines to determine whether the code needs to set up A4 or A5. For example:
static pascal void myVBLTask() { #if testing SetUpA5() #else SetUpA4() #endif /* do my VBL stuff using globals here */ #if testing RestoreA5() #else RestoreA4() #endif }
Generated with CERN WebMaker