Пример #1
0
static void debug_out(char *s)
{
        startblit();
        WriteConsole(consf, s, strlen(s), NULL, NULL);
        endblit();
        rpclog("%s", s);
}
Пример #2
0
int
plat_setvid(int api)
{
    int i;

    win_log("Initializing VIDAPI: api=%d\n", api);
    startblit();
    video_wait_for_blit();

    /* Close the (old) API. */
    vid_apis[0][vid_api].close();
    vid_api = api;

    if (vid_apis[0][vid_api].local)
	ShowWindow(hwndRender, SW_SHOW);
      else
	ShowWindow(hwndRender, SW_HIDE);

    /* Initialize the (new) API. */
    i = vid_apis[0][vid_api].init((void *)hwndRender);
    endblit();
    if (! i) return(0);

    device_force_redraw();

    vid_api_inited = 1;

    return(1);
}
Пример #3
0
/* Tell the renderers about a new screen resolution. */
void
plat_vidsize(int x, int y)
{
    if (!vid_api_inited || !vid_apis[video_fullscreen][vid_api].resize) return;

    startblit();
    video_wait_for_blit();
    vid_apis[video_fullscreen][vid_api].resize(x, y);
    endblit();
}
Пример #4
0
void main_restart()
{
        bempause = 1;
        startblit();
        if (curtube == 3 || mouse_amx) remove_mouse();
        cmos_save(models[oldmodel]);
        oldmodel = curmodel;

        model_init();

        main_reset();

        if (curtube == 3 || mouse_amx) install_mouse();
        endblit();
        bempause = 0;
}
Пример #5
0
void acia_poll()
{
//        int c;
//        printf("Poll tape %i %i\n",motor,cswena);
        if (motor)
       	{
       	        startblit();
               	if (csw_ena) csw_poll();
               	else         uef_poll();
               	endblit();

                if (newdat&0x100)
                {
                        newdat&=0xFF;
                        tapenoise_adddat(newdat);
                }
                else if (csw_toneon || uef_toneon) tapenoise_addhigh();
        }
	//           polltape();
}
Пример #6
0
void
plat_setfullscreen(int on)
{
    HWND *hw;

    /* Want off and already off? */
    if (!on && !video_fullscreen) return;

    /* Want on and already on? */
    if (on && video_fullscreen) return;

    if (on && video_fullscreen_first) {
	video_fullscreen_first = 0;
	ui_msgbox(MBX_INFO, (wchar_t *)IDS_2052);
    }

    /* OK, claim the video. */
    startblit();
    video_wait_for_blit();

    win_mouse_close();

    /* Close the current mode, and open the new one. */
    vid_apis[video_fullscreen][vid_api].close();
    video_fullscreen = on;
    hw = (video_fullscreen) ? &hwndMain : &hwndRender;
    vid_apis[video_fullscreen][vid_api].init((void *) *hw);

    win_mouse_init();

    /* Release video and make it redraw the screen. */
    endblit();
    device_force_redraw();

    /* Finally, handle the host's mouse cursor. */
    /* win_log("%s full screen, %s cursor\n", on ? "enter" : "leave", on ? "hide" : "show"); */
    show_cursor(video_fullscreen ? 0 : -1);
}
Пример #7
0
void runpc()
{
    char s[200];
    int done=0;

    startblit();
    clockrate = models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed;

    if (is386)
    {
        if (cpu_use_dynarec)
            exec386_dynarec(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / (turbo ? 100 : 200));
        else
            exec386(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / (turbo ? 100 : 200));
    }
    else if (AT || is_nonat_286())
        exec386(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / (turbo ? 100 : 200));
    else
        execx86(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / (turbo ? 100 : 200));

    keyboard_poll_host();
    keyboard_process();
//                checkkeys();
    pollmouse();
    joystick_poll();
    endblit();

    framecountx++;
    framecount++;
    if (framecountx>=100)
    {
        pclog("onesec\n");
        framecountx=0;
        mips=(float)insc/1000000.0f;
        insc=0;
        flops=(float)fpucount/1000000.0f;
        fpucount=0;
        sreadlnum=readlnum;
        swritelnum=writelnum;
        segareads=egareads;
        segawrites=egawrites;
        scycles_lost = cycles_lost;

        cpu_recomp_blocks_latched = cpu_recomp_blocks;
        cpu_recomp_ins_latched = cpu_recomp_ins;
        cpu_recomp_full_ins_latched = cpu_recomp_full_ins;
        cpu_new_blocks_latched = cpu_new_blocks;
        cpu_recomp_flushes_latched = cpu_recomp_flushes;
        cpu_recomp_evicted_latched = cpu_recomp_evicted;
        cpu_recomp_reuse_latched = cpu_recomp_reuse;
        cpu_recomp_removed_latched = cpu_recomp_removed;
        cpu_reps_latched = cpu_reps;
        cpu_notreps_latched = cpu_notreps;

        cpu_recomp_blocks = 0;
        cpu_recomp_ins = 0;
        cpu_recomp_full_ins = 0;
        cpu_new_blocks = 0;
        cpu_recomp_flushes = 0;
        cpu_recomp_evicted = 0;
        cpu_recomp_reuse = 0;
        cpu_recomp_removed = 0;
        cpu_reps = 0;
        cpu_notreps = 0;

        updatestatus=1;
        readlnum=writelnum=0;
        egareads=egawrites=0;
        cycles_lost = 0;
        mmuflush=0;
        intcount=0;
        intcount=pitcount=0;
        emu_fps = frames;
        frames = 0;
    }
    if (win_title_update)
    {
        win_title_update=0;

        if (is386)
        {
            if (cpu_use_dynarec)
                sprintf(s, "PCem-X v10 [DYN] - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse");
            else
                sprintf(s, "PCem-X v10 [INT 286/386] - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse");
        }
        else if (AT || is_nonat_286())
            sprintf(s, "PCem-X v10 [INT 286/386] - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse");
        else
            sprintf(s, "PCem-X v10 [INT 808x] - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse");

        set_window_title(s);
    }
    done++;
    frame++;
}
Пример #8
0
Файл: uef.c Проект: fesh0r/b-em
void uef_findfilenames()
{
        int temp;
        uint8_t tb;
        int c;
        int fsize = 0;
        char s[256];
        uint32_t run, load;
        uint8_t status;
        int skip;
        int binchunk  = uef_inchunk,  bchunkid = uef_chunkid, bchunklen = uef_chunklen;
        int bchunkpos = uef_chunkpos, bchunkdatabits = uef_chunkdatabits;
        int bintone   = uef_intone,   bffound = ffound;
        float bchunkf = uef_chunkf;
        uint8_t bdat  = fdat;
        if (!uef_f) return;

        uef_inchunk  = 0; uef_chunkid = 0; uef_chunklen = 0;
        uef_chunkpos = 0; uef_chunkdatabits = 8; uef_intone = 0;
        uef_chunkf   = 0;

        startblit();
        temp=gztell(uef_f);
        gzseek(uef_f, 12, SEEK_SET);
        uefloop = 0;
        infilenames = 1;
        while (!uefloop)
        {
                ffound = 0;
                while (!ffound && !uefloop)
                {
                        uef_poll();
                }
                if (uefloop) break;
                fbuffer[0] = fbuffer[1];
                fbuffer[1] = fbuffer[2];
                fbuffer[2] = fbuffer[3];
                fbuffer[3] = fdat;
                if (fdat == 0x2A && uef_toneon == 1)
                {
                        fbuffer[3] = 0;
                        c = 0;
                        do
                        {
                                ffound = 0;
                                while (!ffound && !uefloop)
                                {
                                        uef_poll();
                                }
                                if (uefloop) break;
                                ffilename[c++] = fdat;
                        } while (fdat != 0x0 && c < 10);
                        if (uefloop) break;
                        c--;
                        while (c < 13) ffilename[c++] = 32;
                        ffilename[c] = 0;

                                getuefbyte();
                                tb = fdat;
                                getuefbyte();
                                load = tb | (fdat << 8);
                                getuefbyte();
                                tb = fdat;
                                getuefbyte();
                                load |= (tb | (fdat << 8)) << 16;

                                getuefbyte();
                                tb = fdat;
                                getuefbyte();
                                run = tb | (fdat << 8);
                                getuefbyte();
                                tb = fdat;
                                getuefbyte();
                                run |= (tb | (fdat << 8)) << 16;

                                getuefbyte();
                                getuefbyte();

                                getuefbyte();
                                tb = fdat;
                                getuefbyte();
                                skip = tb | (fdat << 8);

                                fsize += skip;

                                getuefbyte();
                                status = fdat;

                        if (status & 0x80)
                        {
                                sprintf(s, "%s Size %04X Load %08X Run %08X", ffilename, fsize, load, run);
                                cataddname(s);
                                fsize = 0;
                        }
                        for (c = 0; c <skip + 8; c++)
                        {
                                getuefbyte();
                        }
                }
        }
        infilenames = 0;
        gzseek(uef_f, temp, SEEK_SET);
        uefloop = 0;
        uef_inchunk       = binchunk;
        uef_chunkid       = bchunkid;
        uef_chunklen      = bchunklen;
        uef_chunkpos      = bchunkpos;
        uef_chunkdatabits = bchunkdatabits;
        uef_chunkf        = bchunkf;
        fdat = bdat;
        ffound = bffound;
        uef_intone = bintone;
        endblit();
}
Пример #9
0
void main_init(int argc, char *argv[])
{
        char t[512], *p;
        int c;
        int tapenext = 0, discnext = 0;

        startblit();

        log_open();
        log_info("main: starting %s", VERSION_STR);

        vid_fskipmax = 1;

        al_init_main(argc, argv);

        append_filename(t, exedir, "roms/tube/ReCo6502ROM_816", 511);
        if (!file_exists(t,FA_ALL,NULL) && selecttube == 4) selecttube = -1;

        curtube = selecttube;
        model_check();

        for (c = 1; c < argc; c++)
        {
//                log_debug("%i : %s",c,argv[c]);
/*                if (!strcasecmp(argv[c],"-1770"))
                {
                        I8271=0;
                        WD1770=1;
                }
                else*/
//#ifndef WIN32
                if (!strcasecmp(argv[c], "--help"))
                {
                        printf("%s command line options :\n\n", VERSION_STR);
                        printf("-mx             - start as model x (see readme.txt for models)\n");
                        printf("-tx             - start with tube x (see readme.txt for tubes)\n");
                        printf("-disc disc.ssd  - load disc.ssd into drives :0/:2\n");
                        printf("-disc1 disc.ssd - load disc.ssd into drives :1/:3\n");
                        printf("-autoboot       - boot disc in drive :0\n");
                        printf("-tape tape.uef  - load tape.uef\n");
                        printf("-fasttape       - set tape speed to fast\n");
                        printf("-s              - scanlines display mode\n");
                        printf("-i              - interlace display mode\n");
                        printf("-debug          - start debugger\n");
                        printf("-allegro        - use Allegro for video rendering\n");
                        exit(-1);
                }
                else
//#endif
                if (!strcasecmp(argv[c], "-tape"))
                {
                        tapenext = 2;
                }
                else if (!strcasecmp(argv[c], "-disc") || !strcasecmp(argv[c], "-disk"))
                {
                        discnext = 1;
                }
                else if (!strcasecmp(argv[c], "-disc1"))
                {
                        discnext = 2;
                }
                else if (argv[c][0] == '-' && (argv[c][1] == 'm' || argv[c][1] == 'M'))
                {
                        sscanf(&argv[c][2], "%i", &curmodel);
                }
                else if (argv[c][0] == '-' && (argv[c][1] == 't' || argv[c][1] == 'T'))
                {
                        sscanf(&argv[c][2], "%i", &curtube);
                }
                else if (!strcasecmp(argv[c], "-fasttape"))
                {
                        fasttape = 1;
                }
                else if (!strcasecmp(argv[c], "-autoboot"))
                {
                        autoboot = 150;
                }
                else if (argv[c][0] == '-' && (argv[c][1] == 'f' || argv[c][1]=='F'))
                {
                        sscanf(&argv[c][2], "%i", &vid_fskipmax);
            if (vid_fskipmax < 1) vid_fskipmax = 1;
            if (vid_fskipmax > 9) vid_fskipmax = 9;
                }
                else if (argv[c][0] == '-' && (argv[c][1] == 's' || argv[c][1] == 'S'))
                {
                        vid_scanlines = 1;
                }
                else if (!strcasecmp(argv[c], "-debug"))
                {
                        debug_core = 1;
                }
                else if (!strcasecmp(argv[c], "-debugtube"))
                {
                        debug_tube = 1;
                }
                else if (argv[c][0] == '-' && (argv[c][1] == 'i' || argv[c][1] == 'I'))
                {
                        vid_interlace = 1;
            vid_linedbl = vid_scanlines = 0;
                }
                else if (tapenext)
                   strcpy(tape_fn, argv[c]);
                else if (discnext)
                {
                        strcpy(discfns[discnext-1], argv[c]);
                        discnext = 0;
                }
                else
                {
                    if ((p = strrchr(argv[c], '.')) && (!strcasecmp(p, ".uef") || !strcasecmp(p, ".csw"))) {
                        strncpy(tape_fn, argv[c], sizeof tape_fn);
                        tapenext = 0;
                    }
                    else {
                        strncpy(discfns[0], argv[c], sizeof discfns[0]);
                        discnext = 0;
                        autoboot = 150;
                    }
                }
                if (tapenext) tapenext--;
        }

        video_init();
        mode7_makechars();

#ifndef WIN32
        install_keyboard();
#endif
        install_timer();

        mem_init();
        ddnoise_init();
        tapenoise_init();

        sound_init();
        al_init();
        sid_init();
        sid_settype(sidmethod, cursid);
        music5000_init();

    adc_init();
#ifdef WIN32
        pal_init();
#endif
        disc_init();
        fdi_init();

        scsi_init();
        ide_init();
        vdfs_init();

        model_init();

        midi_init();
        main_reset();

        install_int_ex(secint, MSEC_TO_TIMER(1000));
        install_int_ex(int50,  MSEC_TO_TIMER(20));

        set_display_switch_mode(SWITCH_BACKGROUND);
#ifdef WIN32
                timeBeginPeriod(1);
#endif
        oldmodel = curmodel;

        if (curtube == 3 || mouse_amx) install_mouse();

        disc_load(0, discfns[0]);
        disc_load(1, discfns[1]);
        tape_load(tape_fn);
        if (defaultwriteprot) writeprot[0] = writeprot[1] = 1;

        endblit();

        debug_start();
}