2 SHARP MZ-80B Emulator 'EmuZ-80B'
3 SHARP MZ-2200 Emulator 'EmuZ-2200'
5 Author : Takeda.Toshiya
8 [ MZ-1R12 (32KB SRAM) ]
15 void MZ1R12::initialize()
17 memset(sram, 0, sizeof(sram));
20 FILEIO* fio = new FILEIO();
22 if(fio->Fopen(create_local_path(_T("MZ-1E18.ROM")), FILEIO_READ_BINARY)) {
23 fio->Fread(sram, sizeof(sram), 1);
28 if(fio->Fopen(create_local_path(_T("MZ-1R12.BIN")), FILEIO_READ_BINARY)) {
29 fio->Fread(sram, sizeof(sram), 1);
35 crc32 = get_crc32(sram, sizeof(sram));
38 void MZ1R12::release()
40 if(!read_only && crc32 != get_crc32(sram, sizeof(sram))) {
41 FILEIO* fio = new FILEIO();
42 if(fio->Fopen(create_local_path(_T("MZ-1R12.BIN")), FILEIO_WRITE_BINARY)) {
43 fio->Fwrite(sram, sizeof(sram), 1);
50 void MZ1R12::write_io8(uint32_t addr, uint32_t data)
54 address = (address & 0x00ff) | (data << 8);
57 address = (address & 0xff00) | (data << 0);
61 sram[address & 0x7fff] = data;
68 uint32_t MZ1R12::read_io8(uint32_t addr)
75 return sram[(address++) & 0x7fff];
80 #define STATE_VERSION 1
82 bool MZ1R12::process_state(FILEIO* state_fio, bool loading)
84 if(!state_fio->StateCheckUint32(STATE_VERSION)) {
87 if(!state_fio->StateCheckInt32(this_device_id)) {
90 state_fio->StateArray(sram, sizeof(sram), 1);
91 state_fio->StateValue(read_only);
92 state_fio->StateValue(address);
93 state_fio->StateValue(crc32);