//#include "../i8250.h"
#include "../i8253.h"
#include "../i8259.h"
-#include "../i86.h"
+//#if defined(HAS_I286)
+#include "../i286.h"
+//#else
+//#include "../i86.h"
+//#endif
#include "../io.h"
+#include "../noise.h"
#include "../pcm1bit.h"
#include "../upd765a.h"
#ifdef TYPE_SL
#include "../hd146818p.h"
#endif
+#ifdef USE_DEBUGGER
+#include "../debugger.h"
+#endif
+
#include "display.h"
#include "dmareg.h"
#include "floppy.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;
dummy = new DEVICE(this, emu); // must be 1st device
event = new EVENT(this, emu); // must be 2nd device
+ dummy->set_device_name(_T("1st Dummy"));
crtc = new HD46505(this, emu);
dma = new I8237(this, emu);
#ifndef TYPE_SL
dma2 = new I8237(this, emu);
#endif
+#ifndef TYPE_SL
+ dma->set_device_name(_T("i8237 DMAC #1"));
+ dma2->set_device_name(_T("i8237 DMAC #2"));
+#endif
// sio = new I8250(this, emu);
pit = new I8253(this, emu); // i8254
pic = new I8259(this, emu);
- cpu = new I86(this, emu);
+//#if defined(HAS_I286)
+ cpu = new I286(this, emu);
+//#else
+// cpu = new I86(this, emu);
+//#endif
io = new IO(this, emu);
pcm = new PCM1BIT(this, emu);
fdc = new UPD765A(this, emu);
+ fdc->set_context_noise_seek(new NOISE(this, emu));
+ fdc->set_context_noise_head_down(new NOISE(this, emu));
+ fdc->set_context_noise_head_up(new NOISE(this, emu));
#ifdef TYPE_SL
rtc = new RP5C01(this, emu);
#else
memory = new MEMORY(this, emu);
sasi = new SASI(this, emu);
system = new SYSTEM(this, emu);
-
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(pcm);
-
+ event->set_context_sound(fdc->get_context_noise_seek());
+ event->set_context_sound(fdc->get_context_noise_head_down());
+ event->set_context_sound(fdc->get_context_noise_head_up());
+
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(pic);
+#ifdef USE_DEBUGGER
+ cpu->set_context_debugger(new DEBUGGER(this, emu));
+#endif
// dmac
io->set_iomap_range_rw(0x00, 0x0f, dma);
io->set_flipflop_single_rw(i, iovalues[i & 0x1f]);
}
#endif
-
-
-
-
-
// initialize all devices
+#if defined(__GIT_REPO_VERSION)
+ strncpy(_git_revision, __GIT_REPO_VERSION, sizeof(_git_revision) - 1);
+#endif
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
+#ifdef TYPE_SL
+ //pcm->set_realtime_render(true);
+#endif
}
VM::~VM()
}
// ----------------------------------------------------------------------------
-// draw screen
+// debugger
// ----------------------------------------------------------------------------
-void VM::draw_screen()
+#ifdef USE_DEBUGGER
+DEVICE *VM::get_cpu(int index)
{
- display->draw_screen();
+ if(index == 0) {
+ return cpu;
+ }
+ return NULL;
}
+#endif
-int VM::get_access_lamp_status()
+// ----------------------------------------------------------------------------
+// draw screen
+// ----------------------------------------------------------------------------
+
+void VM::draw_screen()
{
- uint32 status = fdc->read_signal(0);
- return (status & (1 | 4)) ? 1 : (status & (2 | 8)) ? 2 : 0;
+ display->draw_screen();
}
// ----------------------------------------------------------------------------
pcm->initialize_sound(rate, 8000);
}
-uint16* VM::create_sound(int* extra_frames)
+uint16_t* VM::create_sound(int* extra_frames)
{
return event->create_sound(extra_frames);
}
{
if(ch == 0) {
pcm->set_volume(0, decibel_l, decibel_r);
+ } else if(ch == 1) {
+ fdc->get_context_noise_seek()->set_volume(0, decibel_l, decibel_r);
+ fdc->get_context_noise_head_down()->set_volume(0, decibel_l, decibel_r);
+ fdc->get_context_noise_head_up()->set_volume(0, decibel_l, decibel_r);
}
}
#endif
return fdc->is_disk_protected(drv);
}
+uint32_t VM::is_floppy_disk_accessed()
+{
+ return fdc->read_signal(0);
+}
+
bool VM::is_frame_skippable()
{
return event->is_frame_skippable();