git.y1.nz

gbdk-2020

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

gbdk-lib/examples/sms/pause_button/src/pause.c

      1 #include <gbdk/platform.h>
      2 #include <stdio.h>
      3 #include <stdbool.h>
      4 
      5 volatile bool PauseRequested = false; 
      6 
      7 void NMI_ISR (void) CRITICAL INTERRUPT {   // the function name MUST be "NMI_ISR"
      8     PauseRequested = true;
      9 }
     10 
     11 void main(void) {
     12     puts("Press PAUSE button");
     13     while(1) {
     14         if (PauseRequested) {
     15             puts("PAUSED! press A to unpause");
     16             waitpad(J_A);
     17             puts("UNPAUSED");            
     18             PauseRequested = false;
     19         }
     20         wait_vbl_done();
     21     } 
     22 }

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