summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--src/main.c37
2 files changed, 12 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 46564cc..fbd5fe3 100644
--- a/Makefile
+++ b/Makefile
@@ -18,17 +18,17 @@ WATCH_SRC := $(wildcard $(SRC_DIR)/*.c)
18WATCH_SRC += $(wildcard $(SRC_DIR)/*.h) 18WATCH_SRC += $(wildcard $(SRC_DIR)/*.h)
19 19
20# Output library names and executables. 20# Output library names and executables.
21BIN_NAME := template 21TARGET := first
22BUILD_DIR := build 22BUILD_DIR := build
23ELF := $(BUILD_DIR)/$(BIN_NAME).elf 23ELF := $(BUILD_DIR)/$(TARGET).elf
24BIN := $(BUILD_DIR)/$(BIN_NAME).gba 24BIN := $(BUILD_DIR)/$(TARGET).gba
25 25
26# Compiler and linker configuration. 26# Compiler and linker configuration.
27CC := arm-none-eabi-gcc 27CC := arm-none-eabi-gcc
28OBJCOPY := arm-none-eabi-objcopy 28OBJCOPY := arm-none-eabi-objcopy
29ARCH := -mthumb -mthumb-interwork 29ARCH := -mthumb -mthumb-interwork
30SPECS := -specs=gba.specs 30SPECS := -specs=gba.specs
31CFLAGS := -g -Wall -Wextra -pedantic 31CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing
32CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) 32CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH)
33CFLAGS += -I$(LIBGBA_SRC) 33CFLAGS += -I$(LIBGBA_SRC)
34LDFLAGS := $(ARCH) $(SPECS) 34LDFLAGS := $(ARCH) $(SPECS)
diff --git a/src/main.c b/src/main.c
index 64f6234..655373b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,33 +1,12 @@
1#include <gba_console.h> 1int main()
2#include <gba_video.h> 2{
3#include <gba_interrupt.h> 3 *(unsigned int*)0x04000000 = 0x0403;
4#include <gba_systemcalls.h>
5#include <gba_input.h>
6#include <stdio.h>
7#include <stdlib.h>
8 4
9//--------------------------------------------------------------------------------- 5 ((unsigned short*)0x06000000)[120+80*240] = 0x001F;
10// Program entry point 6 ((unsigned short*)0x06000000)[136+80*240] = 0x03E0;
11//--------------------------------------------------------------------------------- 7 ((unsigned short*)0x06000000)[120+96*240] = 0x7C00;
12int main(void) {
13//---------------------------------------------------------------------------------
14 8
9 while(1);
15 10
16 // the vblank interrupt must be enabled for VBlankIntrWait() to work 11 return 0;
17 // since the default dispatcher handles the bios flags no vblank handler
18 // is required
19 irqInit();
20 irqEnable(IRQ_VBLANK);
21
22 consoleDemoInit();
23
24 // ansi escape sequence to set print co-ordinates
25 // /x1b[line;columnH
26 iprintf("\x1b[10;10HHello World!\n");
27
28 while (1) {
29 VBlankIntrWait();
30 }
31} 12}
32
33