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
26
27#ifndef __WF_WWCL_H__
28#define __WF_WWCL_H__
29
30#warning WWCL is considered deprecated.
31
32#include <wonderful.h>
33#include <ws.h>
34#include "sys/bios.h"
35
36#define WWCL_INIT_MODE(disp_ctrl, text_mode, scr1_addr, scr2_addr, spr_addr, reserved_name, reserved_from, reserved_to) \
37 const uint8_t __wwcl_init_display_control = disp_ctrl; \
38 const uint8_t __wwcl_init_scr_base = WS_SCR_BASE_ADDR1(scr1_addr) | WS_SCR_BASE_ADDR2(scr2_addr); \
39 const uint8_t __wwcl_init_spr_base = WS_SPR_BASE_ADDR(spr_addr); \
40 const uint8_t __wwcl_init_text_mode = text_mode; \
41 __attribute__((section(reserved_name))) \
42 const uint8_t __wwcl_reserved[(reserved_to) - (reserved_from)];
43
47#define WWCL_INIT_MODE_ASCII1() \
48 WWCL_INIT_MODE( \
49 WS_DISPLAY_CTRL_SCR2_ENABLE, TEXT_MODE_ANK, \
50 0x3000, 0x3000, 0x2E00, ".iramx_2e00", 0x2E00, 0x4000 \
51 );
52
56#define WWCL_INIT_MODE_ASCII2() \
57 WWCL_INIT_MODE( \
58 WS_DISPLAY_CTRL_SCR1_ENABLE | WS_DISPLAY_CTRL_SCR2_ENABLE, TEXT_MODE_ANK, \
59 0x3000, 0x2800, 0x2600, ".iramx_2600", 0x2600, 0x4000 \
60 );
61
65#define WWCL_INIT_MODE_JAPANESE1() \
66 WWCL_INIT_MODE( \
67 WS_DISPLAY_CTRL_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
68 0x1800, 0x1800, 0x1600, ".iramx_1600", 0x1600, 0x4000 \
69 );
70
74#define WWCL_INIT_MODE_JAPANESE2() \
75 WWCL_INIT_MODE( \
76 WS_DISPLAY_CTRL_SCR2_ENABLE, TEXT_MODE_ANK_SJIS, \
77 0x1000, 0x1800, 0x0E00, ".iramx_0e00", 0x0E00, 0x4000 \
78 );
79
90#define WWCL_INIT_RESERVE_TILES_2BPP(count) \
91 __attribute__((section(".iramCx_4000"))) \
92 const uint8_t __wwcl_reserved_2bbp_tiles[(count > 512 ? count - 512 : 0) * 16];
93
99#define WWCL_INIT_RESERVE_TILES_4BPP(count) \
100 __attribute__((section(".iramCx_4000"))) \
101 const uint8_t __wwcl_reserved_4bpp_tiles[count * 32];
102
103
110void wwcl_init(void);
111
119
120#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.