#include "../pcm1bit.h"
#include "./fm7_mainmem.h"
-#include "bubblecasette.h"
+#include "./bubblecasette.h"
-FM8_MAINIO::FM8_MAINIO(VM* parent_vm, EMU* parent_emu) : FM7_MAINIO(parent_vm, parent_emu)
+namespace FM7 {
+FM8_MAINIO::FM8_MAINIO(VM_TEMPLATE* parent_vm, EMU* parent_emu) : FM7_MAINIO(parent_vm, parent_emu)
{
psg = NULL;
bubble_casette[0] = NULL;
dmac = NULL;
#endif
set_device_name(_T("FM-8 MAIN I/O"));
+
}
FM8_MAINIO::~FM8_MAINIO()
uint8_t val = 0xff;
return val;
}
-void FM8_MAINIO::opn_note_on(int index)
-{
-}
-
void FM8_MAINIO::write_signal(int id, uint32_t data, uint32_t mask)
{
bool val_b = ((data & mask) != 0);
mainmem->write_signal(FM7_MAINIO_BOOTMODE, bootmode, 0xffffffff);
}
-#define STATE_VERSION 11
-
-void FM8_MAINIO::save_state(FILEIO *state_fio)
+bool FM8_MAINIO::decl_state(FILEIO *state_fio, bool loading)
{
- int ch;
- int addr;
- state_fio->FputUint32_BE(STATE_VERSION);
- state_fio->FputInt32_BE(this_device_id);
- this->out_debug_log(_T("Save State: MAINIO(FM8): id=%d ver=%d\n"), this_device_id, STATE_VERSION);
-
- FM7_MAINIO::save_state_main(state_fio);
- // FD0B
- // FD0F
- state_fio->FputBool(connect_psg);
- {
- state_fio->FputUint32_BE(opn_address[0]);
- state_fio->FputUint32_BE(opn_data[0]);
- state_fio->FputUint32_BE(opn_stat[0]);
- state_fio->FputUint32_BE(opn_cmdreg[0]);
- state_fio->FputUint32_BE(opn_ch3mode[0]);
+ if(!FM7_MAINIO::decl_state(state_fio, loading)) {
+ return false;
}
+ state_fio->StateBool(connect_psg);
+
+ return true;
}
+void FM8_MAINIO::save_state(FILEIO *state_fio)
+{
+ decl_state(state_fio, false);
+}
+
bool FM8_MAINIO::load_state(FILEIO *state_fio)
{
- uint32_t version;
-
- version = state_fio->FgetUint32_BE();
- if(this_device_id != state_fio->FgetInt32_BE()) return false;
- this->out_debug_log(_T("Load State: MAINIO(FM8): id=%d ver=%d\n"), this_device_id, version);
+ bool mb = decl_state(state_fio, true);
+ return mb;
+}
- if(!FM7_MAINIO::load_state_main(state_fio, version)) return false;
- connect_psg = state_fio->FgetBool();
- {
- opn_address[0] = state_fio->FgetUint32_BE();
- opn_data[0] = state_fio->FgetUint32_BE();
- opn_stat[0] = state_fio->FgetUint32_BE();
- opn_cmdreg[0] = state_fio->FgetUint32_BE();
- opn_ch3mode[0] = state_fio->FgetUint32_BE();
- }
- if(version != STATE_VERSION) return false;
- return true;
}