git.y1.nz

gbdk-2020

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

gbdk-lib/libc/targets/sm83/display_off.s

      1 	.include	"global.s"
      2 
      3 	.title	"display off"
      4 	.module	Display
      5 
      6 	.area	_HOME
      7 
      8 .display_off::
      9 _display_off::
     10         ;; Check if the screen is on
     11         LDH     A, (rLCDC)
     12         AND     #LCDCF_ON
     13         RET     Z                    ; Return if screen is off
     14 1$:                                  ; We wait for the *NEXT* VBL
     15         LDH     A, (rLY)
     16         CP      #0x92                ; Smaller than or equal to 0x91?
     17         JR      NC,1$                ; Loop until smaller than or equal to 0x91
     18 2$:
     19         LDH     A, (rLY)
     20         CP      #0x91                ; Bigger than 0x90?
     21         JR      C, 2$                ; Loop until bigger than 0x90
     22 
     23         LDH     A, (rLCDC)
     24         AND     #~LCDCF_ON
     25         LDH     (rLCDC),A            ; Turn off screen
     26         RET

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