aboutsummaryrefslogtreecommitdiff
path: root/src/ppu/types.h
blob: fa776e59bc50c0cb0f4870a088ccad38c9dde939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include <stdint.h>
#include <stdbool.h>

#include "ppu/consts.h"

/** @brief PPU VRAM address */
typedef uint16_t hh_ppu_addr_t;
/** @brief PPU VRAM data word */
typedef uint16_t hh_ppu_data_t;

/** @brief local RGB color */
typedef uint8_t hh_ppu_rgb_color_t[3];

/** @brief local palette */
typedef hh_ppu_rgb_color_t hh_ppu_loc_palette_data_t[HH_PPU_PALETTE_COLOR_COUNT];
/** @brief local palette table */
typedef hh_ppu_loc_palette_data_t hh_ppu_loc_palette_table_t[HH_PPU_PALETTE_COUNT];

/** @brief local sprite */
typedef uint8_t hh_ppu_loc_sprite_data_t[HH_PPU_SPRITE_WIDTH * HH_PPU_SPRITE_HEIGHT];
typedef hh_ppu_loc_sprite_data_t hh_s_ppu_loc_sprite;

/** @brief local background attribute memory entry */
typedef struct {
	bool horizontal_flip; /** @brief flip sprite horizontally */
	bool vertical_flip; /** @brief flip sprite vertically */
	uint8_t palette_index; /** @brief index of palette to use */
	uint8_t tilemap_index; /** @brief index of sprite to use */
} hh_s_ppu_loc_bam_entry;

/** @brief local foreground attribute memory entry */
typedef struct {
	bool horizontal_flip; /** @brief flip sprite horizontally */
	bool vertical_flip; /** @brief flip sprite vertically */
	int32_t position_x; /** @brief horizontal position from left edge of sprite to left edge of screen (-16 to 320), relative to viewport */
	int32_t position_y; /** @brief vertical position from top edge of sprite to top edge of screen (-16 to 240), relative to viewport */
	uint8_t palette_index; /** @brief index of palette to use */
	uint8_t tilemap_index; /** @brief index of sprite to use */
} hh_s_ppu_loc_fam_entry;

/** @brief local copy of auxiliary memory */
typedef struct {
	bool sysreset; /** @brief enable sysreset, self-resets */
	bool fg_fetch; /** @brief enable foreground fetch, self-resets */
	uint16_t bg_shift_x; /** @brief shift background canvas left (0 to 320) */
	uint16_t bg_shift_y; /** @brief shift background canvas down (0 to 240) */
} hh_s_ppu_loc_aux;