X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fpc9801%2Fpc9801.cpp;h=a35b5a4d79db0400079b0e33e7f634d9164f0804;hb=1bd2ef0d39e50c7d1c0b192540e24c5c934abc44;hp=c091e95dff0cfbf37d64bf7cbf0f93bece91d09f;hpb=1f5a5a6cbfcc92741b6df4024ee1d70b7f2de3a9;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/pc9801/pc9801.cpp b/source/src/vm/pc9801/pc9801.cpp index c091e95df..a35b5a4d7 100644 --- a/source/src/vm/pc9801/pc9801.cpp +++ b/source/src/vm/pc9801/pc9801.cpp @@ -78,6 +78,7 @@ #include "mouse.h" #if defined(SUPPORT_SASI_IF) #include "sasi.h" +#include "sasi_bios.h" #endif #if defined(SUPPORT_SCSI_IF) #include "scsi.h" @@ -102,6 +103,7 @@ using PC9801::MEMBUS; using PC9801::MOUSE; #if defined(SUPPORT_SASI_IF) using PC9801::SASI; +using PC9801::BIOS; #endif #if defined(SUPPORT_SCSI_IF) using PC9801::SCSI; @@ -277,7 +279,11 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) if(sound_type == 0 || sound_type == 1) { opn = new YM2203(this, emu); #ifdef SUPPORT_PC98_OPNA + opn->set_device_name(_T("YM2608 OPNA (PC-9801-86)")); opn->is_ym2608 = true; +#else + opn->set_device_name(_T("YM2203 OPN (PC-9801-26)")); + opn->is_ym2608 = false; #endif fmsound = new FMSOUND(this, emu); joystick = new JOYSTICK(this, emu); @@ -312,6 +318,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) mouse = new MOUSE(this, emu); #if defined(SUPPORT_SASI_IF) sasi = new SASI(this, emu); + sasi_bios = new BIOS(this, emu); #endif #if defined(SUPPORT_SCSI_IF) scsi = new SCSI(this, emu); @@ -509,6 +516,13 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) sasi->set_context_hdd(sasi_hdd); sasi->set_context_dma(dma); sasi->set_context_pic(pic); + + sasi_bios->set_context_sasi(sasi); + sasi_bios->set_context_memory(memory); + sasi_bios->set_context_cpu(cpu); + sasi_bios->set_context_pic(pic); + cpu->set_context_bios(sasi_bios); + #endif #if defined(SUPPORT_SCSI_IF) dma->set_context_ch0(scsi); @@ -837,14 +851,15 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) pc88rtc = new UPD1990A(this, emu); pc88rtc->set_device_name(_T("uPD1990A RTC (PC-8801)")); pc88rtc->set_context_event_manager(pc88event); - pc88opn = new YM2203(this, emu); + pc88opn1 = new YM2203(this, emu); #ifdef SUPPORT_PC88_OPNA - pc88opn->set_device_name(_T("YM2608 OPNA (PC-8801)")); - pc88opn->is_ym2608 = true; + pc88opn1->set_device_name(_T("YM2608 OPNA (PC-8801)")); + pc88opn1->is_ym2608 = true; #else - pc88opn->set_device_name(_T("YM2203 OPN (PC-8801)")); + pc88opn1->set_device_name(_T("YM2203 OPN (PC-8801)")); + pc88opn1->is_ym2608 = false; #endif - pc88opn->set_context_event_manager(pc88event); + pc88opn1->set_context_event_manager(pc88event); pc88cpu = new Z80(this, emu); pc88cpu->set_device_name(_T("Z80 CPU (PC-8801)")); pc88cpu->set_context_event_manager(pc88event); @@ -880,14 +895,14 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) pc88event->set_context_cpu(pc88cpu, (config.cpu_type == 1) ? 3993624 : 7987248); pc88event->set_context_cpu(pc88cpu_sub, 3993624); - pc88event->set_context_sound(pc88opn); + pc88event->set_context_sound(pc88opn1); pc88event->set_context_sound(pc88pcm); pc88event->set_context_sound(pc88noise_seek); pc88event->set_context_sound(pc88noise_head_down); pc88event->set_context_sound(pc88noise_head_up); pc88->set_context_cpu(pc88cpu); - pc88->set_context_opn(pc88opn); + pc88->set_context_opn1(pc88opn1); pc88->set_context_pcm(pc88pcm); pc88->set_context_pio(pc88pio); pc88->set_context_prn(pc88prn); @@ -899,7 +914,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) #ifdef USE_DEBUGGER pc88cpu->set_context_debugger(new DEBUGGER(this, emu)); #endif - pc88opn->set_context_irq(pc88, SIG_PC88_SOUND_IRQ, 1); + pc88opn1->set_context_irq(pc88, SIG_PC88_OPN1_IRQ, 1); pc88sio->set_context_rxrdy(pc88, SIG_PC88_USART_IRQ, 1); pc88sio->set_context_out(pc88, SIG_PC88_USART_OUT); @@ -1133,7 +1148,7 @@ void VM::reset() #endif #if defined(_PC98DO) || defined(_PC98DOPLUS) - pc88opn->set_reg(0x29, 3); // for Misty Blue + pc88opn1->set_reg(0x29, 3); // for Misty Blue pc88pio->write_signal(SIG_I8255_PORT_C, 0, 0xff); pc88pio_sub->write_signal(SIG_I8255_PORT_C, 0, 0xff); #endif @@ -1217,11 +1232,11 @@ void VM::initialize_sound(int rate, int samples) beep->initialize_sound(rate, 8000); #endif if(sound_type == 0 || sound_type == 1) { -#ifdef HAS_YM2608 - opn->initialize_sound(rate, 7987248, samples, 0, 0); -#else - opn->initialize_sound(rate, 3993624, samples, 0, 0); -#endif + if(opn->is_ym2608) { + opn->initialize_sound(rate, 7987248, samples, 0, 0); + } else { + opn->initialize_sound(rate, 3993624, samples, 0, 0); + } } else if(sound_type == 2 || sound_type == 3) { tms3631->initialize_sound(rate, 8000); } @@ -1231,11 +1246,11 @@ void VM::initialize_sound(int rate, int samples) pc88event->initialize_sound(rate, samples); // init sound gen -#ifdef HAS_YM2608 - pc88opn->initialize_sound(rate, 7987248, samples, 0, 0); -#else - pc88opn->initialize_sound(rate, 3993624, samples, 0, 0); -#endif + if(pc88opn1->is_ym2608) { + pc88opn1->initialize_sound(rate, 7987248, samples, 0, 0); + } else { + pc88opn1->initialize_sound(rate, 3993624, samples, 0, 0); + } pc88pcm->initialize_sound(rate, 8000); #endif } @@ -1289,14 +1304,14 @@ void VM::set_sound_device_volume(int ch, int decibel_l, int decibel_r) beep->set_volume(0, decibel_l, decibel_r); #if defined(_PC98DO) || defined(_PC98DOPLUS) } else if(ch-- == 0) { - pc88opn->set_volume(0, decibel_l, decibel_r); + pc88opn1->set_volume(0, decibel_l, decibel_r); } else if(ch-- == 0) { - pc88opn->set_volume(1, decibel_l, decibel_r); + pc88opn1->set_volume(1, decibel_l, decibel_r); #if defined(SUPPORT_PC88_OPNA) } else if(ch-- == 0) { - pc88opn->set_volume(2, decibel_l, decibel_r); + pc88opn1->set_volume(2, decibel_l, decibel_r); } else if(ch-- == 0) { - pc88opn->set_volume(3, decibel_l, decibel_r); + pc88opn1->set_volume(3, decibel_l, decibel_r); #endif } else if(ch-- == 0) { pc88pcm->set_volume(0, decibel_l, decibel_r); @@ -1604,7 +1619,7 @@ void VM::update_config() } } -#define STATE_VERSION 13 +#define STATE_VERSION 14 bool VM::process_state(FILEIO* state_fio, bool loading) {