OSDN Git Service

[General] Convert sourcecode's CRLF format: DOS(WINDOWS) to Unix, to apply patches...
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2800 / mz2800.cpp
index de2e605..b2cb955 100644 (file)
-/*\r
-       SHARP MZ-2800 Emulator 'EmuZ-2800'\r
-\r
-       Author : Takeda.Toshiya\r
-       Date   : 2007.08.13 -\r
-\r
-       [ virtual machine ]\r
-*/\r
-\r
-#include "mz2800.h"\r
-#include "../../emu.h"\r
-#include "../device.h"\r
-#include "../event.h"\r
-\r
-#include "../i8253.h"\r
-#include "../i8255.h"\r
-#include "../i8259.h"\r
-#include "../i286.h"\r
-#include "../io.h"\r
-#include "../mb8877.h"\r
-#include "../pcm1bit.h"\r
-#include "../rp5c01.h"\r
-//#include "../sasi.h"\r
-#include "../upd71071.h"\r
-#include "../ym2203.h"\r
-#include "../z80pio.h"\r
-#include "../z80sio.h"\r
-\r
-#ifdef USE_DEBUGGER\r
-#include "../debugger.h"\r
-#endif\r
-\r
-#include "crtc.h"\r
-#include "floppy.h"\r
-#include "joystick.h"\r
-#include "keyboard.h"\r
-#include "memory.h"\r
-#include "mouse.h"\r
-#include "reset.h"\r
-#include "serial.h"\r
-#include "sysport.h"\r
-\r
-// ----------------------------------------------------------------------------\r
-// initialize\r
-// ----------------------------------------------------------------------------\r
-\r
-VM::VM(EMU* parent_emu) : emu(parent_emu)\r
-{\r
-       // create devices\r
-       first_device = last_device = NULL;\r
-       dummy = new DEVICE(this, emu);  // must be 1st device\r
-       event = new EVENT(this, emu);   // must be 2nd device\r
-       \r
-       cpu = new I286(this, emu);\r
-       pit = new I8253(this, emu);\r
-       pio0 = new I8255(this, emu);\r
-       pic = new I8259(this, emu);\r
-       io = new IO(this, emu);\r
-       fdc = new MB8877(this, emu);\r
-       pcm = new PCM1BIT(this, emu);\r
-       rtc = new RP5C01(this, emu);    // RP-5C15\r
-//     sasi = new SASI(this, emu);\r
-       dma = new UPD71071(this, emu);\r
-       opn = new YM2203(this, emu);\r
-       pio1 = new Z80PIO(this, emu);\r
-       sio = new Z80SIO(this, emu);\r
-       \r
-       crtc = new CRTC(this, emu);\r
-       floppy = new FLOPPY(this, emu);\r
-       joystick = new JOYSTICK(this, emu);\r
-       keyboard = new KEYBOARD(this, emu);\r
-       memory = new MEMORY(this, emu);\r
-       mouse = new MOUSE(this, emu);\r
-       rst = new RESET(this, emu);\r
-       serial = new SERIAL(this, emu);\r
-       sysport = new SYSPORT(this, emu);\r
-       \r
-       // set contexts\r
-       event->set_context_cpu(cpu);\r
-       event->set_context_sound(opn);\r
-       event->set_context_sound(pcm);\r
-       \r
-       pit->set_constant_clock(0, 31250);\r
-       pit->set_constant_clock(2, 31250);\r
-       pit->set_context_ch0(pit, SIG_I8253_CLOCK_1, 1);\r
-       pit->set_context_ch0(pic, SIG_I8259_CHIP0 | SIG_I8259_IR0, 1);\r
-       pit->set_context_ch1(pic, SIG_I8259_CHIP0 | SIG_I8259_IR6, 1);\r
-       pit->set_context_ch2(pic, SIG_I8259_CHIP1 | SIG_I8259_IR0, 1);\r
-       pio0->set_context_port_c(rst, SIG_RESET_CONTROL, 0xff, 0);\r
-       pio0->set_context_port_c(crtc, SIG_CRTC_MASK, 0x01, 0);\r
-       pio0->set_context_port_c(pcm, SIG_PCM1BIT_SIGNAL, 0x04, 0);\r
-       pic->set_context_cpu(cpu);\r
-       fdc->set_context_drq(dma, SIG_UPD71071_CH1, 1);\r
-       fdc->set_context_irq(pic, SIG_I8259_CHIP0 | SIG_I8259_IR5, 1);\r
-       rtc->set_context_alarm(pic, SIG_I8259_CHIP1 | SIG_I8259_IR2, 1);\r
-       rtc->set_context_pulse(opn, SIG_YM2203_PORT_B, 8);\r
-//     sasi->set_context_drq(dma, SIG_UPD71071_CH0, 1);\r
-//     sasi->set_context_irq(pic, SIG_I8259_CHIP0 | SIG_I8259_IR4, 1);\r
-       dma->set_context_memory(memory);\r
-//     dma->set_context_ch0(sasi);\r
-       dma->set_context_ch1(fdc);\r
-       dma->set_context_tc(pic, SIG_I8259_CHIP0 | SIG_I8259_IR3, 1);\r
-       opn->set_context_irq(pic, SIG_I8259_CHIP1 | SIG_I8259_IR7, 1);\r
-       opn->set_context_port_a(crtc, SIG_CRTC_PALLETE, 0x04, 0);\r
-       opn->set_context_port_a(mouse, SIG_MOUSE_SEL, 0x08, 0);\r
-       pio1->set_context_port_a(crtc, SIG_CRTC_COLUMN_SIZE, 0x20, 0);\r
-       pio1->set_context_port_a(keyboard, SIG_KEYBOARD_COLUMN, 0xff, 0);\r
-       sio->set_context_intr(pic, SIG_I8259_CHIP0 | SIG_I8259_IR2);\r
-       sio->set_context_dtr1(mouse, SIG_MOUSE_DTR, 1);\r
-       \r
-       crtc->set_context_pic(pic);\r
-       crtc->set_context_pio(pio0);\r
-       crtc->set_vram_ptr(memory->get_vram());\r
-       crtc->set_tvram_ptr(memory->get_tvram());\r
-       crtc->set_kanji_ptr(memory->get_kanji());\r
-       crtc->set_pcg_ptr(memory->get_pcg());\r
-       floppy->set_context_fdc(fdc);\r
-       keyboard->set_context_pio0(pio0);\r
-       keyboard->set_context_pio1(pio1);\r
-       memory->set_context_crtc(crtc);\r
-       mouse->set_context_sio(sio);\r
-       serial->set_context_sio(sio);\r
-       sysport->set_context_pit(pit);\r
-       sysport->set_context_sio(sio);\r
-       \r
-       // cpu bus\r
-       cpu->set_context_mem(memory);\r
-       cpu->set_context_io(io);\r
-       cpu->set_context_intr(pic);\r
-#ifdef SINGLE_MODE_DMA\r
-       cpu->set_context_dma(dma);\r
-#endif\r
-#ifdef USE_DEBUGGER\r
-       cpu->set_context_debugger(new DEBUGGER(this, emu));\r
-#endif\r
-       \r
-       // i/o bus\r
-       io->set_iomap_range_rw(0x70, 0x7f, dma);\r
-       io->set_iomap_alias_rw(0x80, pic, I8259_ADDR_CHIP0 | 0);\r
-       io->set_iomap_alias_rw(0x81, pic, I8259_ADDR_CHIP0 | 1);\r
-       io->set_iomap_alias_rw(0x82, pic, I8259_ADDR_CHIP1 | 0);\r
-       io->set_iomap_alias_rw(0x83, pic, I8259_ADDR_CHIP1 | 1);\r
-       io->set_iomap_range_rw(0x8c, 0x8d, memory);\r
-       io->set_iovalue_single_r(0x8e, 0xff);   // dipswitch\r
-       io->set_flipflop_single_rw(0x8f, 0x00); // shut\r
-       io->set_iomap_range_rw(0xa0, 0xa3, serial);\r
-       for(uint32 p = 0xae; p <= 0x1fae; p += 0x100) {\r
-               io->set_iomap_single_w(p, crtc);\r
-       }\r
-//     io->set_iomap_single_rw(0xaf, sasi);\r
-       io->set_iomap_range_rw(0xb0, 0xb3, serial);\r
-       io->set_iomap_single_r(0xbe, sysport);\r
-       io->set_iomap_range_rw(0xc8, 0xc9, opn);\r
-       io->set_iovalue_single_r(0xca, 0x7f);   // voice communication ???\r
-       for(uint32 p = 0xcc; p <= 0xfcc; p += 0x100) {\r
-               io->set_iomap_alias_rw(p, rtc, p >> 8);\r
-       }\r
-       io->set_iomap_single_w(0xcd, serial);\r
-       io->set_iomap_single_rw(0xce, memory);\r
-       io->set_iomap_range_rw(0xd8, 0xdb, fdc);\r
-       io->set_iomap_range_w(0xdc, 0xdf, floppy);\r
-       io->set_iomap_range_rw(0xe0, 0xe3, pio0);\r
-       io->set_iomap_range_rw(0xe4, 0xe7, pit);\r
-       io->set_iomap_range_rw(0xe8, 0xeb, pio1);\r
-       io->set_iomap_single_rw(0xef, joystick);\r
-//     io->set_iomap_range_w(0xf0, 0xf3, sysport);\r
-       io->set_iomap_single_w(0x170, crtc);\r
-       io->set_iomap_single_w(0x172, crtc);\r
-       io->set_iomap_single_w(0x174, crtc);\r
-       io->set_iomap_single_w(0x176, crtc);\r
-       io->set_iomap_range_w(0x178, 0x17b, crtc);\r
-       io->set_iomap_single_w(0x270, crtc);\r
-       io->set_iomap_single_w(0x272, crtc);\r
-       io->set_iomap_single_rw(0x274, memory);\r
-       \r
-       // initialize all devices\r
-       for(DEVICE* device = first_device; device; device = device->next_device) {\r
-               device->initialize();\r
-       }\r
-}\r
-\r
-VM::~VM()\r
-{\r
-       // delete all devices\r
-       for(DEVICE* device = first_device; device;) {\r
-               DEVICE *next_device = device->next_device;\r
-               device->release();\r
-               delete device;\r
-               device = next_device;\r
-       }\r
-}\r
-\r
-DEVICE* VM::get_device(int id)\r
-{\r
-       for(DEVICE* device = first_device; device; device = device->next_device) {\r
-               if(device->this_device_id == id) {\r
-                       return device;\r
-               }\r
-       }\r
-       return NULL;\r
-}\r
-\r
-// ----------------------------------------------------------------------------\r
-// drive virtual machine\r
-// ----------------------------------------------------------------------------\r
-\r
-void VM::reset()\r
-{\r
-       // reset all devices\r
-       for(DEVICE* device = first_device; device; device = device->next_device) {\r
-               device->reset();\r
-       }\r
-       // temporary fix...\r
-       for(DEVICE* device = first_device; device; device = device->next_device) {\r
-               device->reset();\r
-       }\r
-       \r
-       // set initial port status\r
-       pio0->write_signal(SIG_I8255_PORT_B, 0x7c, 0xff);\r
-       opn->write_signal(SIG_YM2203_PORT_B, 0x37, 0xff);\r
-}\r
-\r
-void VM::cpu_reset()\r
-{\r
-       cpu->reset();\r
-}\r
-\r
-void VM::run()\r
-{\r
-       event->drive();\r
-}\r
-\r
-// ----------------------------------------------------------------------------\r
-// debugger\r
-// ----------------------------------------------------------------------------\r
-\r
-#ifdef USE_DEBUGGER\r
-DEVICE *VM::get_cpu(int index)\r
-{\r
-       if(index == 0) {\r
-               return cpu;\r
-       }\r
-       return NULL;\r
-}\r
-#endif\r
-\r
-// ----------------------------------------------------------------------------\r
-// draw screen\r
-// ----------------------------------------------------------------------------\r
-\r
-void VM::draw_screen()\r
-{\r
-       crtc->draw_screen();\r
-}\r
-\r
-int VM::access_lamp()\r
-{\r
-       uint32 status = fdc->read_signal(0);\r
-       return (status & (1 | 4)) ? 1 : (status & (2 | 8)) ? 2 : 0;\r
-}\r
-\r
-// ----------------------------------------------------------------------------\r
-// soud manager\r
-// ----------------------------------------------------------------------------\r
-\r
-void VM::initialize_sound(int rate, int samples)\r
-{\r
-       // init sound manager\r
-       event->initialize_sound(rate, samples);\r
-       \r
-       // init sound gen\r
-       opn->init(rate, 2000000, samples, 0, -8);\r
-       pcm->init(rate, 4096);\r
-}\r
-\r
-uint16* VM::create_sound(int* extra_frames)\r
-{\r
-       return event->create_sound(extra_frames);\r
-}\r
-\r
-int VM::sound_buffer_ptr()\r
-{\r
-       return event->sound_buffer_ptr();\r
-}\r
-\r
-// ----------------------------------------------------------------------------\r
-// user interface\r
-// ----------------------------------------------------------------------------\r
-\r
-void VM::open_disk(int drv, _TCHAR* file_path, int offset)\r
-{\r
-       fdc->open_disk(drv, file_path, offset);\r
-}\r
-\r
-void VM::close_disk(int drv)\r
-{\r
-       fdc->close_disk(drv);\r
-}\r
-\r
-bool VM::disk_inserted(int drv)\r
-{\r
-       return fdc->disk_inserted(drv);\r
-}\r
-\r
-bool VM::now_skip()\r
-{\r
-       return event->now_skip();\r
-}\r
-\r
-void VM::update_config()\r
-{\r
-       for(DEVICE* device = first_device; device; device = device->next_device) {\r
-               device->update_config();\r
-       }\r
-}\r
-\r
+/*
+       SHARP MZ-2800 Emulator 'EmuZ-2800'
+
+       Author : Takeda.Toshiya
+       Date   : 2007.08.13 -
+
+       [ virtual machine ]
+*/
+
+#include "mz2800.h"
+#include "../../emu.h"
+#include "../device.h"
+#include "../event.h"
+
+#include "../i8253.h"
+#include "../i8255.h"
+#include "../i8259.h"
+#include "../i286.h"
+#include "../io.h"
+#include "../mb8877.h"
+#include "../pcm1bit.h"
+#include "../rp5c01.h"
+//#include "../sasi.h"
+#include "../upd71071.h"
+#include "../ym2203.h"
+#include "../z80pio.h"
+#include "../z80sio.h"
+
+#ifdef USE_DEBUGGER
+#include "../debugger.h"
+#endif
+
+#include "crtc.h"
+#include "floppy.h"
+#include "joystick.h"
+#include "keyboard.h"
+#include "memory.h"
+#include "mouse.h"
+#include "reset.h"
+#include "serial.h"
+#include "sysport.h"
+
+// ----------------------------------------------------------------------------
+// initialize
+// ----------------------------------------------------------------------------
+
+VM::VM(EMU* parent_emu) : emu(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
+       
+       cpu = new I286(this, emu);
+       pit = new I8253(this, emu);
+       pio0 = new I8255(this, emu);
+       pic = new I8259(this, emu);
+       io = new IO(this, emu);
+       fdc = new MB8877(this, emu);
+       pcm = new PCM1BIT(this, emu);
+       rtc = new RP5C01(this, emu);    // RP-5C15
+//     sasi = new SASI(this, emu);
+       dma = new UPD71071(this, emu);
+       opn = new YM2203(this, emu);
+       pio1 = new Z80PIO(this, emu);
+       sio = new Z80SIO(this, emu);
+       
+       crtc = new CRTC(this, emu);
+       floppy = new FLOPPY(this, emu);
+       joystick = new JOYSTICK(this, emu);
+       keyboard = new KEYBOARD(this, emu);
+       memory = new MEMORY(this, emu);
+       mouse = new MOUSE(this, emu);
+       rst = new RESET(this, emu);
+       serial = new SERIAL(this, emu);
+       sysport = new SYSPORT(this, emu);
+       
+       // set contexts
+       event->set_context_cpu(cpu);
+       event->set_context_sound(opn);
+       event->set_context_sound(pcm);
+       
+       pit->set_constant_clock(0, 31250);
+       pit->set_constant_clock(2, 31250);
+       pit->set_context_ch0(pit, SIG_I8253_CLOCK_1, 1);
+       pit->set_context_ch0(pic, SIG_I8259_CHIP0 | SIG_I8259_IR0, 1);
+       pit->set_context_ch1(pic, SIG_I8259_CHIP0 | SIG_I8259_IR6, 1);
+       pit->set_context_ch2(pic, SIG_I8259_CHIP1 | SIG_I8259_IR0, 1);
+       pio0->set_context_port_c(rst, SIG_RESET_CONTROL, 0xff, 0);
+       pio0->set_context_port_c(crtc, SIG_CRTC_MASK, 0x01, 0);
+       pio0->set_context_port_c(pcm, SIG_PCM1BIT_SIGNAL, 0x04, 0);
+       pic->set_context_cpu(cpu);
+       fdc->set_context_drq(dma, SIG_UPD71071_CH1, 1);
+       fdc->set_context_irq(pic, SIG_I8259_CHIP0 | SIG_I8259_IR5, 1);
+       rtc->set_context_alarm(pic, SIG_I8259_CHIP1 | SIG_I8259_IR2, 1);
+       rtc->set_context_pulse(opn, SIG_YM2203_PORT_B, 8);
+//     sasi->set_context_drq(dma, SIG_UPD71071_CH0, 1);
+//     sasi->set_context_irq(pic, SIG_I8259_CHIP0 | SIG_I8259_IR4, 1);
+       dma->set_context_memory(memory);
+//     dma->set_context_ch0(sasi);
+       dma->set_context_ch1(fdc);
+       dma->set_context_tc(pic, SIG_I8259_CHIP0 | SIG_I8259_IR3, 1);
+       opn->set_context_irq(pic, SIG_I8259_CHIP1 | SIG_I8259_IR7, 1);
+       opn->set_context_port_a(crtc, SIG_CRTC_PALLETE, 0x04, 0);
+       opn->set_context_port_a(mouse, SIG_MOUSE_SEL, 0x08, 0);
+       pio1->set_context_port_a(crtc, SIG_CRTC_COLUMN_SIZE, 0x20, 0);
+       pio1->set_context_port_a(keyboard, SIG_KEYBOARD_COLUMN, 0xff, 0);
+       sio->set_context_intr(pic, SIG_I8259_CHIP0 | SIG_I8259_IR2);
+       sio->set_context_dtr1(mouse, SIG_MOUSE_DTR, 1);
+       
+       crtc->set_context_pic(pic);
+       crtc->set_context_pio(pio0);
+       crtc->set_vram_ptr(memory->get_vram());
+       crtc->set_tvram_ptr(memory->get_tvram());
+       crtc->set_kanji_ptr(memory->get_kanji());
+       crtc->set_pcg_ptr(memory->get_pcg());
+       floppy->set_context_fdc(fdc);
+       keyboard->set_context_pio0(pio0);
+       keyboard->set_context_pio1(pio1);
+       memory->set_context_crtc(crtc);
+       mouse->set_context_sio(sio);
+       serial->set_context_sio(sio);
+       sysport->set_context_pit(pit);
+       sysport->set_context_sio(sio);
+       
+       // cpu bus
+       cpu->set_context_mem(memory);
+       cpu->set_context_io(io);
+       cpu->set_context_intr(pic);
+#ifdef SINGLE_MODE_DMA
+       cpu->set_context_dma(dma);
+#endif
+#ifdef USE_DEBUGGER
+       cpu->set_context_debugger(new DEBUGGER(this, emu));
+#endif
+       
+       // i/o bus
+       io->set_iomap_range_rw(0x70, 0x7f, dma);
+       io->set_iomap_alias_rw(0x80, pic, I8259_ADDR_CHIP0 | 0);
+       io->set_iomap_alias_rw(0x81, pic, I8259_ADDR_CHIP0 | 1);
+       io->set_iomap_alias_rw(0x82, pic, I8259_ADDR_CHIP1 | 0);
+       io->set_iomap_alias_rw(0x83, pic, I8259_ADDR_CHIP1 | 1);
+       io->set_iomap_range_rw(0x8c, 0x8d, memory);
+       io->set_iovalue_single_r(0x8e, 0xff);   // dipswitch
+       io->set_flipflop_single_rw(0x8f, 0x00); // shut
+       io->set_iomap_range_rw(0xa0, 0xa3, serial);
+       for(uint32 p = 0xae; p <= 0x1fae; p += 0x100) {
+               io->set_iomap_single_w(p, crtc);
+       }
+//     io->set_iomap_single_rw(0xaf, sasi);
+       io->set_iomap_range_rw(0xb0, 0xb3, serial);
+       io->set_iomap_single_r(0xbe, sysport);
+       io->set_iomap_range_rw(0xc8, 0xc9, opn);
+       io->set_iovalue_single_r(0xca, 0x7f);   // voice communication ???
+       for(uint32 p = 0xcc; p <= 0xfcc; p += 0x100) {
+               io->set_iomap_alias_rw(p, rtc, p >> 8);
+       }
+       io->set_iomap_single_w(0xcd, serial);
+       io->set_iomap_single_rw(0xce, memory);
+       io->set_iomap_range_rw(0xd8, 0xdb, fdc);
+       io->set_iomap_range_w(0xdc, 0xdf, floppy);
+       io->set_iomap_range_rw(0xe0, 0xe3, pio0);
+       io->set_iomap_range_rw(0xe4, 0xe7, pit);
+       io->set_iomap_range_rw(0xe8, 0xeb, pio1);
+       io->set_iomap_single_rw(0xef, joystick);
+//     io->set_iomap_range_w(0xf0, 0xf3, sysport);
+       io->set_iomap_single_w(0x170, crtc);
+       io->set_iomap_single_w(0x172, crtc);
+       io->set_iomap_single_w(0x174, crtc);
+       io->set_iomap_single_w(0x176, crtc);
+       io->set_iomap_range_w(0x178, 0x17b, crtc);
+       io->set_iomap_single_w(0x270, crtc);
+       io->set_iomap_single_w(0x272, crtc);
+       io->set_iomap_single_rw(0x274, memory);
+       
+       // initialize all devices
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               device->initialize();
+       }
+}
+
+VM::~VM()
+{
+       // delete all devices
+       for(DEVICE* device = first_device; device;) {
+               DEVICE *next_device = device->next_device;
+               device->release();
+               delete device;
+               device = next_device;
+       }
+}
+
+DEVICE* VM::get_device(int id)
+{
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               if(device->this_device_id == id) {
+                       return device;
+               }
+       }
+       return NULL;
+}
+
+// ----------------------------------------------------------------------------
+// drive virtual machine
+// ----------------------------------------------------------------------------
+
+void VM::reset()
+{
+       // reset all devices
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               device->reset();
+       }
+       // temporary fix...
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               device->reset();
+       }
+       
+       // set initial port status
+       pio0->write_signal(SIG_I8255_PORT_B, 0x7c, 0xff);
+       opn->write_signal(SIG_YM2203_PORT_B, 0x37, 0xff);
+}
+
+void VM::cpu_reset()
+{
+       cpu->reset();
+}
+
+void VM::run()
+{
+       event->drive();
+}
+
+// ----------------------------------------------------------------------------
+// debugger
+// ----------------------------------------------------------------------------
+
+#ifdef USE_DEBUGGER
+DEVICE *VM::get_cpu(int index)
+{
+       if(index == 0) {
+               return cpu;
+       }
+       return NULL;
+}
+#endif
+
+// ----------------------------------------------------------------------------
+// draw screen
+// ----------------------------------------------------------------------------
+
+void VM::draw_screen()
+{
+       crtc->draw_screen();
+}
+
+int VM::access_lamp()
+{
+       uint32 status = fdc->read_signal(0);
+       return (status & (1 | 4)) ? 1 : (status & (2 | 8)) ? 2 : 0;
+}
+
+// ----------------------------------------------------------------------------
+// soud manager
+// ----------------------------------------------------------------------------
+
+void VM::initialize_sound(int rate, int samples)
+{
+       // init sound manager
+       event->initialize_sound(rate, samples);
+       
+       // init sound gen
+       opn->init(rate, 2000000, samples, 0, -8);
+       pcm->init(rate, 4096);
+}
+
+uint16* VM::create_sound(int* extra_frames)
+{
+       return event->create_sound(extra_frames);
+}
+
+int VM::sound_buffer_ptr()
+{
+       return event->sound_buffer_ptr();
+}
+
+// ----------------------------------------------------------------------------
+// user interface
+// ----------------------------------------------------------------------------
+
+void VM::open_disk(int drv, _TCHAR* file_path, int offset)
+{
+       fdc->open_disk(drv, file_path, offset);
+}
+
+void VM::close_disk(int drv)
+{
+       fdc->close_disk(drv);
+}
+
+bool VM::disk_inserted(int drv)
+{
+       return fdc->disk_inserted(drv);
+}
+
+bool VM::now_skip()
+{
+       return event->now_skip();
+}
+
+void VM::update_config()
+{
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               device->update_config();
+       }
+}
+