git.y1.nz

gbdk-2020

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

commit 0e4decb36c261b97e25e69b91d9b70c446adc1a4
parent fe8ff4cb8af9963cd0f69542a2dc5f5a94668af8
Author: Toxa <untoxa@mail.ru>
Date:   Mon, 25 Oct 2021 23:58:42 +0300

logo example: dmg does not support map attributtes or flipping

Diffstat:
Agbdk-lib/examples/cross-platform/logo/Makefile90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Agbdk-lib/examples/cross-platform/logo/Makefile.targets50++++++++++++++++++++++++++++++++++++++++++++++++++
Agbdk-lib/examples/cross-platform/logo/res/nintendo/logo.png0
Agbdk-lib/examples/cross-platform/logo/res/sega/logo.png0
Agbdk-lib/examples/cross-platform/logo/src/main.c14++++++++++++++
5 files changed, 154 insertions(+), 0 deletions(-)

diff --git a/gbdk-lib/examples/cross-platform/logo/Makefile b/gbdk-lib/examples/cross-platform/logo/Makefile @@ -0,0 +1,90 @@ +# If you move this project you can change the directory +# to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/" +GBDK_HOME = ../../../ +LCC = $(GBDK_HOME)bin/lcc +PNG2ASSETS = $(GBDK_HOME)bin/png2asset + +# Set platforms to build here, spaced separated. (These are in the separate Makefile.targets) +# They can also be built/cleaned individually: "make gg" and "make gg-clean" +# Possible are: gb gbc pocket megaduck sms gg +TARGETS=gb pocket megaduck sms gg + +# Configure platform specific LCC flags here: +LCCFLAGS_gb = -Wl-yt0x1B # Set an MBC for banking (1B-ROM+MBC5+RAM+BATT) +LCCFLAGS_pocket = -Wl-yt0x1B # Usually the same as required for .gb +LCCFLAGS_duck = -Wl-yt0x1B # Usually the same as required for .gb +LCCFLAGS_gbc = -Wl-yt0x1B -Wm-yc # Same as .gb with: -Wm-yc (gb & gbc) or Wm-yC (gbc exclusive) +LCCFLAGS_sms = +LCCFLAGS_gg = + +LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags + +LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags +# LCCFLAGS += -debug # Uncomment to enable debug output +# LCCFLAGS += -v # Uncomment for lcc verbose output + +RESFLAGS_nintendo = -map -noflip -bpp 2 -max_palettes 1 -pack_mode gb +RESFLAGS_sega = -map -use_map_attributes -bpp 4 -max_palettes 2 -pack_mode sms + +RESFLAGS += $(RESFLAGS_$(TYP)) + +CFLAGS += -Wf-I$(OBJDIR) + +# You can set the name of the ROM file here +PROJECTNAME = logo + +# EXT?=gb # Only sets extension to default (game boy .gb) if not populated +SRCDIR = src +OBJDIR = obj/$(EXT) +RESDIR = res/$(TYP) +BINDIR = build/$(EXT) +MKDIRS = $(OBJDIR) $(BINDIR) # See bottom of Makefile for directory auto-creation + +BINS = $(OBJDIR)/$(PROJECTNAME).$(EXT) +IMAGES = $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.png))) +CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) +ASMSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s))) +OBJS = $(IMAGES:%.png=$(OBJDIR)/%.c) $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o) + +# Builds all targets sequentially +all: $(TARGETS) + +$(OBJDIR)/%.c: $(RESDIR)/%.png + $(PNG2ASSETS) $< $(RESFLAGS) -c $@ + +# Compile .c files in "src/" to .o object files +$(OBJDIR)/%.o: $(SRCDIR)/%.c + $(LCC) $(CFLAGS) -c -o $@ $< + +# Compile .c files in "res/" to .o object files +$(OBJDIR)/%.o: $(RESDIR)/%.c + $(LCC) $(CFLAGS) -c -o $@ $< + +# Compile .s assembly files in "src/" to .o object files +$(OBJDIR)/%.o: $(SRCDIR)/%.s + $(LCC) $(CFLAGS) -c -o $@ $< + +# If needed, compile .c files i n"src/" to .s assembly files +# (not required if .c is compiled directly to .o) +$(OBJDIR)/%.s: $(SRCDIR)/%.c + $(LCC) $(CFLAGS) -S -o $@ $< + +# Link the compiled object files into a .gb ROM file +$(BINS): $(OBJS) + $(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS) + +clean: + @echo Cleaning + @for target in $(TARGETS); do \ + $(MAKE) $$target-clean; \ + done + +# Include available build targets +include Makefile.targets + + +# create necessary directories after Makefile is parsed but before build +# info prevents the command from being pasted into the makefile +ifneq ($(strip $(EXT)),) # Only make the directories if EXT has been set by a target +$(info $(shell mkdir -p $(MKDIRS))) +endif diff --git a/gbdk-lib/examples/cross-platform/logo/Makefile.targets b/gbdk-lib/examples/cross-platform/logo/Makefile.targets @@ -0,0 +1,50 @@ + +# Platform specific flags for compiling (only populate if they're both present) +ifneq ($(strip $(PORT)),) +ifneq ($(strip $(PLAT)),) +CFLAGS += -m$(PORT):$(PLAT) +endif +endif + +# Called by the individual targets below to build a ROM +build-target: $(BINS) + +clean-target: + rm -rf $(OBJDIR) + rm -rf $(BINDIR) + +gb-clean: + ${MAKE} clean-target EXT=gb +gb: + ${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gb TYP=nintendo + + +gbc-clean: + ${MAKE} clean-target EXT=gbc +gbc: + ${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gbc TYP=nintendo + + +pocket-clean: + ${MAKE} clean-target EXT=pocket +pocket: + ${MAKE} build-target PORT=gbz80 PLAT=ap EXT=pocket TYP=nintendo + + +megaduck-clean: + ${MAKE} clean-target EXT=duck +megaduck: + ${MAKE} build-target PORT=gbz80 PLAT=duck EXT=duck TYP=nintendo + + +sms-clean: + ${MAKE} clean-target EXT=sms +sms: + ${MAKE} build-target PORT=z80 PLAT=sms EXT=sms TYP=sega + + +gg-clean: + ${MAKE} clean-target EXT=gg +gg: + ${MAKE} build-target PORT=z80 PLAT=gg EXT=gg TYP=sega + diff --git a/gbdk-lib/examples/cross-platform/logo/res/nintendo/logo.png b/gbdk-lib/examples/cross-platform/logo/res/nintendo/logo.png Binary files differ. diff --git a/gbdk-lib/examples/cross-platform/logo/res/sega/logo.png b/gbdk-lib/examples/cross-platform/logo/res/sega/logo.png Binary files differ. diff --git a/gbdk-lib/examples/cross-platform/logo/src/main.c b/gbdk-lib/examples/cross-platform/logo/src/main.c @@ -0,0 +1,13 @@ +#include <gbdk/platform.h> + +#include "logo.h" + +void main() { + fill_bkg_rect(0,0,DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT, 0); +#if defined(SEGA) + set_palette(0, 1, logo_palettes); +#endif + set_native_tile_data(0, logo_TILE_COUNT, logo_tiles); + set_tile_map(0, 0, logo_WIDTH >> 3, logo_HEIGHT >> 3, logo_map); + SHOW_BKG; +} +

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