gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 9fd48a77a93e2a409cb166c214fbdc1d32d2c26d parent 113000b211b7f2329349c1352711ad111eefd41b Author: Toxa <untoxa@mail.ru> Date: Tue, 28 Oct 2025 19:30:09 +0300 EXAMPLES: GB: HRAM variable allocation example Diffstat:
| A | gbdk-lib/examples/gb/hram/Makefile | 26 | ++++++++++++++++++++++++++ |
| A | gbdk-lib/examples/gb/hram/hram.c | 11 | +++++++++++ |
| A | gbdk-lib/examples/gb/hram/hram_data.c | 4 | ++++ |
| A | gbdk-lib/examples/gb/hram/hram_data.h | 6 | ++++++ |
4 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/gbdk-lib/examples/gb/hram/Makefile b/gbdk-lib/examples/gb/hram/Makefile @@ -0,0 +1,26 @@ +SHELL := /bin/bash + +# If you move this project you can change the directory +# to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/" +ifndef GBDK_HOME + GBDK_HOME = ../../../ +endif + +LCC = $(GBDK_HOME)/bin/lcc + +BINS = hram.gb + +all: $(BINS) + +compile.bat: Makefile + @echo "REM Automatically generated from Makefile" > compile.bat + @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat + +$(BINS): + $(LCC) -c -o hram_data.o hram_data.c + $(LCC) -c -o hram.o hram.c + $(LCC) -Wa-l -Wl-m -Wl-j -o $(BINS) hram.o hram_data.o + +clean: + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst + diff --git a/gbdk-lib/examples/gb/hram/hram.c b/gbdk-lib/examples/gb/hram/hram.c @@ -0,0 +1,10 @@ +#include <gbdk/platform.h> +#include <stdint.h> +#include <stdio.h> + +#include "hram_data.h" + +void main(void) { + my_hram_variable = 5; + printf("value is: %hd at %x", (uint8_t)my_hram_variable, (uint16_t)&my_hram_variable); +} + diff --git a/gbdk-lib/examples/gb/hram/hram_data.c b/gbdk-lib/examples/gb/hram/hram_data.c @@ -0,0 +1,3 @@ +#include <gbdk/platform.h> + +SFR my_hram_variable; + diff --git a/gbdk-lib/examples/gb/hram/hram_data.h b/gbdk-lib/examples/gb/hram/hram_data.h @@ -0,0 +1,5 @@ +#pragma once + +#include <gbdk/platform.h> + +extern SFR my_hram_variable; +
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.