OSDN Git Service

[VM][MZ2800] Fix crash at building VM. Thanks to http://hanabi.2ch.net/test/read...
[csp-qt/common_source_project-fm7.git] / source / src / vm / i86.h
index e138489..f6c0d1f 100644 (file)
-/*\r
-       Skelton for retropc emulator\r
-\r
-       Origin : MAME 0.142\r
-       Author : Takeda.Toshiya\r
-       Date  : 2011.04.23-\r
-\r
-       [ 80x86 ]\r
-*/\r
-\r
-#ifndef _I86_H_ \r
-#define _I86_H_\r
-\r
-#include "vm.h"\r
-#include "../emu.h"\r
-#include "device.h"\r
-\r
-#define SIG_I86_TEST   0\r
-\r
-#ifdef USE_DEBUGGER\r
-class DEBUGGER;\r
-#endif\r
-\r
-class I86 : public DEVICE\r
-{\r
-private:\r
-       /* ---------------------------------------------------------------------------\r
-       contexts\r
-       --------------------------------------------------------------------------- */\r
-       \r
-       DEVICE *d_mem, *d_io, *d_pic, *d_bios;\r
-#ifdef SINGLE_MODE_DMA\r
-       DEVICE *d_dma;\r
-#endif\r
-#ifdef USE_DEBUGGER\r
-       DEBUGGER *d_debugger;\r
-       DEVICE *d_mem_stored, *d_io_stored;\r
-#endif\r
-       \r
-       /* ---------------------------------------------------------------------------\r
-       registers\r
-       --------------------------------------------------------------------------- */\r
-       \r
-       union REGTYPE {\r
-               uint16 w[8]; /* viewed as 16 bits registers */\r
-               uint8 b[16]; /* or as 8 bit registers       */\r
-       } regs;\r
-       uint32 pc;\r
-       uint32 prevpc;\r
-       uint32 base[4];\r
-       uint16 sregs[4];\r
-       uint16 flags;\r
-       int32 AuxVal, OverVal, SignVal, ZeroVal, CarryVal, DirVal;\r
-       uint8 ParityVal;\r
-       uint8 TF, IF, MF;\r
-       \r
-       int int_state;\r
-       bool test_state;\r
-       bool busreq, halted;\r
-       \r
-       int icount;\r
-       int extra_icount;\r
-       \r
-       bool seg_prefix;        /* prefix segment indicator */\r
-       uint8 prefix_seg;       /* The prefixed segment */\r
-       unsigned ea;\r
-       uint16 eo;              /* effective offset of the address (before segment is added) */\r
-       uint8 ea_seg;           /* effective segment of the address */\r
-       \r
-       /* ---------------------------------------------------------------------------\r
-       opecode\r
-       --------------------------------------------------------------------------- */\r
-       \r
-       // sub\r
-       void interrupt(int num);\r
-       void trap();\r
-       unsigned GetEA(unsigned ModRM);\r
-       void rotate_shift_byte(unsigned ModRM, unsigned cnt);\r
-       void rotate_shift_word(unsigned ModRM, unsigned cnt);\r
-       \r
-       // opecode\r
-       void run_one_opecode();\r
-#ifdef USE_DEBUGGER\r
-       void run_one_opecode_debugger();\r
-#endif\r
-       void instruction(uint8 code);\r
-       inline void _add_br8();\r
-       inline void _add_wr16();\r
-       inline void _add_r8b();\r
-       inline void _add_r16w();\r
-       inline void _add_ald8();\r
-       inline void _add_axd16();\r
-       inline void _push_es();\r
-       inline void _pop_es();\r
-       inline void _or_br8();\r
-       inline void _or_wr16();\r
-       inline void _or_r8b();\r
-       inline void _or_r16w();\r
-       inline void _or_ald8();\r
-       inline void _or_axd16();\r
-       inline void _push_cs();\r
-#if defined(HAS_V30)\r
-       inline void _0fpre();\r
-#endif\r
-       inline void _adc_br8();\r
-       inline void _adc_wr16();\r
-       inline void _adc_r8b();\r
-       inline void _adc_r16w();\r
-       inline void _adc_ald8();\r
-       inline void _adc_axd16();\r
-       inline void _push_ss();\r
-       inline void _pop_ss();\r
-       inline void _sbb_br8();\r
-       inline void _sbb_wr16();\r
-       inline void _sbb_r8b();\r
-       inline void _sbb_r16w();\r
-       inline void _sbb_ald8();\r
-       inline void _sbb_axd16();\r
-       inline void _push_ds();\r
-       inline void _pop_ds();\r
-       inline void _and_br8();\r
-       inline void _and_wr16();\r
-       inline void _and_r8b();\r
-       inline void _and_r16w();\r
-       inline void _and_ald8();\r
-       inline void _and_axd16();\r
-       inline void _es();\r
-       inline void _daa();\r
-       inline void _sub_br8();\r
-       inline void _sub_wr16();\r
-       inline void _sub_r8b();\r
-       inline void _sub_r16w();\r
-       inline void _sub_ald8();\r
-       inline void _sub_axd16();\r
-       inline void _cs();\r
-       inline void _das();\r
-       inline void _xor_br8();\r
-       inline void _xor_wr16();\r
-       inline void _xor_r8b();\r
-       inline void _xor_r16w();\r
-       inline void _xor_ald8();\r
-       inline void _xor_axd16();\r
-       inline void _ss();\r
-       inline void _aaa();\r
-       inline void _cmp_br8();\r
-       inline void _cmp_wr16();\r
-       inline void _cmp_r8b();\r
-       inline void _cmp_r16w();\r
-       inline void _cmp_ald8();\r
-       inline void _cmp_axd16();\r
-       inline void _ds();\r
-       inline void _aas();\r
-       inline void _inc_ax();\r
-       inline void _inc_cx();\r
-       inline void _inc_dx();\r
-       inline void _inc_bx();\r
-       inline void _inc_sp();\r
-       inline void _inc_bp();\r
-       inline void _inc_si();\r
-       inline void _inc_di();\r
-       inline void _dec_ax();\r
-       inline void _dec_cx();\r
-       inline void _dec_dx();\r
-       inline void _dec_bx();\r
-       inline void _dec_sp();\r
-       inline void _dec_bp();\r
-       inline void _dec_si();\r
-       inline void _dec_di();\r
-       inline void _push_ax();\r
-       inline void _push_cx();\r
-       inline void _push_dx();\r
-       inline void _push_bx();\r
-       inline void _push_sp();\r
-       inline void _push_bp();\r
-       inline void _push_si();\r
-       inline void _push_di();\r
-       inline void _pop_ax();\r
-       inline void _pop_cx();\r
-       inline void _pop_dx();\r
-       inline void _pop_bx();\r
-       inline void _pop_sp();\r
-       inline void _pop_bp();\r
-       inline void _pop_si();\r
-       inline void _pop_di();\r
-       inline void _pusha();\r
-       inline void _popa();\r
-       inline void _bound();\r
-       inline void _repc(int flagval);\r
-       inline void _push_d16();\r
-       inline void _imul_d16();\r
-       inline void _push_d8();\r
-       inline void _imul_d8();\r
-       inline void _insb();\r
-       inline void _insw();\r
-       inline void _outsb();\r
-       inline void _outsw();\r
-       inline void _jo();\r
-       inline void _jno();\r
-       inline void _jb();\r
-       inline void _jnb();\r
-       inline void _jz();\r
-       inline void _jnz();\r
-       inline void _jbe();\r
-       inline void _jnbe();\r
-       inline void _js();\r
-       inline void _jns();\r
-       inline void _jp();\r
-       inline void _jnp();\r
-       inline void _jl();\r
-       inline void _jnl();\r
-       inline void _jle();\r
-       inline void _jnle();\r
-       inline void _80pre();\r
-       inline void _81pre();\r
-       inline void _82pre();\r
-       inline void _83pre();\r
-       inline void _test_br8();\r
-       inline void _test_wr16();\r
-       inline void _xchg_br8();\r
-       inline void _xchg_wr16();\r
-       inline void _mov_br8();\r
-       inline void _mov_wr16();\r
-       inline void _mov_r8b();\r
-       inline void _mov_r16w();\r
-       inline void _mov_wsreg();\r
-       inline void _lea();\r
-       inline void _mov_sregw();\r
-       inline void _popw();\r
-       inline void _nop();\r
-       inline void _xchg_axcx();\r
-       inline void _xchg_axdx();\r
-       inline void _xchg_axbx();\r
-       inline void _xchg_axsp();\r
-       inline void _xchg_axbp();\r
-       inline void _xchg_axsi();\r
-       inline void _xchg_axdi();\r
-       inline void _cbw();\r
-       inline void _cwd();\r
-       inline void _call_far();\r
-       inline void _wait();\r
-       inline void _pushf();\r
-       inline void _popf();\r
-       inline void _sahf();\r
-       inline void _lahf();\r
-       inline void _mov_aldisp();\r
-       inline void _mov_axdisp();\r
-       inline void _mov_dispal();\r
-       inline void _mov_dispax();\r
-       inline void _movsb();\r
-       inline void _movsw();\r
-       inline void _cmpsb();\r
-       inline void _cmpsw();\r
-       inline void _test_ald8();\r
-       inline void _test_axd16();\r
-       inline void _stosb();\r
-       inline void _stosw();\r
-       inline void _lodsb();\r
-       inline void _lodsw();\r
-       inline void _scasb();\r
-       inline void _scasw();\r
-       inline void _mov_ald8();\r
-       inline void _mov_cld8();\r
-       inline void _mov_dld8();\r
-       inline void _mov_bld8();\r
-       inline void _mov_ahd8();\r
-       inline void _mov_chd8();\r
-       inline void _mov_dhd8();\r
-       inline void _mov_bhd8();\r
-       inline void _mov_axd16();\r
-       inline void _mov_cxd16();\r
-       inline void _mov_dxd16();\r
-       inline void _mov_bxd16();\r
-       inline void _mov_spd16();\r
-       inline void _mov_bpd16();\r
-       inline void _mov_sid16();\r
-       inline void _mov_did16();\r
-       inline void _rotshft_bd8();\r
-       inline void _rotshft_wd8();\r
-       inline void _ret_d16();\r
-       inline void _ret();\r
-       inline void _les_dw();\r
-       inline void _lds_dw();\r
-       inline void _mov_bd8();\r
-       inline void _mov_wd16();\r
-       inline void _enter();\r
-       inline void _leav();    // _leave()\r
-       inline void _retf_d16();\r
-       inline void _retf();\r
-       inline void _int3();\r
-       inline void _int();\r
-       inline void _into();\r
-       inline void _iret();\r
-       inline void _rotshft_b();\r
-       inline void _rotshft_w();\r
-       inline void _rotshft_bcl();\r
-       inline void _rotshft_wcl();\r
-       inline void _aam();\r
-       inline void _aad();\r
-       inline void _setalc();\r
-       inline void _xlat();\r
-       inline void _escape();\r
-       inline void _loopne();\r
-       inline void _loope();\r
-       inline void _loop();\r
-       inline void _jcxz();\r
-       inline void _inal();\r
-       inline void _inax();\r
-       inline void _outal();\r
-       inline void _outax();\r
-       inline void _call_d16();\r
-       inline void _jmp_d16();\r
-       inline void _jmp_far();\r
-       inline void _jmp_d8();\r
-       inline void _inaldx();\r
-       inline void _inaxdx();\r
-       inline void _outdxal();\r
-       inline void _outdxax();\r
-       inline void _lock();\r
-       inline void _rep(int flagval);\r
-       inline void _repne();\r
-       inline void _repe();\r
-       inline void _hlt();\r
-       inline void _cmc();\r
-       inline void _f6pre();\r
-       inline void _f7pre();\r
-       inline void _clc();\r
-       inline void _stc();\r
-       inline void _cli();\r
-       inline void _sti();\r
-       inline void _cld();\r
-       inline void _std();\r
-       inline void _fepre();\r
-       inline void _ffpre();\r
-       inline void _invalid();\r
-       \r
-public:\r
-       I86(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)\r
-       {\r
-               d_bios = NULL;\r
-#ifdef SINGLE_MODE_DMA\r
-               d_dma = NULL;\r
-#endif\r
-               busreq = false;\r
-       }\r
-       ~I86() {}\r
-       \r
-       // common functions\r
-       void initialize();\r
-       void reset();\r
-       int run(int clock);\r
-       void write_signal(int id, uint32 data, uint32 mask);\r
-       void set_intr_line(bool line, bool pending, uint32 bit);\r
-       void set_extra_clock(int clock)\r
-       {\r
-               extra_icount += clock;\r
-       }\r
-       int get_extra_clock()\r
-       {\r
-               return extra_icount;\r
-       }\r
-       uint32 get_pc()\r
-       {\r
-               return prevpc;\r
-       }\r
-       uint32 get_next_pc()\r
-       {\r
-               return pc;\r
-       }\r
-#ifdef USE_DEBUGGER\r
-       void *get_debugger()\r
-       {\r
-               return d_debugger;\r
-       }\r
-       uint32 debug_prog_addr_mask()\r
-       {\r
-               return 0xfffff;\r
-       }\r
-       uint32 debug_data_addr_mask()\r
-       {\r
-               return 0xfffff;\r
-       }\r
-       void debug_write_data8(uint32 addr, uint32 data);\r
-       uint32 debug_read_data8(uint32 addr);\r
-       void debug_write_data16(uint32 addr, uint32 data);\r
-       uint32 debug_read_data16(uint32 addr);\r
-       void debug_write_io8(uint32 addr, uint32 data);\r
-       uint32 debug_read_io8(uint32 addr);\r
-       void debug_write_io16(uint32 addr, uint32 data);\r
-       uint32 debug_read_io16(uint32 addr);\r
-       bool debug_write_reg(_TCHAR *reg, uint32 data);\r
-       void debug_regs_info(_TCHAR *buffer);\r
-       int debug_dasm(uint32 pc, _TCHAR *buffer);\r
-#endif\r
-       void save_state(FILEIO* state_fio);\r
-       bool load_state(FILEIO* state_fio);\r
-       \r
-       // unique function\r
-       void set_context_mem(DEVICE* device)\r
-       {\r
-               d_mem = device;\r
-       }\r
-       void set_context_io(DEVICE* device)\r
-       {\r
-               d_io = device;\r
-       }\r
-       void set_context_intr(DEVICE* device)\r
-       {\r
-               d_pic = device;\r
-       }\r
-       void set_context_bios(DEVICE* device)\r
-       {\r
-               d_bios = device;\r
-       }\r
-#ifdef SINGLE_MODE_DMA\r
-       void set_context_dma(DEVICE* device)\r
-       {\r
-               d_dma = device;\r
-       }\r
-#endif\r
-#ifdef USE_DEBUGGER\r
-       void set_context_debugger(DEBUGGER* device)\r
-       {\r
-               d_debugger = device;\r
-       }\r
-#endif\r
-};\r
-\r
-#endif\r
+/*
+       Skelton for retropc emulator
+
+       Origin : MAME 0.142
+       Author : Takeda.Toshiya
+       Date  : 2011.04.23-
+
+       [ 80x86 ]
+*/
+
+#ifndef _I86_H_ 
+#define _I86_H_
+
+#include "vm.h"
+#include "../emu.h"
+#include "device.h"
+
+#define SIG_I86_TEST   0
+
+#ifdef USE_DEBUGGER
+class DEBUGGER;
+#endif
+
+class I86 : public DEVICE
+{
+private:
+       /* ---------------------------------------------------------------------------
+       contexts
+       --------------------------------------------------------------------------- */
+       
+       DEVICE *d_mem, *d_io, *d_pic, *d_bios;
+#ifdef SINGLE_MODE_DMA
+       DEVICE *d_dma;
+#endif
+#ifdef USE_DEBUGGER
+       DEBUGGER *d_debugger;
+       DEVICE *d_mem_stored, *d_io_stored;
+#endif
+       
+       /* ---------------------------------------------------------------------------
+       registers
+       --------------------------------------------------------------------------- */
+       
+       union REGTYPE {
+               uint16_t w[8]; /* viewed as 16 bits registers */
+               uint8_t b[16]; /* or as 8 bit registers       */
+       } regs;
+       uint32_t pc;
+       uint32_t prevpc;
+       uint32_t base[4];
+       uint16_t sregs[4];
+       uint16_t flags;
+       int32_t AuxVal, OverVal, SignVal, ZeroVal, CarryVal, DirVal;
+       uint8_t ParityVal;
+       uint8_t TF, IF, MF;
+       
+       int int_state;
+       bool test_state;
+       bool busreq, halted;
+       
+       int icount;
+       int extra_icount;
+       
+       bool seg_prefix;        /* prefix segment indicator */
+       uint8_t prefix_seg;     /* The prefixed segment */
+       unsigned ea;
+       uint16_t eo;            /* effective offset of the address (before segment is added) */
+       uint8_t ea_seg;         /* effective segment of the address */
+       
+       /* ---------------------------------------------------------------------------
+       opecode
+       --------------------------------------------------------------------------- */
+       
+       // sub
+       void interrupt(int num);
+       void trap();
+       unsigned GetEA(unsigned ModRM);
+       void rotate_shift_byte(unsigned ModRM, unsigned cnt);
+       void rotate_shift_word(unsigned ModRM, unsigned cnt);
+       
+       // opecode
+       void run_one_opecode();
+#ifdef USE_DEBUGGER
+       void run_one_opecode_debugger();
+#endif
+       void instruction(uint8_t code);
+       inline void _add_br8();
+       inline void _add_wr16();
+       inline void _add_r8b();
+       inline void _add_r16w();
+       inline void _add_ald8();
+       inline void _add_axd16();
+       inline void _push_es();
+       inline void _pop_es();
+       inline void _or_br8();
+       inline void _or_wr16();
+       inline void _or_r8b();
+       inline void _or_r16w();
+       inline void _or_ald8();
+       inline void _or_axd16();
+       inline void _push_cs();
+#if defined(HAS_V30)
+       inline void _0fpre();
+#endif
+       inline void _adc_br8();
+       inline void _adc_wr16();
+       inline void _adc_r8b();
+       inline void _adc_r16w();
+       inline void _adc_ald8();
+       inline void _adc_axd16();
+       inline void _push_ss();
+       inline void _pop_ss();
+       inline void _sbb_br8();
+       inline void _sbb_wr16();
+       inline void _sbb_r8b();
+       inline void _sbb_r16w();
+       inline void _sbb_ald8();
+       inline void _sbb_axd16();
+       inline void _push_ds();
+       inline void _pop_ds();
+       inline void _and_br8();
+       inline void _and_wr16();
+       inline void _and_r8b();
+       inline void _and_r16w();
+       inline void _and_ald8();
+       inline void _and_axd16();
+       inline void _es();
+       inline void _daa();
+       inline void _sub_br8();
+       inline void _sub_wr16();
+       inline void _sub_r8b();
+       inline void _sub_r16w();
+       inline void _sub_ald8();
+       inline void _sub_axd16();
+       inline void _cs();
+       inline void _das();
+       inline void _xor_br8();
+       inline void _xor_wr16();
+       inline void _xor_r8b();
+       inline void _xor_r16w();
+       inline void _xor_ald8();
+       inline void _xor_axd16();
+       inline void _ss();
+       inline void _aaa();
+       inline void _cmp_br8();
+       inline void _cmp_wr16();
+       inline void _cmp_r8b();
+       inline void _cmp_r16w();
+       inline void _cmp_ald8();
+       inline void _cmp_axd16();
+       inline void _ds();
+       inline void _aas();
+       inline void _inc_ax();
+       inline void _inc_cx();
+       inline void _inc_dx();
+       inline void _inc_bx();
+       inline void _inc_sp();
+       inline void _inc_bp();
+       inline void _inc_si();
+       inline void _inc_di();
+       inline void _dec_ax();
+       inline void _dec_cx();
+       inline void _dec_dx();
+       inline void _dec_bx();
+       inline void _dec_sp();
+       inline void _dec_bp();
+       inline void _dec_si();
+       inline void _dec_di();
+       inline void _push_ax();
+       inline void _push_cx();
+       inline void _push_dx();
+       inline void _push_bx();
+       inline void _push_sp();
+       inline void _push_bp();
+       inline void _push_si();
+       inline void _push_di();
+       inline void _pop_ax();
+       inline void _pop_cx();
+       inline void _pop_dx();
+       inline void _pop_bx();
+       inline void _pop_sp();
+       inline void _pop_bp();
+       inline void _pop_si();
+       inline void _pop_di();
+       inline void _pusha();
+       inline void _popa();
+       inline void _bound();
+       inline void _repc(int flagval);
+       inline void _push_d16();
+       inline void _imul_d16();
+       inline void _push_d8();
+       inline void _imul_d8();
+       inline void _insb();
+       inline void _insw();
+       inline void _outsb();
+       inline void _outsw();
+       inline void _jo();
+       inline void _jno();
+       inline void _jb();
+       inline void _jnb();
+       inline void _jz();
+       inline void _jnz();
+       inline void _jbe();
+       inline void _jnbe();
+       inline void _js();
+       inline void _jns();
+       inline void _jp();
+       inline void _jnp();
+       inline void _jl();
+       inline void _jnl();
+       inline void _jle();
+       inline void _jnle();
+       inline void _80pre();
+       inline void _81pre();
+       inline void _82pre();
+       inline void _83pre();
+       inline void _test_br8();
+       inline void _test_wr16();
+       inline void _xchg_br8();
+       inline void _xchg_wr16();
+       inline void _mov_br8();
+       inline void _mov_wr16();
+       inline void _mov_r8b();
+       inline void _mov_r16w();
+       inline void _mov_wsreg();
+       inline void _lea();
+       inline void _mov_sregw();
+       inline void _popw();
+       inline void _nop();
+       inline void _xchg_axcx();
+       inline void _xchg_axdx();
+       inline void _xchg_axbx();
+       inline void _xchg_axsp();
+       inline void _xchg_axbp();
+       inline void _xchg_axsi();
+       inline void _xchg_axdi();
+       inline void _cbw();
+       inline void _cwd();
+       inline void _call_far();
+       inline void _wait();
+       inline void _pushf();
+       inline void _popf();
+       inline void _sahf();
+       inline void _lahf();
+       inline void _mov_aldisp();
+       inline void _mov_axdisp();
+       inline void _mov_dispal();
+       inline void _mov_dispax();
+       inline void _movsb();
+       inline void _movsw();
+       inline void _cmpsb();
+       inline void _cmpsw();
+       inline void _test_ald8();
+       inline void _test_axd16();
+       inline void _stosb();
+       inline void _stosw();
+       inline void _lodsb();
+       inline void _lodsw();
+       inline void _scasb();
+       inline void _scasw();
+       inline void _mov_ald8();
+       inline void _mov_cld8();
+       inline void _mov_dld8();
+       inline void _mov_bld8();
+       inline void _mov_ahd8();
+       inline void _mov_chd8();
+       inline void _mov_dhd8();
+       inline void _mov_bhd8();
+       inline void _mov_axd16();
+       inline void _mov_cxd16();
+       inline void _mov_dxd16();
+       inline void _mov_bxd16();
+       inline void _mov_spd16();
+       inline void _mov_bpd16();
+       inline void _mov_sid16();
+       inline void _mov_did16();
+       inline void _rotshft_bd8();
+       inline void _rotshft_wd8();
+       inline void _ret_d16();
+       inline void _ret();
+       inline void _les_dw();
+       inline void _lds_dw();
+       inline void _mov_bd8();
+       inline void _mov_wd16();
+       inline void _enter();
+       inline void _leav();    // _leave()
+       inline void _retf_d16();
+       inline void _retf();
+       inline void _int3();
+       inline void _int();
+       inline void _into();
+       inline void _iret();
+       inline void _rotshft_b();
+       inline void _rotshft_w();
+       inline void _rotshft_bcl();
+       inline void _rotshft_wcl();
+       inline void _aam();
+       inline void _aad();
+       inline void _setalc();
+       inline void _xlat();
+       inline void _escape();
+       inline void _loopne();
+       inline void _loope();
+       inline void _loop();
+       inline void _jcxz();
+       inline void _inal();
+       inline void _inax();
+       inline void _outal();
+       inline void _outax();
+       inline void _call_d16();
+       inline void _jmp_d16();
+       inline void _jmp_far();
+       inline void _jmp_d8();
+       inline void _inaldx();
+       inline void _inaxdx();
+       inline void _outdxal();
+       inline void _outdxax();
+       inline void _lock();
+       inline void _rep(int flagval);
+       inline void _repne();
+       inline void _repe();
+       inline void _hlt();
+       inline void _cmc();
+       inline void _f6pre();
+       inline void _f7pre();
+       inline void _clc();
+       inline void _stc();
+       inline void _cli();
+       inline void _sti();
+       inline void _cld();
+       inline void _std();
+       inline void _fepre();
+       inline void _ffpre();
+       inline void _invalid();
+       
+public:
+       I86(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       {
+               d_bios = NULL;
+#ifdef SINGLE_MODE_DMA
+               d_dma = NULL;
+#endif
+               busreq = false;
+       }
+       ~I86() {}
+       
+       // common functions
+       void initialize();
+       void reset();
+       int run(int clock);
+       void write_signal(int id, uint32_t data, uint32_t mask);
+       void set_intr_line(bool line, bool pending, uint32_t bit);
+       void set_extra_clock(int clock)
+       {
+               extra_icount += clock;
+       }
+       int get_extra_clock()
+       {
+               return extra_icount;
+       }
+       uint32_t get_pc()
+       {
+               return prevpc;
+       }
+       uint32_t get_next_pc()
+       {
+               return pc;
+       }
+#ifdef USE_DEBUGGER
+       void *get_debugger()
+       {
+               return d_debugger;
+       }
+       uint32_t get_debug_prog_addr_mask()
+       {
+               return 0xfffff;
+       }
+       uint32_t get_debug_data_addr_mask()
+       {
+               return 0xfffff;
+       }
+       void write_debug_data8(uint32_t addr, uint32_t data);
+       uint32_t read_debug_data8(uint32_t addr);
+       void write_debug_data16(uint32_t addr, uint32_t data);
+       uint32_t read_debug_data16(uint32_t addr);
+       void write_debug_io8(uint32_t addr, uint32_t data);
+       uint32_t read_debug_io8(uint32_t addr);
+       void write_debug_io16(uint32_t addr, uint32_t data);
+       uint32_t read_debug_io16(uint32_t addr);
+       bool write_debug_reg(const _TCHAR *reg, uint32_t data);
+       void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+       int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
+#endif
+       void save_state(FILEIO* state_fio);
+       bool load_state(FILEIO* state_fio);
+       const _TCHAR *get_device_name()
+       {
+               return _T("8086");
+       }
+       
+       // unique function
+       void set_context_mem(DEVICE* device)
+       {
+               d_mem = device;
+       }
+       void set_context_io(DEVICE* device)
+       {
+               d_io = device;
+       }
+       void set_context_intr(DEVICE* device)
+       {
+               d_pic = device;
+       }
+       void set_context_bios(DEVICE* device)
+       {
+               d_bios = device;
+       }
+#ifdef SINGLE_MODE_DMA
+       void set_context_dma(DEVICE* device)
+       {
+               d_dma = device;
+       }
+#endif
+#ifdef USE_DEBUGGER
+       void set_context_debugger(DEBUGGER* device)
+       {
+               d_debugger = device;
+       }
+#endif
+};
+
+#endif