本文整理汇总了C++中DEVICE::initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE::initialize方法的具体用法?C++ DEVICE::initialize怎么用?C++ DEVICE::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DEVICE
的用法示例。
在下文中一共展示了DEVICE::initialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emu
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
drec = new DATAREC(this, emu);
sio = new I8251(this, emu);
pio_k = new I8255(this, emu);
pio_f = new I8255(this, emu);
io = new IO(this, emu);
psg = new SN76489AN(this, emu);
vdp = new TMS9918A(this, emu);
fdc = new UPD765A(this, emu);
cpu = new Z80(this, emu);
key = new KEYBOARD(this, emu);
memory = new MEMORY(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(psg);
drec->set_context_out(pio_k, SIG_I8255_PORT_B, 0x80);
pio_k->set_context_port_c(key, SIG_KEYBOARD_COLUMN, 0x07, 0);
pio_k->set_context_port_c(drec, SIG_DATAREC_REMOTE, 0x08, 0);
pio_k->set_context_port_c(drec, SIG_DATAREC_OUT, 0x10, 0);
pio_f->set_context_port_c(fdc, SIG_UPD765A_MOTOR_NEG, 2, 0);
pio_f->set_context_port_c(fdc, SIG_UPD765A_TC, 4, 0);
pio_f->set_context_port_c(fdc, SIG_UPD765A_RESET, 8, 0);
pio_f->set_context_port_c(memory, SIG_MEMORY_SEL, 0x40, 0);
vdp->set_context_irq(cpu, SIG_CPU_IRQ, 1);
fdc->set_context_irq(pio_f, SIG_I8255_PORT_A, 1);
fdc->set_context_index(pio_f, SIG_I8255_PORT_A, 4);
#ifdef _FDC_DEBUG_LOG
fdc->set_context_cpu(cpu);
#endif
key->set_context_cpu(cpu);
key->set_context_pio(pio_k);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(dummy);
// i/o bus
io->set_iomap_range_rw(0x40, 0x7f, psg);
io->set_iomap_range_rw(0x80, 0xbf, vdp);
io->set_iomap_range_rw(0xc0, 0xdf, pio_k);
io->set_iomap_range_rw(0xe0, 0xe3, fdc);
io->set_iomap_range_rw(0xe4, 0xe7, pio_f);
io->set_iomap_range_rw(0xe8, 0xeb, sio);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例2: emu
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
sio = new I8251(this, emu);
drec = new CMT(this, emu);
io = new IO(this, emu);
vdp = new MC6847(this, emu);
not = new NOT(this, emu);
psg = new YM2203(this, emu);
cpu = new Z80(this, emu);
joystick = new JOYSTICK(this, emu);
keyboard = new KEYBOARD(this, emu);
memory = new MEMORY(this, emu);
system = new SYSTEM(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(psg);
vdp->set_vram_ptr(memory->get_vram(), 0x1800);
vdp->set_font_ptr(memory->get_cgrom(), memory->get_pcgram());
vdp->set_context_vsync(not, SIG_NOT_INPUT, 1);
not->set_context_out(cpu, SIG_CPU_IRQ, 1);
joystick->set_context_psg(psg);
system->set_context_drec(drec);
system->set_context_vdp(vdp);
drec->set_context_sio(sio);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(dummy);
sio->set_context_out(drec, SIG_CMT_OUT);
// i/o bus
io->set_iomap_range_r(0x00, 0x0f, keyboard);
io->set_iomap_range_w(0x10, 0x1f, system);
io->set_iomap_range_w(0x30, 0x3f, system);
for(int i = 0x20; i < 0x30; i += 4) {
io->set_iomap_alias_w(i+1, psg, 1);
io->set_iomap_alias_r(i+2, psg, 1);
io->set_iomap_alias_w(i+3, psg, 0);
}
io->set_iomap_range_w(0x60, 0x7f, memory);
io->set_iomap_alias_rw(0xb0, sio, 0);
io->set_iomap_alias_rw(0xb8, sio, 1);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例3: emu
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
drec = new DATAREC(this, emu);
io = new IO(this, emu);
vdp = new MC6847(this, emu);
not = new NOT(this, emu);
psg = new YM2203(this, emu);
cpu = new Z80(this, emu);
joystick = new JOYSTICK(this, emu);
keyboard = new KEYBOARD(this, emu);
memory = new MEMORY(this, emu);
system = new SYSTEM(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(psg);
vdp->set_vram_ptr(memory->get_vram(), 0x1800);
vdp->set_context_vsync(not, SIG_NOT_INPUT, 1);
not->set_context_out(cpu, SIG_CPU_IRQ, 1);
vdp->set_context_vsync(system, SIG_SYSTEM_PORT, 0x10);
drec->set_context_out(system, SIG_SYSTEM_PORT, 0x20);
// bit6: printer busy
vdp->set_context_hsync(system, SIG_SYSTEM_PORT, 0x80);
joystick->set_context_psg(psg);
#ifdef _MAP1010
memory->set_context_keyboard(keyboard);
#endif
system->set_context_drec(drec);
system->set_context_vdp(vdp);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(dummy);
// i/o bus
io->set_iomap_single_rw(0x40, system);
#ifndef _MAP1010
io->set_iomap_range_r(0x80, 0x88, keyboard);
#endif
io->set_iomap_alias_w(0xc0, psg, 1); // PSG data
io->set_iomap_alias_w(0xc1, psg, 0); // PSG ch
// io->set_iomap_alias_r(0xc0, psg, 1);
io->set_iomap_alias_r(0xc1, psg, 1); // PSG data
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例4: emu
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
// cmt = new DATAREC(this, emu);
cpu = new I8080(this, emu);
pio = new I8155(this, emu);
io = new IO(this, emu);
buzzer = new PCM1BIT(this, emu);
rtc = new UPD1990A(this, emu);
keyboard = new KEYBOARD(this, emu);
lcd = new LCD(this, emu);
memory = new MEMORY(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(buzzer);
// cmt->set_context_out(cpu, SIG_I8085_SID, 1);
// cpu->set_context_sod(cmt, SIG_DATAREC_OUT, 1);
pio->set_context_port_a(rtc, SIG_UPD1990A_C0, 1, 0);
pio->set_context_port_a(rtc, SIG_UPD1990A_C1, 2, 0);
pio->set_context_port_a(rtc, SIG_UPD1990A_C2, 4, 0);
pio->set_context_port_a(rtc, SIG_UPD1990A_CLK, 8, 0);
pio->set_context_port_a(rtc, SIG_UPD1990A_DIN, 0x10, 0);
pio->set_context_port_a(keyboard, SIG_KEYBOARD_COLUMN_L, 0xff, 0);
pio->set_context_port_a(lcd, SIG_LCD_CHIPSEL_L, 0xff, 0);
pio->set_context_port_b(keyboard, SIG_KEYBOARD_COLUMN_H, 1, 0);
pio->set_context_port_b(lcd, SIG_LCD_CHIPSEL_H, 3, 0);
pio->set_context_port_b(buzzer, SIG_PCM1BIT_MUTE, 0x20, 0);
pio->set_context_timer(buzzer, SIG_PCM1BIT_SIGNAL, 1);
pio->set_constant_clock(CPU_CLOCKS);
rtc->set_context_dout(pio, SIG_I8155_PORT_C, 1);
rtc->set_context_tp(cpu, SIG_I8085_RST7, 1);
// memory->set_context_cmt(cmt);
memory->set_context_rtc(rtc);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
// i/o bus
io->set_iomap_range_w(0x90, 0x9f, memory);
io->set_iomap_range_rw(0xa0, 0xaf, memory);
io->set_iomap_range_rw(0xb0, 0xbf, pio);
io->set_iomap_range_r(0xe0, 0xef, keyboard);
io->set_iomap_range_rw(0xf0, 0xff, lcd);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例5: emu
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
drec = new DATAREC(this, emu);
cpu = new I8080(this, emu); // i8085
memory = new MEMORY(this, emu);
rtc = new RP5C01(this, emu);
io = new IO(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(drec);
drec->set_context_ear(io, SIG_IO_CMT, 1);
cpu->set_context_sod(io, SIG_IO_SOD, 1);
io->set_context_cpu(cpu);
io->set_context_drec(drec);
io->set_context_rtc(rtc);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(io);
#ifdef USE_DEBUGGER
cpu->set_context_debugger(new DEBUGGER(this, emu));
#endif
// memory bus
memset(rom, 0xff, sizeof(rom));
memset(ram, 0, sizeof(ram));
memory->read_bios(_T("BIOS.ROM"), rom, sizeof(rom));
FILEIO* fio = new FILEIO();
if(fio->Fopen(create_local_path(_T("RAM.BIN")), FILEIO_READ_BINARY)) {
fio->Fread(ram, sizeof(ram), 1);
fio->Fclose();
}
delete fio;
memory->set_memory_r(0x0000, 0x7fff, rom);
memory->set_memory_rw(0x8000, 0xffff, ram);
memory->set_wait_rw(0x0000, 0xffff, 1);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例6: emu
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
io = new IO(this, emu);
memory = new MEMORY(this, emu);
cpu = new Z80(this, emu);
joystick = new JOYSTICK(this, emu);
psg = new PSG(this, emu);
vdp = new VDP(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(psg);
vdp->set_context_cpu(cpu);
vdp->set_memory_ptr(mem);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(dummy);
#ifdef USE_DEBUGGER
cpu->set_context_debugger(new DEBUGGER(this, emu));
#endif
// memory bus
memset(mem, 0xff, 0x8000);
memset(mem + 0x8000, 0, 0x8000);
memory->set_memory_r(0x0000, 0x7fff, mem);
memory->set_memory_rw(0xb800, 0xbfff, mem + 0xb800);
// i/o bus
io->set_iomap_range_w(0xf8, 0xfa, psg);
io->set_iomap_range_rw(0xfc, 0xfd, joystick);
io->set_iomap_range_w(0xfe, 0xff, vdp);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
inserted = false;
}
示例7: emu
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
beep = new BEEP(this, emu);
drec = new DATAREC(this, emu);
tf20 = new TF20(this, emu);
cpu = new Z80(this, emu);
io = new IO(this, emu);
memory = new MEMORY(this, emu);
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(beep);
drec->set_context_out(io, SIG_IO_DREC, 1);
tf20->set_context_sio(io, SIG_IO_ART);
io->set_context_cpu(cpu);
io->set_context_mem(memory, memory->get_ram());
io->set_context_tf20(tf20);
io->set_context_beep(beep);
io->set_context_drec(drec);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(io);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例8: emu
//.........这里部分代码省略.........
sio_qd->set_context_break0(qd, QUICKDISK_SIO_BREAK, 1);
// Z80SIO:CTSA <- QD:PROTECT
// Z80SIO:DCDA <- QD:INSERT
// Z80SIO:DCDB <- QD:HOE
qd->set_context_sio(sio_qd);
// floppy drives
floppy->set_context_fdc(fdc);
#endif
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
#if defined(_MZ800) || defined(_MZ1500)
cpu->set_context_intr(pio_int);
// z80 family daisy chain
// 0=8253:OUT2
pio_int->set_context_intr(cpu, 1);
pio_int->set_context_child(sio_rs);
sio_rs->set_context_intr(cpu, 2);
sio_rs->set_context_child(sio_qd);
sio_qd->set_context_intr(cpu, 3);
#else
cpu->set_context_intr(dummy);
#endif
// emm
io->set_iomap_range_rw(0x00, 0x03, emm);
// ramfile
io->set_iomap_range_rw(0xea, 0xeb, ramfile);
// cmos
// io->set_iomap_range_rw(0xf8, 0xfa, cmos);
#if defined(_MZ800)
// 8255/8253
io->set_iomap_range_rw(0xd0, 0xd3, pio);
io->set_iomap_range_rw(0xd4, 0xd7, pit);
#endif
#if defined(_MZ800) || defined(_MZ1500)
// floppy drives
io->set_iomap_range_rw(0xd8, 0xdb, fdc);
io->set_iomap_range_w(0xdc, 0xdd, floppy);
#endif
// memory mapper
#if defined(_MZ800) || defined(_MZ1500)
#if defined(_MZ800)
io->set_iomap_range_r(0xe0, 0xe1, memory);
#endif
io->set_iomap_range_w(0xe0, 0xe6, memory);
#else
io->set_iomap_range_w(0xe0, 0xe4, memory);
#endif
#if defined(_MZ800)
// crtc
io->set_iomap_range_w(0xcc, 0xcf, memory);
io->set_iomap_single_r(0xce, memory);
// palette
io->set_iomap_single_w(0xf0, memory);
#elif defined(_MZ1500)
// palette
io->set_iomap_range_w(0xf0, 0xf1, memory);
#endif
#if defined(_MZ800)
// joystick
// io->set_iomap_range_r(0xf0, 0xf1, joystick);
#endif
// psg
#if defined(_MZ800)
io->set_iomap_single_w(0xf2, psg);
#elif defined(_MZ1500)
io->set_iomap_single_w(0xe9, psg);
io->set_iomap_single_w(0xf2, psg_l);
io->set_iomap_single_w(0xf3, psg_r);
#endif
#if defined(_MZ800) || defined(_MZ1500)
// z80pio/sio
// z80pio and z80sio*2
static int z80_sio_addr[4] = {0, 2, 1, 3};
static int z80_pio_addr[4] = {1, 3, 0, 2};
for(int i = 0; i < 4; i++) {
io->set_iomap_alias_rw(0xb0 + i, sio_rs, z80_sio_addr[i]);
io->set_iomap_alias_rw(0xf4 + i, sio_qd, z80_sio_addr[i]);
io->set_iomap_alias_rw(0xfc + i, pio_int, z80_pio_addr[i]);
}
#else
// printer
io->set_iovalue_single_r(0xfe, 0xc0);
#endif
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
}
示例9: emu
//.........这里部分代码省略.........
pc88pio->set_context_event_manager(pc88event);
pc88pcm = new PCM1BIT(this, emu);
pc88pcm->set_context_event_manager(pc88event);
pc88rtc = new UPD1990A(this, emu);
pc88rtc->set_context_event_manager(pc88event);
pc88opn = new YM2203(this, emu);
pc88opn->set_context_event_manager(pc88event);
#ifdef SUPPORT_PC88_OPNA
pc88opn->is_ym2608 = true;
#endif
pc88cpu = new Z80(this, emu);
pc88cpu->set_context_event_manager(pc88event);
if(config.printer_device_type == 0) {
pc88prn = new PRNFILE(this, emu);
pc88prn->set_context_event_manager(pc88event);
// } else if(config.printer_device_type == 1) {
// pc88prn = new PCPR201(this, emu);
// pc88prn->set_context_event_manager(pc88event);
} else {
pc88prn = dummy;
}
pc88sub = new PC80S31K(this, emu);
pc88sub->set_context_event_manager(pc88event);
pc88pio_sub = new I8255(this, emu);
pc88pio_sub->set_context_event_manager(pc88event);
pc88fdc_sub = new UPD765A(this, emu);
pc88fdc_sub->set_context_event_manager(pc88event);
pc88cpu_sub = new Z80(this, emu);
pc88cpu_sub->set_context_event_manager(pc88event);
pc88event->set_context_cpu(pc88cpu, (config.cpu_type != 0) ? 3993624 : 7987248);
pc88event->set_context_cpu(pc88cpu_sub, 3993624);
pc88event->set_context_sound(pc88opn);
pc88event->set_context_sound(pc88pcm);
pc88->set_context_cpu(pc88cpu);
pc88->set_context_opn(pc88opn);
pc88->set_context_pcm(pc88pcm);
pc88->set_context_pio(pc88pio);
pc88->set_context_prn(pc88prn);
pc88->set_context_rtc(pc88rtc);
pc88->set_context_sio(pc88sio);
pc88cpu->set_context_mem(pc88);
pc88cpu->set_context_io(pc88);
pc88cpu->set_context_intr(pc88);
#ifdef USE_DEBUGGER
pc88cpu->set_context_debugger(new DEBUGGER(this, emu));
#endif
pc88opn->set_context_irq(pc88, SIG_PC88_SOUND_IRQ, 1);
pc88sio->set_context_rxrdy(pc88, SIG_PC88_USART_IRQ, 1);
pc88sio->set_context_out(pc88, SIG_PC88_USART_OUT);
pc88sub->set_context_cpu(pc88cpu_sub);
pc88sub->set_context_fdc(pc88fdc_sub);
pc88sub->set_context_pio(pc88pio_sub);
pc88pio->set_context_port_a(pc88pio_sub, SIG_I8255_PORT_B, 0xff, 0);
pc88pio->set_context_port_b(pc88pio_sub, SIG_I8255_PORT_A, 0xff, 0);
pc88pio->set_context_port_c(pc88pio_sub, SIG_I8255_PORT_C, 0x0f, 4);
pc88pio->set_context_port_c(pc88pio_sub, SIG_I8255_PORT_C, 0xf0, -4);
pc88pio->clear_ports_by_cmdreg = true;
pc88pio_sub->set_context_port_a(pc88pio, SIG_I8255_PORT_B, 0xff, 0);
pc88pio_sub->set_context_port_b(pc88pio, SIG_I8255_PORT_A, 0xff, 0);
pc88pio_sub->set_context_port_c(pc88pio, SIG_I8255_PORT_C, 0x0f, 4);
pc88pio_sub->set_context_port_c(pc88pio, SIG_I8255_PORT_C, 0xf0, -4);
pc88pio_sub->clear_ports_by_cmdreg = true;
pc88fdc_sub->set_context_irq(pc88cpu_sub, SIG_CPU_IRQ, 1);
pc88cpu_sub->set_context_mem(pc88sub);
pc88cpu_sub->set_context_io(pc88sub);
pc88cpu_sub->set_context_intr(pc88sub);
#ifdef USE_DEBUGGER
pc88cpu_sub->set_context_debugger(new DEBUGGER(this, emu));
#endif
#endif
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
device->initialize();
}
#if defined(_PC9801) || defined(_PC9801E)
fdc_2hd->get_disk_handler(0)->drive_num = 0;
fdc_2hd->get_disk_handler(1)->drive_num = 1;
fdc_2dd->get_disk_handler(0)->drive_num = 2;
fdc_2dd->get_disk_handler(1)->drive_num = 3;
fdc_sub->get_disk_handler(0)->drive_num = 4;
fdc_sub->get_disk_handler(1)->drive_num = 5;
#elif defined(_PC9801VF) || defined(_PC9801U)
fdc_2dd->get_disk_handler(0)->drive_num = 0;
fdc_2dd->get_disk_handler(1)->drive_num = 1;
#elif defined(_PC98DO) || defined(_PC98DOPLUS)
fdc->get_disk_handler(0)->drive_num = 0;
fdc->get_disk_handler(1)->drive_num = 1;
pc88fdc_sub->get_disk_handler(0)->drive_num = 2;
pc88fdc_sub->get_disk_handler(1)->drive_num = 3;
#else
fdc->get_disk_handler(0)->drive_num = 0;
fdc->get_disk_handler(1)->drive_num = 1;
#endif
}