git.y1.nz

gbdk-2020

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

commit 30c17a79f4b268447705522be669a90159662ca4
parent a710ea7ebd856cce1569559da52a20adc6f69223
Author: Toxa <untoxa@mail.ru>
Date:   Wed,  1 Sep 2021 22:50:38 +0300

rename cgb_compatibility() to set_default_palette(), old function marked obsolete

Diffstat:
Mgbdk-lib/examples/ap/bgb_debug/bgb_debug.c4++--
Mgbdk-lib/examples/ap/dscan/dscan.c4++--
Mgbdk-lib/examples/cross-platform/banks_autobank/src/banks.c2+-
Mgbdk-lib/examples/gb/bgb_debug/bgb_debug.c4++--
Mgbdk-lib/examples/gb/dscan/dscan.c4++--
Mgbdk-lib/include/gb/cgb.h6+++++-
Mgbdk-lib/include/sms/sms.h2+-
Mgbdk-lib/libc/targets/gbz80/cgb_compat.s3++-
Mgbdk-lib/libc/targets/z80/crt0.s13++-----------
Mgbdk-lib/libc/targets/z80/gg/Makefile2+-
Agbdk-lib/libc/targets/z80/set_palette.s23+++++++++++++++++++++++
Mgbdk-lib/libc/targets/z80/sms/Makefile2+-
12 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/gbdk-lib/examples/ap/bgb_debug/bgb_debug.c b/gbdk-lib/examples/ap/bgb_debug/bgb_debug.c @@ -61,13 +61,13 @@ int main(void) // check for a CGB and turn on Double Speed mode). // // Check and only run this test if on CGB hardware - if (_cpu == CGB_TYPE) { + if (DEVICE_SUPPORTS_COLOR) { // Set CGB into double speed mode // (Requires passing -Wm-yc or -Wm-yC with Lcc during build time) cpu_fast(); // Set some default DMG styled colors in the CGB Palette - cgb_compatibility(); + set_default_palette(); // In CGB Double Speed mode, you don't have to // divide by 2 to get the cycle count. diff --git a/gbdk-lib/examples/ap/dscan/dscan.c b/gbdk-lib/examples/ap/dscan/dscan.c @@ -118,7 +118,7 @@ uint8_t k_right, k_left; void set_sprite_attrb( uint8_t nb, uint8_t tile ) { - if( _cpu==CGB_TYPE ) { + if(DEVICE_SUPPORTS_COLOR) { set_sprite_prop( nb, tile ); } } @@ -217,7 +217,7 @@ void init_screen() { uint8_t n; - if( _cpu==CGB_TYPE ) { + if(DEVICE_SUPPORTS_COLOR) { /* Transfer color palette */ set_bkg_palette( 0, 1, &bkg_p[0] ); set_bkg_palette( 1, 1, &bkg_p[4] ); diff --git a/gbdk-lib/examples/cross-platform/banks_autobank/src/banks.c b/gbdk-lib/examples/cross-platform/banks_autobank/src/banks.c @@ -46,7 +46,7 @@ void bank_fixed(void) NONBANKED void main(void) { - cgb_compatibility(); + set_default_palette(); printf("Program Start...\n\n"); // Call the functions, unbanked first then the banked ones diff --git a/gbdk-lib/examples/gb/bgb_debug/bgb_debug.c b/gbdk-lib/examples/gb/bgb_debug/bgb_debug.c @@ -61,13 +61,13 @@ int main(void) // check for a CGB and turn on Double Speed mode). // // Check and only run this test if on CGB hardware - if (_cpu == CGB_TYPE) { + if (DEVICE_SUPPORTS_COLOR) { // Set CGB into double speed mode // (Requires passing -Wm-yc or -Wm-yC with Lcc during build time) cpu_fast(); // Set some default DMG styled colors in the CGB Palette - cgb_compatibility(); + set_default_palette(); // In CGB Double Speed mode, you don't have to // divide by 2 to get the cycle count. diff --git a/gbdk-lib/examples/gb/dscan/dscan.c b/gbdk-lib/examples/gb/dscan/dscan.c @@ -118,7 +118,7 @@ uint8_t k_right, k_left; void set_sprite_attrb( uint8_t nb, uint8_t tile ) { - if( _cpu==CGB_TYPE ) { + if(DEVICE_SUPPORTS_COLOR) { set_sprite_prop( nb, tile ); } } @@ -217,7 +217,7 @@ void init_screen() { uint8_t n; - if( _cpu==CGB_TYPE ) { + if(DEVICE_SUPPORTS_COLOR) { /* Transfer color palette */ set_bkg_palette( 0, 1, &bkg_p[0] ); set_bkg_palette( 1, 1, &bkg_p[4] ); diff --git a/gbdk-lib/include/gb/cgb.h b/gbdk-lib/include/gb/cgb.h @@ -150,7 +150,7 @@ void cpu_slow(void); */ void cpu_fast(void); -/** Set defaults compatible with the normal GameBoy models. +/** Set palette, compatible with the DMG/GBP. The default/first CGB palettes for sprites and backgrounds are set to a similar default appearance as on the DMG/Pocket/SGB models. @@ -158,6 +158,10 @@ void cpu_fast(void); \li You can check to see if @ref _cpu == @ref CGB_TYPE before using this function. */ +void set_default_palette(void); + +/** This function is obsolete + */ void cgb_compatibility(void); #endif /* _CGB_H */ diff --git a/gbdk-lib/include/sms/sms.h b/gbdk-lib/include/sms/sms.h @@ -411,7 +411,7 @@ void joypad_ex(joypads_t * joypads) __z88dk_fastcall __preserves_regs(iyh, iyl); #error Unrecognized port #endif -inline void cgb_compatibility() {} +void set_default_palette(void); inline void cpu_fast() {} #define set_bkg_palette_entry set_palette_entry diff --git a/gbdk-lib/libc/targets/gbz80/cgb_compat.s b/gbdk-lib/libc/targets/gbz80/cgb_compat.s @@ -7,7 +7,8 @@ .area _CODE -_cgb_compatibility:: ; Banked +_cgb_compatibility:: +_set_default_palette:: LD HL, #1$ PUSH HL LD HL, #0x0100 diff --git a/gbdk-lib/libc/targets/z80/crt0.s b/gbdk-lib/libc/targets/z80/crt0.s @@ -4,7 +4,7 @@ .module Runtime .area _HEADER (ABS) - .globl .CRT_DEFAULT_PALETTE, _set_palette + .globl _set_default_palette .org 0x00 ; Reset 00h di ; disable interrupt @@ -98,16 +98,7 @@ _WRITE_VDP_DATA:: 4$: ld (#__SYSTEM), a - ld hl, #.CRT_DEFAULT_PALETTE - push hl - ld hl, #0x0100 - push hl - call _set_palette - ld hl, #.CRT_DEFAULT_PALETTE - push hl - ld hl, #0x0101 - push hl - call _set_palette + call _set_default_palette ei ; re-enable interrupts before going to main() call _main diff --git a/gbdk-lib/libc/targets/z80/gg/Makefile b/gbdk-lib/libc/targets/z80/gg/Makefile @@ -21,7 +21,7 @@ ASSRC = set_interrupts.s \ font.s \ putchar.s \ scroll.s cls.s gotoxy.s \ - palette.s \ + palette.s set_palette.s \ pad.s pad_ex.s \ int.s nmi.s \ mode.s \ diff --git a/gbdk-lib/libc/targets/z80/set_palette.s b/gbdk-lib/libc/targets/z80/set_palette.s @@ -0,0 +1,23 @@ + ;; SMS palette routines + + .include "global.s" + + .title "CRAM SMS Palettes" + .module CRAMUtils + + .globl .CRT_DEFAULT_PALETTE, _set_palette + + .area _HOME + +_set_default_palette:: + ld hl, #.CRT_DEFAULT_PALETTE + push hl + ld hl, #0x0100 + push hl + call _set_palette + ld hl, #.CRT_DEFAULT_PALETTE + push hl + ld hl, #0x0101 + push hl + call _set_palette + ret diff --git a/gbdk-lib/libc/targets/z80/sms/Makefile b/gbdk-lib/libc/targets/z80/sms/Makefile @@ -21,7 +21,7 @@ ASSRC = set_interrupts.s \ font.s \ putchar.s \ scroll.s cls.s gotoxy.s \ - palette.s \ + palette.s set_palette.s \ pad.s pad_ex.s \ int.s nmi.s \ mode.s \

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