libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
display.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <wonderful.h>

Go to the source code of this file.

Data Structures

struct  ws_tile_t
 
struct  ws_tile_4bpp_t
 
struct  ws_screen_cell_t
 
struct  ws_sprite_t
 

Macros

#define DISPLAY_WIDTH   28
 
#define DISPLAY_HEIGHT   18
 
#define DISPLAY_WIDTH_PX   (DISPLAY_WIDTH * TILE_WIDTH)
 
#define DISPLAY_HEIGHT_PX   (DISPLAY_HEIGHT * TILE_HEIGHT)
 
#define TILE_WIDTH   8
 
#define TILE_HEIGHT   8
 
#define TILE_LENGTH   16
 
#define TILE_4BPP_LENGTH   32
 
#define SCR_ATTR_TILE(x)
 
#define SCR_ATTR_TILE_MASK   (0x1FF)
 
#define SCR_ATTR_PALETTE(x)
 
#define SCR_ATTR_PALETTE_MASK   (0xF << 9)
 
#define SCR_ATTR_BANK(x)
 
#define SCR_ATTR_BANK_MASK   (0x2000)
 
#define SCR_ATTR_TILE_EX(x)
 
#define SCR_ATTR_TILE_EX_MASK   (0x21FF)
 
#define SCR_ATTR_TILE_BANK_MASK   (SCR_ATTR_TILE_MASK | SCR_ATTR_BANK_MASK)
 
#define SCR_ATTR_FLIP_H   0x4000
 
#define SCR_ATTR_FLIP_V   0x8000
 
#define SCR_ATTR_FLIP   0xC000
 
#define SCR_ATTR_FLIP_MASK   0xC000
 
#define SCR_WIDTH   32
 
#define SCR_HEIGHT   32
 
#define SCR_WIDTH_PX   (SCR_WIDTH * TILE_WIDTH)
 
#define SCR_HEIGHT_PX   (SCR_HEIGHT * TILE_HEIGHT)
 
#define SPR_ATTR_PALETTE(x)
 
#define SPR_ATTR_PALETTE_MASK   (0x7 << 9)
 
#define SPR_ATTR_INSIDE   0x1000
 
#define SPR_ATTR_PRIORITY   0x2000
 
#define SPR_ATTR_FLIP_H   0x4000
 
#define SPR_ATTR_FLIP_V   0x8000
 
#define SPR_MAX_COUNT   128
 
#define SCR_ENTRY_TILE(x)
 
#define SCR_ENTRY_TILE_MASK   (0x1FF)
 
#define SCR_ENTRY_PALETTE(x)
 
#define SCR_ENTRY_PALETTE_MASK   (0xF << 9)
 
#define SCR_ENTRY_BANK(x)
 
#define SCR_ENTRY_BANK_MASK   (0x2000)
 
#define SCR_ENTRY_TILE_EX(x)
 
#define SCR_ENTRY_TILE_EX_MASK   (0x21FF)
 
#define SCR_ENTRY_TILE_BANK_MASK   (SCR_ENTRY_TILE_MASK | SCR_ENTRY_BANK_MASK)
 
#define SCR_ENTRY_FLIP_H   0x4000
 
#define SCR_ENTRY_FLIP_V   0x8000
 
#define SCR_ENTRY_FLIP   0xC000
 
#define SCR_ENTRY_FLIP_MASK   0xC000
 
#define ws_scr_entry_t   ws_screen_cell_t
 
#define SPR_ENTRY_PALETTE(x)
 
#define SPR_ENTRY_PALETTE_MASK   (0x7 << 9)
 
#define SPR_ENTRY_INSIDE   0x1000
 
#define SPR_ENTRY_PRIORITY   0x2000
 
#define SPR_ENTRY_FLIP_H   0x4000
 
#define SPR_ENTRY_FLIP_V   0x8000
 
#define MEM_TILE(i)
 Pointer to tile.
 
#define MEM_TILE_4BPP(i)
 Pointer to 4bpp tile.
 
#define MEM_TILE_4BPP_BANK0(i)
 Pointer to 4bpp tile in bank 0 (0-511).
 
#define MEM_TILE_4BPP_BANK1(i)
 Pointer to 4bpp tile in bank 1 (512-1023).
 
#define MEM_COLOR_PALETTE(i)
 Pointer to color palette.
 
#define MEM_SCR_PALETTE   MEM_COLOR_PALETTE
 Pointer to screen color palette.
 
#define MEM_SPR_PALETTE(i)
 Pointer to sprite color palette.
 
#define SHADE_LUT(c0, c1, c2, c3, c4, c5, c6, c7)
 
#define SHADE_LUT_DEFAULT   SHADE_LUT(0, 2, 4, 6, 9, 11, 13, 15)
 
#define RGB(r, g, b)
 Create an RGB color.
 

Functions

 __attribute__ ((no_assume_ds_data, no_assume_ss_data, save_all)) void ws_display_set_shade_lut(uint32_t lut)
 Configure the shade LUT.
 
static void ws_screen_put_tiles (void __wf_iram *dest, const void __far *src, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 Place a map of tiles on the screen.
 
static void ws_screen_put_tiles_ex (void __wf_iram *dest, const void __far *src, uint16_t sx, uint16_t sy, uint16_t pitch, uint16_t dx, uint16_t dy, uint16_t width, uint16_t height)
 Place a map of tiles on the screen. This varianta llows specifying the source X position, Y position and width.
 
void ws_screen_get_tiles (void __far *dest, const void __wf_iram *src, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 Copy a map of tiles from the screen.
 
void ws_screen_fill_tiles (void __wf_iram *dest, uint16_t src, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 Fill an area on the screen with a given tile.
 
void ws_screen_modify_tiles (void __wf_iram *dest, uint16_t mask, uint16_t value, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 Modify an area on the screen with given data.
 
static void ws_screen_put_tile (void __wf_iram *dest, uint16_t src, uint16_t x, uint16_t y)
 Put a tile on the screen.
 
static uint16_t ws_screen_get_tile (void __wf_iram *src, uint16_t x, uint16_t y)
 Get a tile on the screen.
 

Detailed Description

Functionality related to the display.

Definition in file display.h.

Macro Definition Documentation

◆ DISPLAY_HEIGHT

#define DISPLAY_HEIGHT   18

Definition at line 35 of file display.h.

◆ DISPLAY_HEIGHT_PX

#define DISPLAY_HEIGHT_PX   (DISPLAY_HEIGHT * TILE_HEIGHT)

Definition at line 37 of file display.h.

◆ DISPLAY_WIDTH

#define DISPLAY_WIDTH   28

Definition at line 34 of file display.h.

◆ DISPLAY_WIDTH_PX

#define DISPLAY_WIDTH_PX   (DISPLAY_WIDTH * TILE_WIDTH)

Definition at line 36 of file display.h.

◆ SCR_ATTR_BANK

#define SCR_ATTR_BANK ( x)
Value:
((x) << 13)

Definition at line 56 of file display.h.

◆ SCR_ATTR_BANK_MASK

#define SCR_ATTR_BANK_MASK   (0x2000)

Definition at line 57 of file display.h.

◆ SCR_ATTR_FLIP

#define SCR_ATTR_FLIP   0xC000

Definition at line 64 of file display.h.

◆ SCR_ATTR_FLIP_H

#define SCR_ATTR_FLIP_H   0x4000

Definition at line 62 of file display.h.

◆ SCR_ATTR_FLIP_MASK

#define SCR_ATTR_FLIP_MASK   0xC000

Definition at line 65 of file display.h.

◆ SCR_ATTR_FLIP_V

#define SCR_ATTR_FLIP_V   0x8000

Definition at line 63 of file display.h.

◆ SCR_ATTR_PALETTE

#define SCR_ATTR_PALETTE ( x)
Value:
((x) << 9)

Definition at line 54 of file display.h.

◆ SCR_ATTR_PALETTE_MASK

#define SCR_ATTR_PALETTE_MASK   (0xF << 9)

Definition at line 55 of file display.h.

◆ SCR_ATTR_TILE

#define SCR_ATTR_TILE ( x)
Value:
(x)

Definition at line 52 of file display.h.

◆ SCR_ATTR_TILE_BANK_MASK

#define SCR_ATTR_TILE_BANK_MASK   (SCR_ATTR_TILE_MASK | SCR_ATTR_BANK_MASK)

Definition at line 60 of file display.h.

◆ SCR_ATTR_TILE_EX

#define SCR_ATTR_TILE_EX ( x)
Value:
(((x) & 0x1FF) | (((x) >> 13) << 13))

Definition at line 58 of file display.h.

◆ SCR_ATTR_TILE_EX_MASK

#define SCR_ATTR_TILE_EX_MASK   (0x21FF)

Definition at line 59 of file display.h.

◆ SCR_ATTR_TILE_MASK

#define SCR_ATTR_TILE_MASK   (0x1FF)

Definition at line 53 of file display.h.

◆ SCR_ENTRY_BANK

#define SCR_ENTRY_BANK ( x)
Value:
((x) << 13)

Definition at line 116 of file display.h.

◆ SCR_ENTRY_BANK_MASK

#define SCR_ENTRY_BANK_MASK   (0x2000)

Definition at line 117 of file display.h.

◆ SCR_ENTRY_FLIP

#define SCR_ENTRY_FLIP   0xC000

Definition at line 124 of file display.h.

◆ SCR_ENTRY_FLIP_H

#define SCR_ENTRY_FLIP_H   0x4000

Definition at line 122 of file display.h.

◆ SCR_ENTRY_FLIP_MASK

#define SCR_ENTRY_FLIP_MASK   0xC000

Definition at line 125 of file display.h.

◆ SCR_ENTRY_FLIP_V

#define SCR_ENTRY_FLIP_V   0x8000

Definition at line 123 of file display.h.

◆ SCR_ENTRY_PALETTE

#define SCR_ENTRY_PALETTE ( x)
Value:
((x) << 9)

Definition at line 114 of file display.h.

◆ SCR_ENTRY_PALETTE_MASK

#define SCR_ENTRY_PALETTE_MASK   (0xF << 9)

Definition at line 115 of file display.h.

◆ SCR_ENTRY_TILE

#define SCR_ENTRY_TILE ( x)
Value:
(x)

Definition at line 112 of file display.h.

◆ SCR_ENTRY_TILE_BANK_MASK

#define SCR_ENTRY_TILE_BANK_MASK   (SCR_ENTRY_TILE_MASK | SCR_ENTRY_BANK_MASK)

Definition at line 120 of file display.h.

◆ SCR_ENTRY_TILE_EX

#define SCR_ENTRY_TILE_EX ( x)
Value:
(((x) & 0x1FF) | (((x) >> 13) << 13))

Definition at line 118 of file display.h.

◆ SCR_ENTRY_TILE_EX_MASK

#define SCR_ENTRY_TILE_EX_MASK   (0x21FF)

Definition at line 119 of file display.h.

◆ SCR_ENTRY_TILE_MASK

#define SCR_ENTRY_TILE_MASK   (0x1FF)

Definition at line 113 of file display.h.

◆ SCR_HEIGHT

#define SCR_HEIGHT   32

Definition at line 81 of file display.h.

◆ SCR_HEIGHT_PX

#define SCR_HEIGHT_PX   (SCR_HEIGHT * TILE_HEIGHT)

Definition at line 83 of file display.h.

◆ SCR_WIDTH

#define SCR_WIDTH   32

Definition at line 80 of file display.h.

◆ SCR_WIDTH_PX

#define SCR_WIDTH_PX   (SCR_WIDTH * TILE_WIDTH)

Definition at line 82 of file display.h.

◆ SHADE_LUT

#define SHADE_LUT ( c0,
c1,
c2,
c3,
c4,
c5,
c6,
c7 )
Value:
(((uint32_t)(c0)) | (((uint32_t)(c1)) << 4) | (((uint32_t)(c2)) << 8) | (((uint32_t)(c3)) << 12) | \
(((uint32_t)(c4)) << 16) | (((uint32_t)(c5)) << 20) | (((uint32_t)(c6)) << 24) | (((uint32_t)(c7)) << 28))

Definition at line 192 of file display.h.

◆ SHADE_LUT_DEFAULT

#define SHADE_LUT_DEFAULT   SHADE_LUT(0, 2, 4, 6, 9, 11, 13, 15)

Definition at line 195 of file display.h.

◆ SPR_ATTR_FLIP_H

#define SPR_ATTR_FLIP_H   0x4000

Definition at line 105 of file display.h.

◆ SPR_ATTR_FLIP_V

#define SPR_ATTR_FLIP_V   0x8000

Definition at line 106 of file display.h.

◆ SPR_ATTR_INSIDE

#define SPR_ATTR_INSIDE   0x1000

Definition at line 103 of file display.h.

◆ SPR_ATTR_PALETTE

#define SPR_ATTR_PALETTE ( x)
Value:
((x) << 9)

Definition at line 101 of file display.h.

◆ SPR_ATTR_PALETTE_MASK

#define SPR_ATTR_PALETTE_MASK   (0x7 << 9)

Definition at line 102 of file display.h.

◆ SPR_ATTR_PRIORITY

#define SPR_ATTR_PRIORITY   0x2000

Definition at line 104 of file display.h.

◆ SPR_ENTRY_FLIP_H

#define SPR_ENTRY_FLIP_H   0x4000

Definition at line 133 of file display.h.

◆ SPR_ENTRY_FLIP_V

#define SPR_ENTRY_FLIP_V   0x8000

Definition at line 134 of file display.h.

◆ SPR_ENTRY_INSIDE

#define SPR_ENTRY_INSIDE   0x1000

Definition at line 131 of file display.h.

◆ SPR_ENTRY_PALETTE

#define SPR_ENTRY_PALETTE ( x)
Value:
((x) << 9)

Definition at line 129 of file display.h.

◆ SPR_ENTRY_PALETTE_MASK

#define SPR_ENTRY_PALETTE_MASK   (0x7 << 9)

Definition at line 130 of file display.h.

◆ SPR_ENTRY_PRIORITY

#define SPR_ENTRY_PRIORITY   0x2000

Definition at line 132 of file display.h.

◆ SPR_MAX_COUNT

#define SPR_MAX_COUNT   128

Definition at line 108 of file display.h.

◆ TILE_4BPP_LENGTH

#define TILE_4BPP_LENGTH   32

Definition at line 42 of file display.h.

◆ TILE_HEIGHT

#define TILE_HEIGHT   8

Definition at line 40 of file display.h.

◆ TILE_LENGTH

#define TILE_LENGTH   16

Definition at line 41 of file display.h.

◆ TILE_WIDTH

#define TILE_WIDTH   8

Definition at line 39 of file display.h.

◆ ws_scr_entry_t

#define ws_scr_entry_t   ws_screen_cell_t

Definition at line 127 of file display.h.