// helloBeep.c - simplest possible GS/OS app.  Three SysBeep calls then
// exit.  Verifies the OMF + Loader path: if the IIgs makes three beeps,
// the app launched, ran, and returned cleanly.
//
// No toolbox startup is needed - the Loader has already done TLStartUp
// + MMStartUp for us, and SysBeep is a Misc Tools call that works
// without additional setup.
//
// Build with: bash demos/build.sh helloBeep
// Run with:   bash scripts/runViaFinder.sh helloBeep.omf --check 0x70=0x42

#include "iigs/toolbox.h"


int main(void) {
    SysBeep();
    SysBeep();
    SysBeep();
    *(volatile unsigned char *)0x70 = 0x99;   // for headless verify
    // Brief linger so snapshot tools can capture the post-Finder state
    // before we exit (otherwise the screen snaps in the middle of GS/OS
    // tearing the launcher state down).
    for (volatile unsigned long s = 0; s < 600000UL; s++) { }
    return 0;
}
