gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 78d52c7c950226d54b76f25604c8b666d00a6c30 parent 7125a65ad1fe5a893fcc6b757873066f9b88fce2 Author: Toxa <untoxa@mail.ru> Date: Tue, 9 Jun 2026 18:32:39 +0300 GB/AP/MegaDuck: put display_off function out of the crt0 Diffstat:
| M | gbdk-lib/libc/targets/sm83/ap/Makefile | 1 | + |
| M | gbdk-lib/libc/targets/sm83/ap/crt0.s | 20 | -------------------- |
| A | gbdk-lib/libc/targets/sm83/display_off.s | 26 | ++++++++++++++++++++++++++ |
| M | gbdk-lib/libc/targets/sm83/duck/Makefile | 1 | + |
| M | gbdk-lib/libc/targets/sm83/duck/crt0.s | 20 | -------------------- |
| M | gbdk-lib/libc/targets/sm83/gb/Makefile | 1 | + |
| M | gbdk-lib/libc/targets/sm83/gb/crt0.s | 20 | -------------------- |
7 files changed, 29 insertions(+), 60 deletions(-)
diff --git a/gbdk-lib/libc/targets/sm83/ap/Makefile b/gbdk-lib/libc/targets/sm83/ap/Makefile @@ -38,6 +38,7 @@ ASSRC = cgb.s cgb_palettes.s cgb_compat.s \ hblankcpy.s \ heap.s \ sfr.s \ + display_off.s \ crt0.s CRT0 = crt0.s diff --git a/gbdk-lib/libc/targets/sm83/ap/crt0.s b/gbdk-lib/libc/targets/sm83/ap/crt0.s @@ -497,23 +497,3 @@ gsinit:: JR NZ,1$ 4$: RET - -.display_off:: -_display_off:: - ;; Check if the screen is on - LDH A,(.LCDC) - AND #LCDCF_ON - RET Z ; Return if screen is off -1$: ; We wait for the *NEXT* VBL - LDH A,(.LY) - CP #0x92 ; Smaller than or equal to 0x91? - JR NC,1$ ; Loop until smaller than or equal to 0x91 -2$: - LDH A,(.LY) - CP #0x91 ; Bigger than 0x90? - JR C,2$ ; Loop until bigger than 0x90 - - LDH A,(.LCDC) - AND #~LCDCF_ON - LDH (.LCDC),A ; Turn off screen - RET diff --git a/gbdk-lib/libc/targets/sm83/display_off.s b/gbdk-lib/libc/targets/sm83/display_off.s @@ -0,0 +1,26 @@ + .include "global.s" + + .title "display off" + .module Display + + .area _HOME + +.display_off:: +_display_off:: + ;; Check if the screen is on + LDH A, (rLCDC) + AND #LCDCF_ON + RET Z ; Return if screen is off +1$: ; We wait for the *NEXT* VBL + LDH A, (rLY) + CP #0x92 ; Smaller than or equal to 0x91? + JR NC,1$ ; Loop until smaller than or equal to 0x91 +2$: + LDH A, (rLY) + CP #0x91 ; Bigger than 0x90? + JR C, 2$ ; Loop until bigger than 0x90 + + LDH A, (rLCDC) + AND #~LCDCF_ON + LDH (rLCDC),A ; Turn off screen + RET diff --git a/gbdk-lib/libc/targets/sm83/duck/Makefile b/gbdk-lib/libc/targets/sm83/duck/Makefile @@ -39,6 +39,7 @@ ASSRC = cgb.s cgb_palettes.s cgb_compat.s \ hblankcpy.s \ heap.s \ sfr.s \ + display_off.s \ crt0.s CRT0 = crt0.s diff --git a/gbdk-lib/libc/targets/sm83/duck/crt0.s b/gbdk-lib/libc/targets/sm83/duck/crt0.s @@ -438,23 +438,3 @@ gsinit:: JR NZ,1$ 4$: RET - -.display_off:: -_display_off:: - ;; Check if the screen is on - LDH A,(.LCDC) - AND #LCDCF_ON - RET Z ; Return if screen is off -1$: ; We wait for the *NEXT* VBL - LDH A,(.LY) - CP #0x92 ; Smaller than or equal to 0x91? - JR NC,1$ ; Loop until smaller than or equal to 0x91 -2$: - LDH A,(.LY) - CP #0x91 ; Bigger than 0x90? - JR C,2$ ; Loop until bigger than 0x90 - - LDH A,(.LCDC) - AND #~LCDCF_ON - LDH (.LCDC),A ; Turn off screen - RET diff --git a/gbdk-lib/libc/targets/sm83/gb/Makefile b/gbdk-lib/libc/targets/sm83/gb/Makefile @@ -38,6 +38,7 @@ ASSRC = cgb.s cgb_palettes.s cgb_compat.s \ hblankcpy.s \ heap.s \ sfr.s \ + display_off.s \ crt0.s CRT0 = crt0.s diff --git a/gbdk-lib/libc/targets/sm83/gb/crt0.s b/gbdk-lib/libc/targets/sm83/gb/crt0.s @@ -507,23 +507,3 @@ gsinit:: JR NZ, 1$ 4$: RET - -.display_off:: -_display_off:: - ;; Check if the screen is on - LDH A, (rLCDC) - AND #LCDCF_ON - RET Z ; Return if screen is off -1$: ; We wait for the *NEXT* VBL - LDH A, (rLY) - CP #0x92 ; Smaller than or equal to 0x91? - JR NC,1$ ; Loop until smaller than or equal to 0x91 -2$: - LDH A, (rLY) - CP #0x91 ; Bigger than 0x90? - JR C, 2$ ; Loop until bigger than 0x90 - - LDH A, (rLCDC) - AND #~LCDCF_ON - LDH (rLCDC),A ; Turn off screen - 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.