Return to previous page Return to menu Go to next page

1.3 Program description example

An example of the actual program description in C language is shown below.
#include “sega_per.h”
#define BUP_START_ADDR 0x60 ???? 0 / * Specify address to load library * /
Y#include “sega_bup.h”

Uint32 BackUpRamWork [2048];

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, “”); Writetb.language = BUP_JAPANESE; , Time = PER_GET_TIM (); / * Get date 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 valid * / } }



Return to previous page Return to menu Go to next page