本文整理汇总了C++中Cpu::LoadRom方法的典型用法代码示例。如果您正苦于以下问题:C++ Cpu::LoadRom方法的具体用法?C++ Cpu::LoadRom怎么用?C++ Cpu::LoadRom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpu
的用法示例。
在下文中一共展示了Cpu::LoadRom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Interrupt_Controller_8259a i8259a;
std::cout << "8259a Interrupt Controller initialized." << std::endl;
Video video;
video.setcpu(&cpu);
std::cout << "video device initialized." << std::endl;
Display display;
display.setcpu(&cpu);
display.setvideo(&video);
std::cout << "Display device initialized." << std::endl;
Keyboard keyboard;
keyboard.InitKeyboard(&i8259a);
std::cout << "Keyboard device initialized." << std::endl;
timer timing;
timing.seti8259a(&i8259a);
timing.seti8253(&i8253);
timing.setvideo(&video);
std::cout << "System timer initialized." << std::endl;
disk_handle Disk_handle;
Disk_handle.setcpu(&cpu);
if(floppyname != NULL)
{
fd1 = new Disk(floppyname, 0);
fd1->setcpu(&cpu);
Disk_handle.insert_disk(0, fd1);
}
if(harddiskname != NULL)
{
hd1 = new Disk(harddiskname, 0x80);
hd1->setcpu(&cpu);
Disk_handle.insert_disk(0x80, hd1);
}
std::cout << "Disk controller initialized." << std::endl;
port_handle ports_operate;
ports_operate.seti8259a(&i8259a);
ports_operate.seti8253(&i8253);
ports_operate.setvideo(&video);
ports_operate.setkeyboard(&keyboard);
cpu.setports_operate(&ports_operate);
cpu.seti8259a(&i8259a);
cpu.seti8253(&i8253);
cpu.setvideo(&video);
cpu.setDisk_handle(&Disk_handle);
cpu.settimer(&timing);
timing.timer_init();
display.InitDisplay();
if(cpu.LoadBIOS(biosname))
std::cout << "load BIOS Success..." << std::endl;
if(cpu.LoadRom(0xF6000, "./ibm-basic-1.10.rom"))
std::cout << "load Basicrom Success..." << std::endl;
if(cpu.LoadRom(0xC0000, "./videorom.bin"))
std::cout << "load Videorom Success..." << std::endl;
// gettimeofday(&tv, NULL);
// start_time = tv.tv_sec * 1000000 + tv.tv_usec;
/*run CPU*/
pthread_create(&runthread, NULL, RunThread, (void *)(&cpu));
/*start SDL event listen*/
input_arg.cpu_arg = &cpu;
input_arg.keyboard_arg = &keyboard;
pthread_create(&inputthread, NULL, InputThread, (void *)(&input_arg));
/*start console*/
if(commandflag == 1)
{
console_arg.cpu_arg = &cpu;
console_arg.fd = &fd1;
console_arg.Disk_handle = &Disk_handle;
pthread_create(&consolethread, NULL, ConsoleThread, (void *)(&console_arg));
}
/*debug*/
// if(a == 1)
// {
// printf("now change disk!\n");
// Disk *fd2 = new Disk("./dos2.flp", 0);
// fd2->setcpu(&cpu);
// Disk_handle.eject_disk(0, &fd1);
// Disk_handle.insert_disk(0, fd2);
// printf("change finished!\n");
// }
/**/
pthread_join(runthread, NULL);
// gettimeofday(&tv, NULL);
// end_time = tv.tv_sec * 1000000 + tv.tv_usec;
//printf("\n\nExecute %llu Opcode in %lf Seconds.\nAverage:%llu Opcode/S.\n", cpu.GetCount(), (end_time - start_time) / 1000000.0, (uint64_t)(cpu.GetCount() / ((end_time - start_time) / 1000000.0)));
std::cout << "\n" << std::endl;
return 0;
}