PVSnesLib  4.6.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
console.h File Reference

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.

Macros

#define RAND_MAX   65535
 65535 is maximum number for randomizd numbers
 

Functions

void consoleCopySram (u8 *source, u16 size)
 Send data to SRAM.
 
void consoleCopySramWithOffset (u8 *source, u16 size, u16 offset)
 Send data to SRAM with offset.
 
void consoleInit (void)
 Initialize console.
 
void consoleLoadSram (u8 *dest, u16 size)
 Load data from SRAM.
 
void consoleLoadSramWithOffset (u8 *dest, u16 size, u16 offset)
 Load data from SRAM with offset.
 
void consoleMesenBreakpoint (void)
 Execute the special WDM opcode which Mesen can break on.
 
void consoleNocashMessage (char *fmt,...)
 Send a message to the no$sns debug window.
 
u16 consoleRegionIsOK (void)
 Check compatibility between console (NTSC/PAL) and cartridge (country)
 
u16 rand (void)
 return a randomized number
 
void srand (u16 seed)
 initialize the seed for random numbers
 

Variables

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)
 

Detailed Description

snes generic console support.

Function Documentation

◆ consoleCopySram()

void consoleCopySram ( u8 *  source,
u16  size 
)

Send data to SRAM.

Parameters
sourcethe source to copy from
sizethe size in bytes of the data to copy.
Examples
systems/sram/sramsimple/src/sram.c.

◆ consoleCopySramWithOffset()

void consoleCopySramWithOffset ( u8 *  source,
u16  size,
u16  offset 
)

Send data to SRAM with offset.

Parameters
sourcethe source to copy from
sizethe size in bytes of the data to copy.
offsetthe offset in bytes where the data should be copied
Examples
systems/sram/sramoffset/src/sramoffset.c.

◆ consoleInit()

consoleInit ( void  )

Initialize console.

Generic init for SNES console.

◆ consoleLoadSram()

void consoleLoadSram ( u8 *  dest,
u16  size 
)

Load data from SRAM.

Parameters
destthe destination to load into
sizethe size in bytes of the data to copy.
Examples
systems/sram/sramsimple/src/sram.c.

◆ consoleLoadSramWithOffset()

void consoleLoadSramWithOffset ( u8 *  dest,
u16  size,
u16  offset 
)

Load data from SRAM with offset.

Parameters
destthe destination to load into
sizethe size in bytes of the data to copy.
offsetthe offset from which the data should be loaded
Examples
systems/sram/sramoffset/src/sramoffset.c.

◆ consoleNocashMessage()

void consoleNocashMessage ( char *  fmt,
  ... 
)

Send a message to the no$sns debug window.

Parameters
fmtThe Format string (see printf() documentation in your local C tutorial)
Examples
graphics/maps/slopemario/slopemario.c, systems/debug/src/debug.c, systems/games/likemario/src/LikeMario.c, and systems/objects/moveobjects/moveobjects.c.

◆ consoleRegionIsOK()

consoleRegionIsOK ( void  )

Check compatibility between console (NTSC/PAL) and cartridge (country)

Returns
1 if cartridge and console are from the same region, 2 if not

Check if console (PAL / NSTC) is the same as cartrdige region code

Examples
systems/testregion/src/testregion.c.

◆ rand()

rand ( void  )

◆ srand()

srand ( u16  seed)

initialize the seed for random numbers

Parameters
seeda number between 1 and 65535