git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 94793354ab49de1004dcabb396281097660b061d
parent 2de8c0dc5b41d44db7a8429d41134b3f7cc9c1f9
Author: Michel Iwaniec <46843052+michel-iwaniec@users.noreply.github.com>
Date:   Wed, 16 Oct 2024 00:57:33 +0100

NES: Add reset function for compatibility (#719)


Diffstat:
Mgbdk-lib/include/nes/nes.h15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/gbdk-lib/include/nes/nes.h b/gbdk-lib/include/nes/nes.h @@ -467,6 +467,21 @@ inline void disable_interrupts(void) { __asm__("sei"); } +/** Performs a soft reset. + + For the Game Boy and related it does this by jumping to address 0x0150 + which is in crt0.s (the c-runtime that executes before main() is called). + + This performs various startup steps such as resetting the stack, + clearing WRAM and OAM, resetting initialized variables and some + display registers (scroll, window, LCDC), etc. + + This is not the same a hard power reset. +*/ +inline void reset(void) { + __asm__("jmp [0xFFFC]"); +} + /** Waits for the vertical blank interrupt. This is often used in main loops to idle the CPU

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.