39 lines
964 B
C++

/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/memops.hpp>
#include <nostalgia/core/core.hpp>
#include <nostalgia/core/gfx.hpp>
#include "addresses.hpp"
#include "bios.hpp"
#include "gfx.hpp"
namespace ox {
using namespace nostalgia::core;
void panic(const char*, int, const char *msg, const ox::Error &err) noexcept {
oxIgnoreError(initGfx(nullptr));
oxIgnoreError(initConsole(nullptr));
// enable only BG 0
REG_DISPCTL = DispCtl_Bg0;
clearTileLayer(nullptr, 0);
ox::BString<23> serr = "Error code: ";
serr += static_cast<int64_t>(err);
puts(nullptr, 32 + 1, 1, "SADNESS...");
puts(nullptr, 32 + 1, 4, "UNEXPECTED STATE:");
puts(nullptr, 32 + 2, 6, msg);
if (err) {
puts(nullptr, 32 + 2, 8, serr.c_str());
}
puts(nullptr, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
// disable all interrupt handling and IntrWait on no interrupts
REG_IE = 0;
nostalgia_core_intrwait(0, 0);
}
}