aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-05-28 09:30:50 +0200
committerBad Diode <bd@badd10de.dev>2023-05-28 09:30:50 +0200
commita3b2141540d74456689ddfaac44c4f83f995c6a7 (patch)
treeca03b5e91907970afcca462ebc18c46f24488e71
parentaf68ac1e1bb77fd821e042d2c8ea9a159c970d20 (diff)
downloadstepper-a3b2141540d74456689ddfaac44c4f83f995c6a7.tar.gz
stepper-a3b2141540d74456689ddfaac44c4f83f995c6a7.zip
Supress some warnings for now
-rw-r--r--Makefile6
-rw-r--r--src/gba/gba.h30
2 files changed, 4 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index 7eb4b11..90b0a0d 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy
37ARCH := -mthumb -mthumb-interwork 37ARCH := -mthumb -mthumb-interwork
38SPECS := -specs=gba.specs 38SPECS := -specs=gba.specs
39CONFIG := 39CONFIG :=
40CFLAGS := -Wall -Wextra -Wdouble-promotion -pedantic -Wno-incompatible-pointer-types -Wconversion -Wno-sign-conversion 40CFLAGS := -Wall -Wextra -pedantic -Wno-incompatible-pointer-types
41# CFLAGS := -Wall -Wextra -Wdouble-promotion -pedantic -Wno-incompatible-pointer-types -Wconversion -Wno-sign-conversion
41CFLAGS += -fno-strict-aliasing 42CFLAGS += -fno-strict-aliasing
42CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) 43CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH)
43CFLAGS += $(INC_FLAGS) 44CFLAGS += $(INC_FLAGS)
@@ -45,7 +46,8 @@ CFLAGS += $(CONFIG)
45LDFLAGS := $(ARCH) $(SPECS) 46LDFLAGS := $(ARCH) $(SPECS)
46LDLIBS := $(LIBGBA) 47LDLIBS := $(LIBGBA)
47RELEASE_CFLAGS := -DNDEBUG -O2 48RELEASE_CFLAGS := -DNDEBUG -O2
48DEBUG_CFLAGS := -DDEBUG -O2 -g3 -Wno-unused-parameter -Wno-unused-function 49# DEBUG_CFLAGS := -DDEBUG -O2 -g3 -Wno-unused-parameter -Wno-unused-function
50DEBUG_CFLAGS := -DDEBUG -O2 -g
49 51
50.PHONY: clean run 52.PHONY: clean run
51 53
diff --git a/src/gba/gba.h b/src/gba/gba.h
index 27a6a9a..be7a305 100644
--- a/src/gba/gba.h
+++ b/src/gba/gba.h
@@ -327,40 +327,10 @@ key_hold(u32 key) {
327 return key_curr & key_prev & key; 327 return key_curr & key_prev & key;
328} 328}
329 329
330// Back/unpack bits.
331static inline
332u32
333unpack_1bb(u8 hex) {
334 const u32 conversion_u32[16] = {
335 0x00000000, 0x00000001, 0x00000010, 0x00000011,
336 0x00000100, 0x00000101, 0x00000110, 0x00000111,
337 0x00001000, 0x00001001, 0x00001010, 0x00001011,
338 0x00001100, 0x00001101, 0x00001110, 0x00001111,
339 };
340 u8 low = hex & 0xF;
341 u8 high = (hex >> 4) & 0xF;
342 return (conversion_u32[high] << 16) | conversion_u32[low];
343}
344
345// Unpack N tiles packed at 1bpp.
346static inline
347void
348unpack_tiles(const u32 *src, u32 *dst, size_t n_tiles) {
349 const u32 *target_src = src + n_tiles * 2;
350 while (src != target_src) {
351 *dst++ = unpack_1bb((*src >> 24) & 0xFF);
352 *dst++ = unpack_1bb((*src >> 16) & 0xFF);
353 *dst++ = unpack_1bb((*src >> 8) & 0xFF);
354 *dst++ = unpack_1bb(*src & 0xFF);
355 src++;
356 }
357}
358
359// 330//
360// Direct Memory Access (DMA) 331// Direct Memory Access (DMA)
361// 332//
362 333
363
364// Source, destination, and control registers. 334// Source, destination, and control registers.
365#define DMA_SRC(N) *((vu32*) 0x040000B0 + (N) * 12) 335#define DMA_SRC(N) *((vu32*) 0x040000B0 + (N) * 12)
366#define DMA_DST(N) *((vu32*) 0x040000B4 + (N) * 12) 336#define DMA_DST(N) *((vu32*) 0x040000B4 + (N) * 12)