//#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
-#if defined(_USE_QT)
dummy->set_device_name(_T("1st Dummy"));
- event->set_device_name(_T("EVENT"));
-#endif
crtc = new HD46505(this, emu);
dma = new I8237(this, emu);
#ifndef TYPE_SL
dma2 = new I8237(this, emu);
#endif
-#if defined(_USE_QT)
- crtc->set_device_name(_T("HD46505 CRTC"));
- #ifdef TYPE_SL
- dma->set_device_name(_T("i8237 DMAC"));
- #else
+#ifndef TYPE_SL
dma->set_device_name(_T("i8237 DMAC #1"));
dma2->set_device_name(_T("i8237 DMAC #2"));
- #endif
#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
rtc = new HD146818P(this, emu);
#endif
-#if defined(_USE_QT)
- pit->set_device_name(_T("i8253 PIT"));
- pic->set_device_name(_T("i8259 PIC"));
- cpu->set_device_name(_T("CPU(i86)"));
- io->set_device_name(_T("I/O BUS"));
- pcm->set_device_name(_T("SOUND DEVICE"));
- #ifdef TYPE_SL
- rtc->set_device_name(_T("RP5C01 RTC"));
- #else
- rtc->set_device_name(_T("HD146818P RTC"));
- #endif
-#endif
+
display = new DISPLAY(this, emu);
dmareg = new DMAREG(this, emu);
floppy = new FLOPPY(this, emu);
memory = new MEMORY(this, emu);
sasi = new SASI(this, emu);
system = new SYSTEM(this, emu);
-#if defined(_USE_QT)
- display->set_device_name(_T("DISPLAY"));
- dmareg->set_device_name(_T("DMA REG"));
- floppy->set_device_name(_T("FLOPPY"));
- keyboard->set_device_name(_T("KEYBOARD"));
- display->set_device_name(_T("DISPLAY"));
- sasi->set_device_name(_T("SASI I/F"));
- system->set_device_name(_T("SYSTEM"));
-#endif
// 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
+
+// ----------------------------------------------------------------------------
+// draw screen
+// ----------------------------------------------------------------------------
-uint32_t VM::get_access_lamp_status()
+void VM::draw_screen()
{
- uint32_t status = fdc->read_signal(0);
- return (status & (1 | 4)) ? 1 : (status & (2 | 8)) ? 2 : 0;
+ display->draw_screen();
}
// ----------------------------------------------------------------------------
{
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();