Japanese
PROGRAMMER'S GUIDEBackup Library User's Manual
▲ | Go forward
Backup Library User's Manual

guide


■Purpose

This game console will be equipped with several types of storage devices, including internal memory, in order to save 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 backup storage devices.

●How to use the library

The main body of this library is compressed and stored in the BOOT ROM.
Application authors deploy and use it. Expansion is performed by allocating a program expansion area and executing BUP_Init(). From now on, each function will be available for use.

●About storage capacity

The goal of this library is to be able to access devices that will be supported in the future using a common interface. Therefore, the capacity of storage devices that will be developed in the future is unknown. Also, depending on the device, it is divided into several sections. From now on, each divided unit is called a partition. (The capacity may differ for each partition.)
When storing data, execute BUP_SelPart() and BUP_Stat() to check the capacity before writing.
Built-in backup memory is 32K.

●About date settings

This library does not have an internal date and time acquisition function to maintain library independence. For date and time data, please set the data obtained on the application side using BUP_SetDate().

●Notes

If this library is interrupted while writing data, the data will be destroyed. Before executing BUP_Init() , BUP_Format() , BUP_Write() , or BUP_Delete() , please disable the reset button using PER_SMPC_RES_DIS() in the peripheral library.

■Program description example

An example of an actual program written in C language is shown below.
#include  "sega_per.h"
#define   BUP_START_ADDR 0x60????0   /* Specifying the address to load 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, "テスト"); /* Write "test" in Japanese */   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 */ } }

Reference Developer's Information STN-52 " Backup Library Work Area Size "

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