summaryrefslogtreecommitdiff
path: root/src/gfx/inc
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2020-11-08 02:34:04 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2020-11-08 02:34:04 +0100
commit8ea8da50d1f01fbbfce9e752d73a9303334555b4 (patch)
tree7b57544c376ca8907ccf26a878c2d12e202b50e4 /src/gfx/inc
parent468468633e2b07e39d3edeb169a1924d4c4ce773 (diff)
downloadpinboid-8ea8da50d1f01fbbfce9e752d73a9303334555b4.tar.gz
Upload TIM files into VRAM
Diffstat (limited to 'src/gfx/inc')
-rw-r--r--src/gfx/inc/gfx.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/gfx/inc/gfx.h b/src/gfx/inc/gfx.h
new file mode 100644
index 0000000..849fc8e
--- /dev/null
+++ b/src/gfx/inc/gfx.h
@@ -0,0 +1,82 @@
+#ifndef GFX_H
+#define GFX_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+enum
+{
+ SCREEN_X = 368,
+ SCREEN_Y = 240
+};
+
+/* 0-3 Texture page X Base (N*64) (ie. in 64-halfword steps) ;GPUSTAT.0-3
+ 4 Texture page Y Base (N*256) (ie. 0 or 256) ;GPUSTAT.4
+ 5-6 Semi Transparency (0=B/2+F/2, 1=B+F, 2=B-F, 3=B+F/4) ;GPUSTAT.5-6
+ 7-8 Texture page colors (0=4bit, 1=8bit, 2=15bit, 3=Reserved);GPUSTAT.7-8
+ 9 Dither 24bit to 15bit (0=Off/strip LSBs, 1=Dither Enabled) ;GPUSTAT.9
+ 10 Drawing to display area (0=Prohibited, 1=Allowed) ;GPUSTAT.10
+ 11 Texture Disable (0=Normal, 1=Disable if GP1(09h).Bit0=1) ;GPUSTAT.15
+ (Above might be chipselect for (absent) second VRAM chip?)
+ 12 Textured Rectangle X-Flip (BIOS does set this bit on power-up...?)
+ 13 Textured Rectangle Y-Flip (BIOS does set it equal to GPUSTAT.13...?)
+ 14-23 Not used (should be 0)
+ 24-31 Command (E1h)*/
+union gfx_common
+{
+ struct
+ {
+ uint32_t tpagex :4;
+ uint32_t tpagey :1;
+ uint32_t stp :2;
+ uint32_t bpp :2;
+ uint32_t dither :1;
+ uint32_t draw_to_disp :1;
+ uint32_t disable :1;
+ uint32_t xflip :1;
+ uint32_t yflip :1;
+ uint32_t :10;
+ uint8_t cmd;
+ };
+
+ uint32_t mask;
+};
+
+union gfx_sznext
+{
+ struct
+ {
+ uint32_t next :24;
+ uint32_t sz :8;
+ };
+
+ uint32_t cmd_next;
+};
+
+struct gfx_sprite
+{
+ union gfx_sznext sznext;
+ union gfx_common common;
+ uint8_t r, g, b;
+ uint8_t cmd;
+ uint16_t x, y;
+ uint16_t clutid;
+ uint8_t u, v;
+ uint16_t w, h;
+};
+
+int gfx_init(void);
+void gfx_draw(void);
+void gfx_sprite_init(struct gfx_sprite *s);
+void gfx_sprite_sort(struct gfx_sprite *s);
+int gfx_sprite_from_file(const char *path, struct gfx_sprite *s);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GFX_H */