PVSnesLib
4.3.0
Documentation to code in C or ASM for the Nintendo SNES
|
snes generic console support. More...
#include <snes/snestypes.h>
#include <snes/background.h>
#include <snes/dma.h>
#include <snes/input.h>
#include <snes/interrupt.h>
#include <snes/sprite.h>
#include <snes/sound.h>
#include <snes/video.h>
Go to the source code of this file.
Functions | |
void | consoleCopySram (u8 *source, u16 size) |
Send data to SRAM. More... | |
void | consoleCopySramWithOffset (u8 *source, u16 size, u16 offset) |
Send data to SRAM with offset. More... | |
void | consoleDrawText (u16 x, u16 y, char *fmt,...) |
Output formatted string on a screen (tiles mode) More... | |
void | consoleDrawTextMap (u16 x, u16 y, u8 *map, u8 attributes, char *fmt,...) |
Output formatted string on a screen (2 colors tiles mode) More... | |
void | consoleDrawTextMapCenter (u16 y, u16 *map, u8 attributes, char *fmt,...) |
Output formatted string on a screen, centered it (2 colors tiles mode) More... | |
void | consoleInit (void) |
Initialize console. More... | |
void | consoleInitText (u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont) |
Initialize the Text System. More... | |
void | consoleLoadSram (u8 *dest, u16 size) |
Load data from SRAM. More... | |
void | consoleLoadSramWithOffset (u8 *dest, u16 size, u16 offset) |
Load data from SRAM with offset. More... | |
void | consoleMesenBreakpoint () |
Execute the special WDM opcode which Mesen can break on. | |
void | consoleNocashMessage (char *fmt,...) |
Send a message to the no$sns debug window. More... | |
u16 | consoleRegionIsOK (void) |
Check compatibility between console (NTSC/PAL) and cartridge (country) More... | |
void | consoleSetTextOffset (u16 offsetfont) |
Change text Background map address for display (must be BG address) More... | |
void | consoleSetTextPal (u8 palnum, u8 *palfont, u8 palsize) |
Change text font palette. More... | |
void | consoleSetTextVramAdr (u16 vramfont) |
Change text graphics address (4K aligned) More... | |
void | consoleSetTextVramBGAdr (u16 offsetfont) |
Change text Background map address for display (must be BG address) More... | |
void | consoleUpdate (void) |
Update current text buffer on screen. | |
u16 | rand (void) |
return a randomized number More... | |
Variables | |
u8 | scr_txt_dirty |
flag to redraw text during vblank | |
u8 | scr_txt_font_map [0x800] |
tilemap used for text display | |
u8 | snes_50hz |
1 if on a PAL/50Hz SNES | |
u8 | snes_fps |
50 if PAL console (50 Hz) or 60 if NTSC console (60Hz) | |
u16 | snes_vblank_count |
Number of VBL since consoleInit called (16 bits longs so reset each 18 minutes in NTSC) | |
snes generic console support.
void consoleCopySram | ( | u8 * | source, |
u16 | size | ||
) |
Send data to SRAM.
source | the source to copy from |
size | the size in bytes of the data to copy. |
void consoleCopySramWithOffset | ( | u8 * | source, |
u16 | size, | ||
u16 | offset | ||
) |
Send data to SRAM with offset.
source | the source to copy from |
size | the size in bytes of the data to copy. |
offset | the offset in bytes where the data should be copied |
void consoleDrawText | ( | u16 | x, |
u16 | y, | ||
char * | fmt, | ||
... | |||
) |
Output formatted string on a screen (tiles mode)
x | The X character number the string should start on |
y | The Y character number the string should start on |
fmt | The Format string (see printf() documentation in your local C tutorial) |
Output a text string to the screen. Before using this, you need to call consoleInitText(). You can also print the value of variables this way, by putting a format string and additional parameters.
void consoleDrawTextMap | ( | u16 | x, |
u16 | y, | ||
u8 * | map, | ||
u8 | attributes, | ||
char * | fmt, | ||
... | |||
) |
Output formatted string on a screen (2 colors tiles mode)
x | The X character number the string should start on |
y | The Y character number the string should start on |
map | The 0x800 char map entry to put string |
attributes | attributes for tiles |
fmt | The Format string (see printf() documentation in your local C tutorial) |
Output a text string to the screen. Before using this, you need to call consoleInitText(). You can also print the value of variables this way, by putting a format string and additional parameters.
void consoleDrawTextMapCenter | ( | u16 | y, |
u16 * | map, | ||
u8 | attributes, | ||
char * | fmt, | ||
... | |||
) |
Output formatted string on a screen, centered it (2 colors tiles mode)
y | The Y character number the string should start on |
map | The 0x800 char map entry to put string |
attributes | attributes for tiles |
fmt | The Format string (see printf() documentation in your local C tutorial) |
Output a text string to the screen. Before using this, you need to call consoleInitText(). You can also print the value of variables this way, by putting a format string and additional parameters. The text will be centered on x axis.
consoleInit | ( | void | ) |
Initialize console.
Generic init for SNES console.
void consoleInitText | ( | u8 | palnum, |
u8 | palsize, | ||
u8 * | tilfont, | ||
u8 * | palfont | ||
) |
Initialize the Text System.
palnum | palette entry (0..7) |
palsize | size of palette of text (4,16,etc ...) |
tilfont | Pointer to tiles gfx for printing |
palfont | Pointer to palette of text |
Reserve a BG and load the font characters into VRAM. It will only work in tiled display modes. You can change address of graphics and map with consoleSetTextVramAdr() and consoleSetTextVramBGAdr(). Also, consoleSetTextPal can change the text palette.
void consoleLoadSram | ( | u8 * | dest, |
u16 | size | ||
) |
Load data from SRAM.
dest | the destination to load into |
size | the size in bytes of the data to copy. |
void consoleLoadSramWithOffset | ( | u8 * | dest, |
u16 | size, | ||
u16 | offset | ||
) |
Load data from SRAM with offset.
dest | the destination to load into |
size | the size in bytes of the data to copy. |
offset | the offset from which the data should be loaded |
void consoleNocashMessage | ( | char * | fmt, |
... | |||
) |
Send a message to the no$sns debug window.
fmt | The Format string (see printf() documentation in your local C tutorial) |
consoleRegionIsOK | ( | void | ) |
Check compatibility between console (NTSC/PAL) and cartridge (country)
Check if console (PAL / NSTC) is the same as cartrdige region code
consoleSetTextOffset | ( | u16 | offsetfont | ) |
Change text Background map address for display (must be BG address)
offsetfont | VRAM offset for text (default is 0, as it is aligned with BG tiles) |
consoleSetTextPal | ( | u8 | palnum, |
u8 * | palfont, | ||
u8 | palsize | ||
) |
Change text font palette.
palnum | palette entry (0..7) |
palfont | pointer to the new palette |
palsize | size of palette of text (4,16,etc ...) |
consoleSetTextVramAdr | ( | u16 | vramfont | ) |
Change text graphics address (4K aligned)
vramfont | VRAM Background address (4K aligned) (default is $0800) |
consoleSetTextVramBGAdr | ( | u16 | vrambgfont | ) |
Change text Background map address for display (must be BG address)
vrambgfont | VRAM Background map address (default is $0800) |
rand | ( | void | ) |
return a randomized number