diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gba/gba.h | 30 |
1 files changed, 0 insertions, 30 deletions
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. | ||
331 | static inline | ||
332 | u32 | ||
333 | unpack_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. | ||
346 | static inline | ||
347 | void | ||
348 | unpack_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) |