libwwcl libwwcl
WWitch compatibility layer for the Wonderful toolchain
Loading...
Searching...
No Matches
wwcl.h File Reference
#include <wonderful.h>
#include <ws.h>
#include "sys/bios.h"

Go to the source code of this file.

Macros

#define WWCL_INIT_MODE(disp_ctrl, text_mode, scr1_addr, scr2_addr, spr_addr, reserved_name, reserved_from, reserved_to)
 
#define WWCL_INIT_MODE_ASCII1()
 Init mode: screen 2 only, 256 tiles.
 
#define WWCL_INIT_MODE_ASCII2()
 Init mode: screen 1 and 2, 256 tiles.
 
#define WWCL_INIT_MODE_JAPANESE1()
 Init mode: screen 2 only, 512 tiles.
 
#define WWCL_INIT_MODE_JAPANESE2()
 Init mode: screen 1 and 2, 512 tiles.
 
#define WWCL_INIT_RESERVE_TILES_2BPP(count)
 Reserve a specific number (1-1024) of 2bpp tiles for Color mode.
 
#define WWCL_INIT_RESERVE_TILES_4BPP(count)
 Reserve a specific number (1-1024) of 4bpp tiles for Color modes.
 

Functions

void wwcl_init (void)
 Initialize the libwwcl library using a memory layout mode.
 
void wwcl_init_custom (void)
 Initialize the libwwcl library using a custom memory layout.
 

Macro Definition Documentation

◆ WWCL_INIT_MODE

#define WWCL_INIT_MODE ( disp_ctrl,
text_mode,
scr1_addr,
scr2_addr,
spr_addr,
reserved_name,
reserved_from,
reserved_to )
Value:
const uint8_t __wwcl_init_display_control = disp_ctrl; \
const uint8_t __wwcl_init_scr_base = SCR1_BASE(scr1_addr) | SCR2_BASE(scr2_addr); \
const uint8_t __wwcl_init_spr_base = SPR_BASE(spr_addr); \
const uint8_t __wwcl_init_text_mode = text_mode; \
__attribute__((section(reserved_name))) \
const uint8_t __wwcl_reserved[(reserved_to) - (reserved_from)];

Definition at line 34 of file wwcl.h.

◆ WWCL_INIT_MODE_ASCII1

#define WWCL_INIT_MODE_ASCII1 ( )
Value:
DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK, \
0x3000, 0x3000, 0x2E00, ".iramx_2e00", 0x2E00, 0x4000 \
);
#define TEXT_MODE_ANK
Definition text.h:43
#define WWCL_INIT_MODE(disp_ctrl, text_mode, scr1_addr, scr2_addr, spr_addr, reserved_name, reserved_from, reserved_to)
Definition wwcl.h:34

Init mode: screen 2 only, 256 tiles.

Definition at line 45 of file wwcl.h.

◆ WWCL_INIT_MODE_ASCII2

#define WWCL_INIT_MODE_ASCII2 ( )
Value:
DISPLAY_SCR1_ENABLE | DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK, \
0x3000, 0x2800, 0x2600, ".iramx_2600", 0x2600, 0x4000 \
);

Init mode: screen 1 and 2, 256 tiles.

Definition at line 54 of file wwcl.h.

◆ WWCL_INIT_MODE_JAPANESE1

#define WWCL_INIT_MODE_JAPANESE1 ( )
Value:
DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
0x1800, 0x1800, 0x1600, ".iramx_1600", 0x1600, 0x4000 \
);
#define TEXT_MODE_ANK_SJIS
Definition text.h:44

Init mode: screen 2 only, 512 tiles.

Definition at line 63 of file wwcl.h.

◆ WWCL_INIT_MODE_JAPANESE2

#define WWCL_INIT_MODE_JAPANESE2 ( )
Value:
DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
0x1000, 0x1800, 0x0E00, ".iramx_0e00", 0x0E00, 0x4000 \
);

Init mode: screen 1 and 2, 512 tiles.

Definition at line 72 of file wwcl.h.

◆ WWCL_INIT_RESERVE_TILES_2BPP

#define WWCL_INIT_RESERVE_TILES_2BPP ( count)
Value:
__attribute__((section(".iramCx_4000"))) \
const uint8_t __wwcl_reserved_2bbp_tiles[(count > 512 ? count - 512 : 0) * 16];

Reserve a specific number (1-1024) of 2bpp tiles for Color mode.

By default, WWCL_INIT_MODE reserves up to 512 2bpp tiles:

  • for ASCII1/ASCII2 modes, these are tiles 256-511,
  • for JAPANESE1/JAPANESE2 modes, these are tiles 0-511.

However, in Color mode, up to 1024 tiles can be used (via the bank bit).

Definition at line 88 of file wwcl.h.

◆ WWCL_INIT_RESERVE_TILES_4BPP

#define WWCL_INIT_RESERVE_TILES_4BPP ( count)
Value:
__attribute__((section(".iramCx_4000"))) \
const uint8_t __wwcl_reserved_4bpp_tiles[count * 32];

Reserve a specific number (1-1024) of 4bpp tiles for Color modes.

By default, WWCL_INIT_MODE reserves no 4bpp tiles.

Definition at line 97 of file wwcl.h.

Function Documentation

◆ wwcl_init()

void wwcl_init ( void )

Initialize the libwwcl library using a memory layout mode.

Note that you need to use one of the WWCL_INIT_MODE macros for this call to work properly.

◆ wwcl_init_custom()

void wwcl_init_custom ( void )

Initialize the libwwcl library using a custom memory layout.

In this mode, display/sprite/sound functions will not work unless you set IO_SCR_BASE, IO_SPR_BASE, etc. manually.