#include <PSX/GPU/gpu_primitives.hpp>
#include <stdio.hpp>

extern "C" uint32_t __bss_start;
extern "C" uint32_t __bss_end;
extern void main();

namespace JabyEngine {
    static void clear_bss() {
        uint32_t* bss_adr = &__bss_start;
        while(bss_adr < &__bss_end) {
            *bss_adr = 0;
            bss_adr++;
        }
    }

    // Executes the game
    void __no_return run() {
        clear_bss();

        main();
        printf("Stop!!\n");
        while(true);
    }
}