PVSnesLib  4.3.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
console.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------------------
2
3 Generic console functions.
4
5 Copyright (C) 2012-2017
6 Alekmaul
7
8 This software is provided 'as-is', without any express or implied
9 warranty. In no event will the authors be held liable for any
10 damages arising from the use of this software.
11
12 Permission is granted to anyone to use this software for any
13 purpose, including commercial applications, and to alter it and
14 redistribute it freely, subject to the following restrictions:
15
16 1. The origin of this software must not be misrepresented; you
17 must not claim that you wrote the original software. If you use
18 this software in a product, an acknowledgment in the product
19 documentation would be appreciated but is not required.
20 2. Altered source versions must be plainly marked as such, and
21 must not be misrepresented as being the original software.
22 3. This notice may not be removed or altered from any source
23 distribution.
24
25
26---------------------------------------------------------------------------------*/
27
32#ifndef CONSOLE_H
33#define CONSOLE_H
34
35#include <snes/snestypes.h>
36
37#include <snes/background.h>
38#include <snes/dma.h>
39#include <snes/input.h>
40#include <snes/interrupt.h>
41#include <snes/sprite.h>
42#include <snes/sound.h>
43#include <snes/video.h>
44
45extern u8 scr_txt_font_map[0x800];
46extern u8 scr_txt_dirty;
48extern u16 snes_vblank_count;
49extern u8 snes_50hz;
50extern u8 snes_fps;
56u16 rand(void);
57
61void consoleUpdate(void);
62
73void consoleInitText(u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont);
74
79void consoleSetTextVramAdr(u16 vramfont);
80
85void consoleSetTextVramBGAdr(u16 offsetfont);
86
91void consoleSetTextOffset(u16 offsetfont);
92
99void consoleSetTextPal(u8 palnum, u8 *palfont, u8 palsize);
100
109void consoleDrawText(u16 x, u16 y, char *fmt, ...);
110
121void consoleDrawTextMap(u16 x, u16 y, u8 *map, u8 attributes, char *fmt, ...);
122
133void consoleDrawTextMapCenter(u16 y, u16 *map, u8 attributes, char *fmt, ...);
134
141void consoleInit(void);
142
146void consoleNocashMessage(char *fmt, ...);
147
151
156void consoleCopySram(u8 *source, u16 size);
157
162void consoleLoadSram(u8 *dest, u16 size);
163
169void consoleCopySramWithOffset(u8 *source, u16 size, u16 offset);
170
176void consoleLoadSramWithOffset(u8 *dest, u16 size, u16 offset);
177
185
186int sprintf(char *buf, const char *fmt, ...);
187
188#endif
snes background defines and functionality.
u16 rand(void)
return a randomized number
u8 snes_fps
50 if PAL console (50 Hz) or 60 if NTSC console (60Hz)
void consoleSetTextVramAdr(u16 vramfont)
Change text graphics address (4K aligned)
void consoleNocashMessage(char *fmt,...)
Send a message to the no$sns debug window.
void consoleCopySramWithOffset(u8 *source, u16 size, u16 offset)
Send data to SRAM with offset.
void consoleDrawTextMapCenter(u16 y, u16 *map, u8 attributes, char *fmt,...)
Output formatted string on a screen, centered it (2 colors tiles mode)
void consoleInitText(u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont)
Initialize the Text System.
u16 snes_vblank_count
Number of VBL since consoleInit called (16 bits longs so reset each 18 minutes in NTSC)
void consoleInit(void)
Initialize console.
u8 scr_txt_dirty
flag to redraw text during vblank
void consoleDrawText(u16 x, u16 y, char *fmt,...)
Output formatted string on a screen (tiles mode)
void consoleMesenBreakpoint()
Execute the special WDM opcode which Mesen can break on.
void consoleSetTextPal(u8 palnum, u8 *palfont, u8 palsize)
Change text font palette.
void consoleUpdate(void)
Update current text buffer on screen.
void consoleSetTextOffset(u16 offsetfont)
Change text Background map address for display (must be BG address)
void consoleDrawTextMap(u16 x, u16 y, u8 *map, u8 attributes, char *fmt,...)
Output formatted string on a screen (2 colors tiles mode)
void consoleSetTextVramBGAdr(u16 offsetfont)
Change text Background map address for display (must be BG address)
void consoleLoadSram(u8 *dest, u16 size)
Load data from SRAM.
void consoleCopySram(u8 *source, u16 size)
Send data to SRAM.
u8 scr_txt_font_map[0x800]
tilemap used for text display
u16 consoleRegionIsOK(void)
Check compatibility between console (NTSC/PAL) and cartridge (country)
void consoleLoadSramWithOffset(u8 *dest, u16 size, u16 offset)
Load data from SRAM with offset.
u8 snes_50hz
1 if on a PAL/50Hz SNES
Wrapper functions for direct memory access hardware.
input support.
snes interrupt support.
Custom types used by libsnes.
snes sound support.
snes sprites functionality.
contains the basic definitions for controlling the video hardware.