diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/main.c | 37 |
2 files changed, 12 insertions, 33 deletions
@@ -18,17 +18,17 @@ WATCH_SRC := $(wildcard $(SRC_DIR)/*.c) | |||
18 | WATCH_SRC += $(wildcard $(SRC_DIR)/*.h) | 18 | WATCH_SRC += $(wildcard $(SRC_DIR)/*.h) |
19 | 19 | ||
20 | # Output library names and executables. | 20 | # Output library names and executables. |
21 | BIN_NAME := template | 21 | TARGET := first |
22 | BUILD_DIR := build | 22 | BUILD_DIR := build |
23 | ELF := $(BUILD_DIR)/$(BIN_NAME).elf | 23 | ELF := $(BUILD_DIR)/$(TARGET).elf |
24 | BIN := $(BUILD_DIR)/$(BIN_NAME).gba | 24 | BIN := $(BUILD_DIR)/$(TARGET).gba |
25 | 25 | ||
26 | # Compiler and linker configuration. | 26 | # Compiler and linker configuration. |
27 | CC := arm-none-eabi-gcc | 27 | CC := arm-none-eabi-gcc |
28 | OBJCOPY := arm-none-eabi-objcopy | 28 | OBJCOPY := arm-none-eabi-objcopy |
29 | ARCH := -mthumb -mthumb-interwork | 29 | ARCH := -mthumb -mthumb-interwork |
30 | SPECS := -specs=gba.specs | 30 | SPECS := -specs=gba.specs |
31 | CFLAGS := -g -Wall -Wextra -pedantic | 31 | CFLAGS := -g -Wall -Wextra -pedantic -fno-strict-aliasing |
32 | CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) | 32 | CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) |
33 | CFLAGS += -I$(LIBGBA_SRC) | 33 | CFLAGS += -I$(LIBGBA_SRC) |
34 | LDFLAGS := $(ARCH) $(SPECS) | 34 | LDFLAGS := $(ARCH) $(SPECS) |
@@ -1,33 +1,12 @@ | |||
1 | #include <gba_console.h> | 1 | int 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; |
12 | int 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 | |||