libwwcl libwwcl
WWitch compatibility layer for the Wonderful toolchain
Loading...
Searching...
No Matches
wwcl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Adrian "asie" Siekierka
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 *
17 * 2. Altered source versions must be plainly marked as such, and must not be
18 * misrepresented as being the original software.
19 *
20 * 3. This notice may not be removed or altered from any source distribution.
21 */
22
27#ifndef __WF_WWCL_H__
28#define __WF_WWCL_H__
29
30#include <wonderful.h>
31#include <ws.h>
32#include "sys/bios.h"
33
34#define WWCL_INIT_MODE(disp_ctrl, text_mode, scr1_addr, scr2_addr, spr_addr, reserved_name, reserved_from, reserved_to) \
35 const uint8_t __wwcl_init_display_control = disp_ctrl; \
36 const uint8_t __wwcl_init_scr_base = SCR1_BASE(scr1_addr) | SCR2_BASE(scr2_addr); \
37 const uint8_t __wwcl_init_spr_base = SPR_BASE(spr_addr); \
38 const uint8_t __wwcl_init_text_mode = text_mode; \
39 __attribute__((section(reserved_name))) \
40 const uint8_t __wwcl_reserved[(reserved_to) - (reserved_from)];
41
45#define WWCL_INIT_MODE_ASCII1() \
46 WWCL_INIT_MODE( \
47 DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK, \
48 0x3000, 0x3000, 0x2E00, ".iramx_2e00", 0x2E00, 0x4000 \
49 );
50
54#define WWCL_INIT_MODE_ASCII2() \
55 WWCL_INIT_MODE( \
56 DISPLAY_SCR1_ENABLE | DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK, \
57 0x3000, 0x2800, 0x2600, ".iramx_2600", 0x2600, 0x4000 \
58 );
59
63#define WWCL_INIT_MODE_JAPANESE1() \
64 WWCL_INIT_MODE( \
65 DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
66 0x1800, 0x1800, 0x1600, ".iramx_1600", 0x1600, 0x4000 \
67 );
68
72#define WWCL_INIT_MODE_JAPANESE2() \
73 WWCL_INIT_MODE( \
74 DISPLAY_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
75 0x1000, 0x1800, 0x0E00, ".iramx_0e00", 0x0E00, 0x4000 \
76 );
77
88#define WWCL_INIT_RESERVE_TILES_2BPP(count) \
89 __attribute__((section(".iramCx_4000"))) \
90 const uint8_t __wwcl_reserved_2bbp_tiles[(count > 512 ? count - 512 : 0) * 16];
91
97#define WWCL_INIT_RESERVE_TILES_4BPP(count) \
98 __attribute__((section(".iramCx_4000"))) \
99 const uint8_t __wwcl_reserved_4bpp_tiles[count * 32];
100
101
108void wwcl_init(void);
109
117
118#endif /* __WF_WWCL_H__ */
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.