GB: fix the crash_handler

This commit is contained in:
Toxa
2026-01-04 00:21:34 +03:00
parent 04f758bba4
commit a51b4e04cc
4 changed files with 11 additions and 7 deletions

View File

@@ -15,11 +15,15 @@
#ifndef __CRASH_HANDLER_INCLUDE
#define __CRASH_HANDLER_INCLUDE
#include <types.h>
/** Display the crash dump screen.
See the intro for this file for more details.
*/
void __HandleCrash(void);
static void * __CRASH_HANDLER_INIT = &__HandleCrash;
#if defined(__SDCC)
static void __CRASH_HANDLER_INIT__(void) __naked { __asm__(".globl ___HandleCrash"); }
#endif
#endif

View File

@@ -48,9 +48,9 @@ ___HandleCrash::
ld a, #LCDCF_ON ; LCDCF_ON Make sure the LCD is turned on to avoid waiting infinitely
ldh (.LCDC), a
ld a, #IEF_VBLANK ; IEF_VBLANK
ld (.IE), a
ldh (.IE), a
ld a, #0 ; `xor a` would overwrite flags
ld (.IF), a ; No point in backing up that register, it's always changing
ldh (.IF), a ; No point in backing up that register, it's always changing
halt ; With interrupts disabled, this will exit when `IE & IF != 0`
nop ; Handle hardware bug if it becomes true *before* starting to execute the instruction (1-cycle window)

View File

@@ -43,9 +43,9 @@ ___HandleCrash::
ld a, #LCDCF_ON ; LCDCF_ON Make sure the LCD is turned on to avoid waiting infinitely
ldh (.LCDC), a
ld a, #IEF_VBLANK ; IEF_VBLANK
ld (.IE), a
ldh (.IE), a
ld a, #0 ; `xor a` would overwrite flags
ld (.IF), a ; No point in backing up that register, it's always changing
ldh (.IF), a ; No point in backing up that register, it's always changing
halt ; With interrupts disabled, this will exit when `IE & IF != 0`
nop ; Handle hardware bug if it becomes true *before* starting to execute the instruction (1-cycle window)

View File

@@ -48,9 +48,9 @@ ___HandleCrash::
ld a, #LCDCF_ON ; LCDCF_ON Make sure the LCD is turned on to avoid waiting infinitely
ldh (.LCDC), a
ld a, #IEF_VBLANK ; IEF_VBLANK
ld (.IE), a
ldh (.IE), a
ld a, #0 ; `xor a` would overwrite flags
ld (.IF), a ; No point in backing up that register, it's always changing
ldh (.IF), a ; No point in backing up that register, it's always changing
halt ; With interrupts disabled, this will exit when `IE & IF != 0`
nop ; Handle hardware bug if it becomes true *before* starting to execute the instruction (1-cycle window)