OSDN Git Service

[VM][General][WIP] Apply new (Upstream 2016-02-21) APIs to VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mycomz80a / mycomz80a.cpp
index ed383c8..ac0af63 100644 (file)
@@ -94,12 +94,12 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
        //              pc5     out     rtc rd
        //              pc6     out     rtc wr
        //              pc7     out     rtc cs
-       drec->set_context_out(pio2, SIG_I8255_PORT_A, 4);
+       drec->set_context_ear(pio2, SIG_I8255_PORT_A, 4);
        crtc->set_context_disp(pio2, SIG_I8255_PORT_A, 0x80);
        pio1->set_context_port_a(display, SIG_DISPLAY_ADDR_L, 0xff, 0);
        pio1->set_context_port_a(psg, SIG_SN76489AN_DATA, 0xff, 0);
        pio1->set_context_port_c(display, SIG_DISPLAY_ADDR_H, 7, 0);
-       pio2->set_context_port_c(drec, SIG_DATAREC_OUT, 4, 0);
+       pio2->set_context_port_c(drec, SIG_DATAREC_MIC, 4, 0);
        pio2->set_context_port_c(drec, SIG_DATAREC_REMOTE, 8, 0);
        pio2->set_context_port_c(psg, SIG_SN76489AN_WE, 0x10, 0);
        pio2->set_context_port_c(psg, SIG_SN76489AN_CS, 0x20, 0);
@@ -177,9 +177,9 @@ void VM::run()
        event->drive();
 }
 
-double VM::frame_rate()
+double VM::get_frame_rate()
 {
-       return event->frame_rate();
+       return event->get_frame_rate();
 }
 
 // ----------------------------------------------------------------------------
@@ -215,7 +215,7 @@ void VM::initialize_sound(int rate, int samples)
        event->initialize_sound(rate, samples);
        
        // init sound gen
-       psg->init(rate, 2500800, 10000);
+       psg->initialize_sound(rate, 2500800, 10000);
 }
 
 uint16* VM::create_sound(int* extra_frames)
@@ -223,11 +223,22 @@ uint16* VM::create_sound(int* extra_frames)
        return event->create_sound(extra_frames);
 }
 
-int VM::sound_buffer_ptr()
+int VM::get_sound_buffer_ptr()
 {
-       return event->sound_buffer_ptr();
+       return event->get_sound_buffer_ptr();
 }
 
+#ifdef USE_SOUND_VOLUME
+void VM::set_sound_device_volume(int ch, int decibel_l, int decibel_r)
+{
+       if(ch == 0) {
+               psg->set_volume(0, decibel_l, decibel_r);
+       } else if(ch == 1) {
+               drec->set_volume(0, decibel_l, decibel_r);
+       }
+}
+#endif
+
 // ----------------------------------------------------------------------------
 // notify key
 // ----------------------------------------------------------------------------
@@ -246,13 +257,13 @@ void VM::key_up(int code)
 // user interface
 // ----------------------------------------------------------------------------
 
-void VM::play_tape(_TCHAR* file_path)
+void VM::play_tape(const _TCHAR* file_path)
 {
        drec->play_tape(file_path);
 //     drec->write_signal(SIG_DATAREC_REMOTE, 1, 1);
 }
 
-void VM::rec_tape(_TCHAR* file_path)
+void VM::rec_tape(const _TCHAR* file_path)
 {
        drec->rec_tape(file_path);
 //     drec->write_signal(SIG_DATAREC_REMOTE, 1, 1);
@@ -264,14 +275,29 @@ void VM::close_tape()
 //     drec->write_signal(SIG_DATAREC_REMOTE, 0, 1);
 }
 
-bool VM::tape_inserted()
+bool VM::is_tape_inserted()
+{
+       return drec->is_tape_inserted();
+}
+
+bool VM::is_tape_playing()
+{
+       return drec->is_tape_playing();
+}
+
+bool VM::is_tape_recording()
+{
+       return drec->is_tape_recording();
+}
+
+int VM::get_tape_position()
 {
-       return drec->tape_inserted();
+       return drec->get_tape_position();
 }
 
-bool VM::now_skip()
+bool VM::is_frame_skippable()
 {
-       return event->now_skip();
+       return event->is_frame_skippable();
 }
 
 void VM::update_config()