System
System is the process-control class. At present it offers a single helper, exit, which terminates the program and returns control to DOS.
#import <System.xt>Methods
Section titled “Methods”static void exit(i16 value);Terminates the program by jumping through the Atari DOSVEC at $0A/$0B. The 16-bit exit value is stored at $02FD/$02FE (otherwise-unused OS page-2 bytes) for any caller that cares. DOS itself ignores the exit value — it’s there for cooperating callers, not as a process-status mechanism the OS understands.
void main(void){ if (load("data") == 0) { Stdio.print("missing data file\n"); System.exit(1); } // …normal path… System.exit(0);}If you don’t call exit, main returning to its caller has the same effect as exit(0) on default-xtc builds: the runtime emits an RTS back into DOS. The difference is that exit works from anywhere in the program — you don’t have to unwind back to main.
The -Q loop command-line switch changes the post-main behaviour to an infinite loop instead of an RTS; in that mode, System.exit(...) is the only way to actually return to DOS.
Platform notes
Section titled “Platform notes”System is also implemented for the C64 under support/commodore/lib/System.xt, with the same signature. The C64 version returns through the BASIC warm-start vector instead of Atari’s DOSVEC.