#include "../i8251.h"
#include "../i8255.h"
#include "../i8259.h"
-#include "../i86.h"
+#include "../i286.h"
#include "../io.h"
#include "../memory.h"
#include "../msm58321.h"
// initialize
// ----------------------------------------------------------------------------
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
{
// create devices
first_device = last_device = NULL;
pio1 = new I8255(this, emu);
pio1->set_device_name(_T("8255 PIO (CRTC)"));
pic = new I8259(this, emu);
- cpu = new I86(this, emu);
+ cpu = new I286(this, emu);
io = new IO(this, emu);
memory = new MEMORY(this, emu);
rtc = new MSM58321(this, emu);
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
- for(int i = 0; i < 4; i++) {
- fdc->set_drive_type(i, DRIVE_TYPE_2D);
- }
+ decl_state();
}
VM::~VM()
for(DEVICE* device = first_device; device; device = device->next_device) {
device->reset();
}
+ for(int i = 0; i < 4; i++) {
+ if(config.drive_type) {
+ fdc->set_drive_type(i, DRIVE_TYPE_2DD);
+ } else {
+ fdc->set_drive_type(i, DRIVE_TYPE_2D);
+ }
+ }
}
void VM::run()
}
}
-#define STATE_VERSION 2
+#define STATE_VERSION 3
+
+#include "../../statesub.h"
+#include "../../qt/gui/csp_logger.h"
+extern CSP_Logger DLL_PREFIX_I *csp_logger;
+
+void VM::decl_state(void)
+{
+ state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::PC_100_HEAD")), csp_logger);
+ DECL_STATE_ENTRY_1D_ARRAY(ram, sizeof(ram));
+ for(DEVICE* device = first_device; device; device = device->next_device) {
+ device->decl_state();
+ }
+}
void VM::save_state(FILEIO* state_fio)
{
- state_fio->FputUint32(STATE_VERSION);
+ //state_fio->FputUint32(STATE_VERSION);
+ if(state_entry != NULL) {
+ state_entry->save_state(state_fio);
+ }
for(DEVICE* device = first_device; device; device = device->next_device) {
device->save_state(state_fio);
}
- state_fio->Fwrite(ram, sizeof(ram), 1);
+ //state_fio->Fwrite(ram, sizeof(ram), 1);
}
bool VM::load_state(FILEIO* state_fio)
{
- if(state_fio->FgetUint32() != STATE_VERSION) {
+ //if(state_fio->FgetUint32() != STATE_VERSION) {
+ // return false;
+ //}
+ bool mb = false;
+ if(state_entry != NULL) {
+ mb = state_entry->load_state(state_fio);
+ }
+ if(!mb) {
+ emu->out_debug_log("INFO: HEADER DATA ERROR");
return false;
}
for(DEVICE* device = first_device; device; device = device->next_device) {