
#ifndef _CONIO_H_
#define _CONIO_H_

/* General usage macros */
#define COLOR_RGB16(r,g,b) (((r)&0x1F)|((g)&0x1F)<<5|((b)&0x1F)<<10|0x8000)
#define COLOR_RGB24(r,g,b) (COLOR_RGB16(r>>3,g>>3,b>>3))



/* HTML4 Color ID */
#define COLOR_BLACK   16
#define COLOR_SILVER  17
#define COLOR_GRAY    18
#define COLOR_WHITE   19
#define COLOR_MAROON  20
#define COLOR_RED     21
#define COLOR_PURPLE  22
#define COLOR_FUCHSIA 23
#define COLOR_GREEN   24
#define COLOR_LIME    25
#define COLOR_OLIVE   26
#define COLOR_YELLOW  27
#define COLOR_NAVI    28
#define COLOR_BLUE    29
#define COLOR_TEAL    30
#define COLOR_AQUA    31

/* For all the "printf" functions, use this macro to define background and foreground colors.
 * Not using this macro will define the background color to 0 (= transparent color).
 */
#define COLOR_BG_FG(B,F) ((B)<<8|(F))



/* Screen sizes, using TVMD register */
#define CONIO_SCREEN_FULL_WIDTH 0x0000
#define CONIO_SCREEN_HALF_WIDTH 0x0002
#define CONIO_SCREEN_FULL_HEIGHT 0x0000
#define CONIO_SCREEN_HALF_HEIGHT 0x00C0

/* Function prototypes */
void conio_init(void);
void conio_set_color_to_palette(uint16 col, uint8 id);
void conio_set_screen_size(int16 s);
void clear_screen(void);
void _printchar(int16 x, int16 y, uint16 color, char v);
void _printf(int16 x, int16 y, uint16 color, char* msg, ...);
void _printstr(int16 x, int16 y, uint16 color, char *s);
void _printhexd(int16 x, int16 y, uint16 color, uint8 v);
void _printhexb(int16 x, int16 y, uint16 color, uint8 v);
void _printhexw(int16 x, int16 y, uint16 color, uint16 v);
void _printhexl(int16 x, int16 y, uint16 color, uint32 v);



#endif /* _CONIO_H_ */
