当前位置: 首页>>代码示例>>C++>>正文


C++ Video::setcpu方法代码示例

本文整理汇总了C++中Video::setcpu方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::setcpu方法的具体用法?C++ Video::setcpu怎么用?C++ Video::setcpu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Video的用法示例。


在下文中一共展示了Video::setcpu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
    std::cout << "ScratchEMU v0.0.1 (c) 2013-2014 Ecular " << std::endl;
    const char *short_opts = "cb:f:h:B:";
    const struct option long_opts[] =
    {
        {"command", no_argument, NULL, 'c'},
        {"bios", required_argument, NULL, 'b'},
        {"floppy", required_argument, NULL, 'f'},
        {"harddisk", required_argument, NULL, 'h'},
        {"boot", required_argument, NULL, 'B'},
        {0, 0, 0, 0}
    };
    opterr = 0;
    char c;

    pthread_t runthread;
    pthread_t inputthread;
    pthread_t consolethread;
    struct InputArg input_arg;
    struct ConsoleArg console_arg;
    /*caculate time*/
    // struct timeval tv;
    // uint64_t start_time;
    // uint64_t end_time;
    /**/
    Disk *fd1 = NULL;
    Disk *hd1 = NULL;

    char *floppyname = NULL;
    char *biosname = NULL;
    char *harddiskname = NULL;
    int boot = 0;
    int commandflag = 0;

    while((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
        switch(c)
        {
        case 'c' :
            commandflag = 1;
            break;
        case 'f' :
            floppyname = optarg;
            break;
        case 'b' :
            biosname = optarg;
            break;
        case 'h' :
            harddiskname = optarg;
            break;
        case 'B' :
            if(*optarg == 'f')
                boot = 0;
            if(*optarg == 'h')
                boot = 0x80;
            break;
        case '?' :
            std::cout << "Usage: semu -b <bios_img_name> [-f <floppy_img_name>] | [-h <harddisk_img_name>] | [-B <boot_device_id>] | [-c]" << std::endl;
            return 1;
        default:
            abort();
        }
    }

    if(biosname == NULL)
    {
        std::cout << "Require specify Bios file!" << std::endl;
        std::cout << "Usage: semu -b <bios_img_name> [-f <floppy_img_name>] | [-h <harddisk_img_name>] | [-B <boot_device_id>] | [-c]" << std::endl;
        return -1;
    }

    try
    {
        if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
            throw "Could not initliaze SDL";
    }
    catch(const char *s)
    {
        std::cerr << s << std::endl;
        return -1;
    }
    std::cout << "SDL initialized." << std::endl;

    Cpu cpu;
    cpu.Init(0x100000);
    cpu.Reset();
    cpu.SetBootDevice(boot);
    std::cout << "CPU initialized." << std::endl;

    Interval_Timer_8253 i8253;
    std::cout << "8253 timer initialized." << std::endl;

    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;
//.........这里部分代码省略.........
开发者ID:ecular,项目名称:scratchemulator,代码行数:101,代码来源:main.cpp


注:本文中的Video::setcpu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。