PAlib: Saving commands !!!

Main Page | Modules | File List | Globals | Search for

# Saving commands !!!

## Defines

#define | PA_Save8bit(offset, value) SRAM[offset] = value
| Save an 8 bit value to a given SRAM offset. Uses 1 offset
#define | PA_Save16bit(offset, value) {PA_Save8bit(offset, value&255); PA_Save8bit(offset + 1, value >> 8);}
| Save a 16 bit value to a given SRAM offset. Uses 2 offsets...
#define | PA_Save32bit(offset, value) {PA_Save8bit(offset, value&255); PA_Save8bit(offset + 1, value >> 8); PA_Save8bit(offset + 2, value >> 16); PA_Save8bit(offset + 3, value >> 24);}
| Save a 32 bit value to a given SRAM offset. Uses 4 offsets...
#define | PA_Load8bit(offset) SRAM[offset]
| Returns a saved 8 bit value from a given SRAM offset.
#define | PA_Load16bit(offset) (SRAM[offset] + (SRAM[offset+1] << 8))
| Returns a saved 16 bit value from a given SRAM offset.
#define | PA_Load32bit(offset) (PA_Load8bit(offset) + (PA_Load8bit(offset + 1) << 8) + (PA_Load8bit(offset + 2) << 16) + (PA_Load8bit(offset + 3) << 24))
| Returns a saved 32 bit value from a given SRAM offset.

## Functions

s16 | PA_SaveString (s32 offset, char *string)
| Save a string (a name for example) to a given SRAM offset. The last value in the string must be 0. Offsets used correspond to string lenght + 1. Returns the length
void | PA_SaveData (s32 offset, void *Data, u16 NBytes)
| Save N Bytes in SRAM. This function can be used to backup a whole array.
s16 | PA_LoadString (s32 offset, char *string)
| Returns a saved string from a given SRAM offset.Returns the string length
void | PA_LoadData (s32 offset, void *Data, u16 NBytes)
| Returns the data saved using PA_SaveData.

## Detailed Description

With these functions you can save data to SRAM :-)

## Define Documentation

#define PA_Load16bit | ( | offset |  | ) | (SRAM[offset] + (SRAM[offset+1] << 8))

Returns a saved 16 bit value from a given SRAM offset.

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)

#define PA_Load32bit | ( | offset |  | ) | (PA_Load8bit(offset) + (PA_Load8bit(offset + 1) << 8) + (PA_Load8bit(offset + 2) << 16) + (PA_Load8bit(offset + 3) << 24))

Returns a saved 32 bit value from a given SRAM offset.

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)

#define PA_Load8bit | ( | offset |  | ) | SRAM[offset]

Returns a saved 8 bit value from a given SRAM offset.

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)

#define PA_Save16bit | ( | offset,
|  | value |  | ) | {PA_Save8bit(offset, value&255); PA_Save8bit(offset + 1, value >> 8);}

Save a 16 bit value to a given SRAM offset. Uses 2 offsets...

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | value | Value...

#define PA_Save32bit | ( | offset,
|  | value |  | ) | {PA_Save8bit(offset, value&255); PA_Save8bit(offset + 1, value >> 8); PA_Save8bit(offset + 2, value >> 16); PA_Save8bit(offset + 3, value >> 24);}

Save a 32 bit value to a given SRAM offset. Uses 4 offsets...

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | value | Value...

#define PA_Save8bit | ( | offset,
|  | value |  | ) | SRAM[offset] = value

Save an 8 bit value to a given SRAM offset. Uses 1 offset

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | value | Value...

## Function Documentation

inline void PA_LoadData | ( | s32 | offset,
|  | void * | Data,
|  | u16 | NBytes
| ) | `[inline]`

Returns the data saved using PA_SaveData.

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | Data | Data to save
  | NBytes | Number of Bytes to save

inline s16 PA_LoadString | ( | s32 | offset,
|  | char * | string
| ) | `[inline]`

Returns a saved string from a given SRAM offset.Returns the string length

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | string | String in which to copy the saved string

inline void PA_SaveData | ( | s32 | offset,
|  | void * | Data,
|  | u16 | NBytes
| ) | `[inline]`

Save N Bytes in SRAM. This function can be used to backup a whole array.

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | Data | Data to save
  | NBytes | Number of Bytes to save

inline s16 PA_SaveString | ( | s32 | offset,
|  | char * | string
| ) | `[inline]`

Save a string (a name for example) to a given SRAM offset. The last value in the string must be 0. Offsets used correspond to string lenght + 1. Returns the length

Parameters:

  | offset | Offset, from 0 to alot (depending on how much SRAM you use...)
  | string | Character string...