2 FUJITSU FM16beta Emulator 'eFM16beta'
4 Author : Takeda.Toshiya
12 void CMOS::initialize()
15 memset(cmos, 0, sizeof(cmos));
18 FILEIO* fio = new FILEIO();
19 if(fio->Fopen(create_local_path(_T("CMOS.BIN")), FILEIO_READ_BINARY)) {
20 fio->Fread(cmos, sizeof(cmos), 1);
29 FILEIO* fio = new FILEIO();
30 if(fio->Fopen(create_local_path(_T("CMOS.BIN")), FILEIO_WRITE_BINARY)) {
31 fio->Fwrite(cmos, sizeof(cmos), 1);
38 void CMOS::write_io8(uint32_t addr, uint32_t data)
40 if(cmos[addr & 0x7ff] != data) {
41 cmos[addr & 0x7ff] = data;
46 uint32_t CMOS::read_io8(uint32_t addr)
48 return cmos[addr & 0x7ff];
51 #define STATE_VERSION 1
53 #include "../../statesub.h"
55 void CMOS::decl_state()
57 enter_decl_state(STATE_VERSION);
59 DECL_STATE_ENTRY_1D_ARRAY(cmos, sizeof(cmos));
60 DECL_STATE_ENTRY_BOOL(modified);
64 void CMOS::save_state(FILEIO* state_fio)
66 if(state_entry != NULL) {
67 state_entry->save_state(state_fio);
70 // state_fio->FputUint32(STATE_VERSION);
71 // state_fio->FputInt32(this_device_id);
73 // state_fio->Fwrite(cmos, sizeof(cmos), 1);
74 // state_fio->FputBool(modified);
77 bool CMOS::load_state(FILEIO* state_fio)
80 if(state_entry != NULL) {
81 mb = state_entry->load_state(state_fio);
87 // if(state_fio->FgetUint32() != STATE_VERSION) {
90 // if(state_fio->FgetInt32() != this_device_id) {
93 // state_fio->Fread(cmos, sizeof(cmos), 1);
94 // modified = state_fio->FgetBool();
98 bool CMOS::process_state(FILEIO* state_fio, bool loading)
100 if(!state_fio->StateCheckUint32(STATE_VERSION)) {
103 if(!state_fio->StateCheckInt32(this_device_id)) {
106 state_fio->StateBuffer(cmos, sizeof(cmos), 1);
107 state_fio->StateBool(modified);