#include "sega_per.h" #define BUP_START_ADDR 0x60????0 /* ライブラリを読み込むアドレスの指定 */ #include "sega_bup.h" Uint32 BackUpRamWork[2048+30]; /* 2048=ブロックアクセステーブル */ /* 30=バックアップライブラリ変数領域 */ main() { BupConfig conf[3]; BupStat sttb; BupDir writetb; BupDate datatb; Uint8 *time;PER_SMPC_RES_DIS(); /* リセットボタン無効 */ BUP_Init(BUP_START_ADDR, BackUpRamWork, conf); if(BUP_Stat(0, &sttb)==BUP_UNFORMAT){ BUP_Format(0); } PER_SMPC_RES_ENA(); /* リセットボタン有効 */ 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(); /* 日付時間取得 */ 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(); /* リセットボタン無効 */ BUP_Write(0, &writetb, "Dummy Data"); PER_SMPC_RES_ENA(); /* リセットボタン有効 */ } }