X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fj3100%2Fj3100.cpp;h=bd0978b12d0ef1de72dc21b8f56f723edf7b47dd;hb=90a1d498c79c26d69c78435600856b152aa07291;hp=db7750c87952718d60e9e83d7da82ad43bd1f63c;hpb=ef7e2d55278936e3e2a6fea6440dd46a783137b6;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/j3100/j3100.cpp b/source/src/vm/j3100/j3100.cpp index db7750c87..bd0978b12 100644 --- a/source/src/vm/j3100/j3100.cpp +++ b/source/src/vm/j3100/j3100.cpp @@ -18,8 +18,13 @@ //#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 @@ -28,6 +33,10 @@ #include "../hd146818p.h" #endif +#ifdef USE_DEBUGGER +#include "../debugger.h" +#endif + #include "display.h" #include "dmareg.h" #include "floppy.h" @@ -46,25 +55,37 @@ // 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 @@ -78,15 +99,20 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) 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); @@ -223,15 +249,16 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) 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() @@ -273,18 +300,26 @@ void VM::run() } // ---------------------------------------------------------------------------- -// 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(); } // ---------------------------------------------------------------------------- @@ -300,7 +335,7 @@ void VM::initialize_sound(int rate, int samples) 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); } @@ -315,6 +350,10 @@ void VM::set_sound_device_volume(int ch, int decibel_l, int decibel_r) { 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 @@ -362,6 +401,11 @@ bool VM::is_floppy_disk_protected(int drv) 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();