PROGRAMMER'S GUIDEBackup Library User's Manual
▲ | Advance
Backup library user's manual

guide


■ Objective

This game machine will be equipped with several types of storage devices, including the built-in memory, to store information during the game.
This library provides read / write and search functions for these backup storage devices.

■ Explanation

● Introduction

Be sure to use this library to access the backup storage device.

● How to use the library

The main body of this library is compressed and stored in the BOOT ROM.
Application authors deploy and use this. Deployment is done by allocating a program deployment area and executing BUP_Init (). After that, each function can be used.

● About storage capacity

The goal of this library is to be able to access future supported devices with a common interface. Therefore, the capacity of storage devices to be developed in the future is unknown. Also, depending on the device, it is divided into several parts. Hereafter, one unit that is separated is called a partition. (The capacity may vary from partition to partition.)
When storing data, execute BUP_SelPart () and BUP_Stat () to check the capacity before writing.
The built-in backup memory is 32K.

● About date setting

This library does not have a date / time acquisition function internally to maintain the independence of the library. For date and time data, use BUP_SetDate () to set the data acquired by the application.

● Notes

If this library is interrupted while writing data, it will destroy the data. BUP_Init () , BUP_Format () , BUP_Write () , BUP_Delete () before you run is, in the peripheral library PER_SMPC_RES_DIS () Please disable the reset button using.

■ Program description example

An example of writing an actual program in C language is shown below.
#include "sega_per.h"
#define BUP_START_ADDR 0x60 ???? 0 / * Specify the address to read the library * /
#include "sega_bup.h"
Uint32 BackUpRamWork [2048 + 30]; / * 2048 = block access table * /
                                      / * 30 = Backup library variable area * /
main ()
{
  BupConfig conf [3];
  BupStat sttb;
  BupDir writetb;
  BupDate datatb;
  Uint8 * time;

PER_SMPC_RES_DIS (); / * Reset button disabled * / BUP_Init (BUP_START_ADDR, BackUpRamWork, conf); if (BUP_Stat (0, & sttb) == BUP_UNFORMAT) { BUP_Format (0); } PER_SMPC_RES_ENA (); / * Reset button enabled * / BUP_Stat (0, & sttb); if (sttb.freeblock> 0) { strcpy ((char *) writetb.filename, "FILE_NAME01"); strcpy ((char *) writetb. comment, "test"); writetb.language = BUP_JAPANESE; time = PER_GET_TIM (); / * Get date and time * / datetb.year = (Uint8) ((Uint16) (time [6] >> 4) * 1000 + (Uint16) (time [6] & 0x0F) * 100 + (Uint16) (time [5] >> 4) * 10 + (Uint16) (time [5] & 0x0F) --1980); datetb.month = time [4] & 0x0F; datetb.day = (time [3] >> 4) * 10 + (time [3] & 0x0F); datetb.time = (time [2] >> 4) * 10 + (time [2] & 0x0F); datetb.min = (time [1] >> 4) * 10 + (time [1] & 0x0F); writetb.date = BUP_SetDate (& datetb); writetb.datasize = 10; PER_SMPC_RES_DIS (); / * Reset button disabled * / BUP_Write (0, & writetb, "Dummy Data"); PER_SMPC_RES_ENA (); / * Reset button enabled * / } }

See Developer's Infomation STN-52 " Backup Library Workspace Size "

▲ | Advance
PROGRAMMER'S GUIDEBackup Library User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997