SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
console.h
Go to the documentation of this file.
1
20
21// *****************************************************************************
22//
23// Includes
24//
25// *****************************************************************************
26
27#include "config.h"
28
29#if (MODULE_CONSOLE != 0)
30
31#include "types.h"
32#include "string.h"
33#include "maths.h"
34#include "dma.h"
35
36#pragma once
37
38// *****************************************************************************
39//
40// Types
41//
42// *****************************************************************************
43
45typedef int (*vsprintf_t)(char *buf, const char *fmt, va_list args);
47typedef int (*vsnprintf_t)(char *buf, int count, const char *fmt, va_list args);
48
49// *****************************************************************************
50//
51// Macros
52//
53// *****************************************************************************
54
56#define str(s) xstr(s)
58#define xstr(s) #s
59
71
72#if !defined(NDEBUG) && (LIB_DEBUG != 0)
73#define con_assert(condition) \
74 if ( !(condition) ) \
75 { \
76 CON_reset(); \
77 CON_systemResetOnNextWrite(); \
78 CON_write(__FILE__":"str(__LINE__)": Assertion \'"str(condition)"\' failed."); \
79 while (TRUE); \
80 }
81#else
82#define con_assert(condition)
83#endif
84
91
92#define CON_ASSERT(condition) con_assert(condition)
93
94// *****************************************************************************
95//
96// Function Declarations
97//
98// *****************************************************************************
99
100// -----------------------------------------------------------------------------
101// printf functions
102// -----------------------------------------------------------------------------
103
133
134int CON_sprintf(char* buf, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
135
169
170int CON_snprintf(char* buf, int count, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
171
188
189void CON_setVsprintf(vsprintf_t vsprintf_func);
190
207
208void CON_setVsnprintf(vsnprintf_t vsnprintf_func);
209
210// -----------------------------------------------------------------------------
211// Console setup
212// -----------------------------------------------------------------------------
213
230
231void CON_setConsoleSize(u16 left, u16 top, u16 width, u16 height);
232
254
255void CON_setLineBufferSize(u16 size);
256
275
276void CON_setTransferMethod(TransferMethod tm);
277
288
289void CON_reset();
290
304
305void CON_systemResetOnNextWrite();
306
307// -----------------------------------------------------------------------------
308// Console write functions
309// -----------------------------------------------------------------------------
310
319
320void CON_clear();
321
335
336void CON_setCursorPosition(u16 x, u16 y);
337
346
347V2u16 CON_getCursorPosition();
348
384
385int CON_write(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
386
387#endif // MODULE_CONSOLE
Basic SGDK library configuration file.
DMA support.
TransferMethod
VRAM transfer method.
Definition dma.h:52
Mathematical methods.
Vect2D_u16 V2u16
alias for Vect2D_u16
Definition maths.h:252
String manipulations.
Types definition.
unsigned short u16
Definition types.h:100