Skip to content

Commit

Permalink
Red screen with as simple a Makefile that I could manage.
Browse files Browse the repository at this point in the history
  • Loading branch information
otrho committed Sep 26, 2021
1 parent 36790f7 commit 9268624
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.o
*.d

*.elf
*.elf.map
*.gba

*.sav
39 changes: 39 additions & 0 deletions scratch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.SUFFIXES:

# --------------------------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif

include ${DEVKITARM}/gba_rules

# --------------------------------------------------------------------------------------------------

OUTPUT = scratch
OFILES = scratch.o

INCLUDE = -I${LIBGBA}/include
OPTIMISE = -fomit-frame-pointer -ffast-math
ARCH = -mthumb -mthumb-interwork
CFLAGS = -g -Wall -O3 -mcpu=arm7tdmi -mtune=arm7tdmi ${OPTIMISE} ${ARCH} ${INCLUDE}

LD := ${CC}
LDFLAGS = -g ${ARCH} -Wl,-Map,$(notdir $@).map
LIBPATHS=-L${LIBGBA}/lib
LIBS := -lgba

DEPSDIR=${CURDIR}

# --------------------------------------------------------------------------------------------------

${OUTPUT}.gba : ${OUTPUT}.elf

${OUTPUT}.elf : ${OFILES}

all : ${OUTPUT}.gba

clean :
rm -f *.o *.d *.elf* *.gba

# --------------------------------------------------------------------------------------------------
15 changes: 15 additions & 0 deletions scratch/scratch.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <gba.h>

#define SCREENBUFFER ((volatile uint16_t*)0x06000000)

int main() {
REG_DISPCNT = MODE_3 | BG2_ENABLE;

for (int pix_idx = 0; pix_idx < SCREEN_WIDTH * SCREEN_HEIGHT; ++pix_idx) {
SCREENBUFFER[pix_idx] = 0x001F;
}

while(1) {}

return 0;
}

0 comments on commit 9268624

Please sign in to comment.