Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __GBV_H__
- #define __GBV_H__
- #define GBV_TILE_MEMORY_SIZE 6144
- #define GBV_BG_MAP_MEMORY_SIZE 1024
- #define GBV_OAM_MEMORY_SIZE 160
- typedef char gbv_s8;
- typedef short gbv_s16;
- typedef unsigned char gbv_u8;
- typedef unsigned short gbv_u16;
- typedef unsigned char gbv_io;
- typedef enum {
- GBV_RENDER_MODE_GRAYSCALE_8, // 0-255
- GBV_RENDER_MODE_GRAYSCALE_F32, // normalized in intervale [0,1)
- } gbv_render_mode;
- typedef struct {
- gbv_u8 colors[4];
- } gbv_palette;
- typedef enum {
- GBV_LCDC_BG_ENABLE = 0x01, /* enable bg display */
- GBV_LCDC_OBJ_ENABLE = 0x02, /* enable obj display */
- GBV_LCDC_OBJ_SIZE_SELECT = 0x04, /* enable 8x16 obj mode */
- GBV_LCDC_BG_MAP_SELECT = 0x08, /* bg tile map display select */
- GBV_LCDC_BG_DATA_SELECT = 0x10, /* bg & wnd tile data select */
- GBV_LCDC_WND_ENABLE = 0x20, /* enable wnd display */
- GBV_LCDC_WND_MAP_SELECT = 0x40, /* wnd tile map display select */
- GBV_LCDC_CTRL = 0x80, /* enable lcd */
- } gbv_lcdc_flag;
- /*****************************/
- /*** I/O control registers ***/
- /*****************************/
- /* lcd control */
- extern gbv_io gbv_io_lcdc;
- /*
- palettes:
- - defined as 4 packed colors at 2 bits per color
- - for objects, 00 means transparent
- */
- extern gbv_io gbv_io_bgp;
- extern gbv_io gbv_io_obp0;
- extern gbv_io gbv_io_obp1;
- /* bg scroll registers */
- extern gbv_io gbv_io_scx;
- extern gbv_io gbv_io_scy;
- /* wnd position */
- extern gbv_io gbv_io_wx;
- extern gbv_io gbv_io_wy;
- /*****************************/
- /************ API ************/
- /*****************************/
- /* initialize system, provide 64k of memory */
- void gbv_init(void * memory);
- /* utility function for lcd control */
- void gbv_lcdc_set(gbv_lcdc_flag flag);
- void gbv_lcdc_reset(gbv_lcdc_flag flag);
- /* return raw pointers for data specification */
- gbv_u8 * ggbv_get_rom_data();
- gbv_u8 * gbv_get_tile_data();
- gbv_u8 * gbv_get_bg_map_data1();
- gbv_u8 * gbv_get_bg_map_data2();
- gbv_u8 * gbv_get_oam_data();
- /* render all data to target buffer */
- void gbv_render(void * render_buffer, gbv_render_mode mode, gbv_palette * palette);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement