示例#1
0
static int set_drive_rama(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    drive->drive_rama_enabled = val;
    set_drive_ram(vice_ptr_to_uint(param));
    return 0;
}
示例#2
0
static int set_drive_profdos(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    drive->profdos = val;
    set_drive_ram(vice_ptr_to_uint(param));

    return 0;
}
示例#3
0
static int set_drive_supercard(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    drive->supercard = val;
    set_drive_ram(vice_ptr_to_uint(param));

    return 0;
}
示例#4
0
static int set_drive_parallel_cable(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    if (val != DRIVE_PC_NONE && val != DRIVE_PC_STANDARD)
        return -1;

    drive->parallel_cable = val;
    set_drive_ram(vice_ptr_to_uint(param));

    return 0;
}
示例#5
0
static int set_drive_parallel_cable(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    if (val >= DRIVE_PC_NUM) {
        return -1;
    }

    drive->parallel_cable = val;
    set_drive_ram(vice_ptr_to_uint(param));

    return 0;
}
示例#6
0
文件: vsidui.c 项目: AreaScout/vice
static void ui_translate_menu_popups(HMENU menu, ui_popup_translation_table_t *trans_table)
{
    int pos1 = -1;
    int pos2 = -1;
    int pos3 = -1;

    HMENU menu1 = NULL;
    HMENU menu2 = NULL;
    HMENU menu3 = NULL;

    int i = 0;

    if (trans_table == NULL) {
        return;
    }

    while (trans_table[i].level != 0) {
        switch (trans_table[i].level) {
            case 1:
                menu1 = NULL;
                while (menu1 == NULL) {
                    pos1++;
                    menu1 = GetSubMenu(menu, pos1);
                }
                if (trans_table[i].ids != 0) {
                    ModifyMenu(menu, (UINT)pos1, MF_BYPOSITION | MF_STRING | MF_POPUP, vice_ptr_to_uint(menu1), translate_text(trans_table[i].ids));
                }
                pos2 = -1;
                pos3 = -1;
                break;
            case 2:
                menu2 = NULL;
                while (menu2 == NULL) {
                    pos2++;
                    menu2 = GetSubMenu(menu1, pos2);
                }
                ModifyMenu(menu1, (UINT)pos2, MF_BYPOSITION | MF_STRING | MF_POPUP, vice_ptr_to_uint(menu2), translate_text(trans_table[i].ids));
                pos3 = -1;
                break;
            case 3:
                menu3 = NULL;
                while (menu3 == NULL) {
                    pos3++;
                    menu3 = GetSubMenu(menu2, pos3);
                }
                ModifyMenu(menu2, (UINT)pos3, MF_BYPOSITION | MF_STRING | MF_POPUP, vice_ptr_to_uint(menu3), translate_text(trans_table[i].ids));
                break;
        }
        i++;
    }
}
示例#7
0
static int set_attach_device_readonly(int value, void *param)
{
    unsigned int unit = vice_ptr_to_uint(param);
    const char *old_filename;
    char *new_filename;
    int rc;
    int val = value ? 1 : 0;

    /* Do nothing if resource is unchanged. */
    if (attach_device_readonly_enabled[unit - 8] == val) {
        return 0;
    }

    old_filename = file_system_get_disk_name(unit);

    /* If no disk is attached, just changed the resource.  */
    if (old_filename == NULL) {
        attach_device_readonly_enabled[unit - 8] = val;
        return 0;
    }

    /* Old filename will go away after the image is detached.  */
    new_filename = lib_stralloc(old_filename);

    file_system_detach_disk(unit);
    attach_device_readonly_enabled[unit - 8] = val;

    rc = file_system_attach_disk(unit, new_filename);

    lib_free(new_filename);

    return rc;
}
示例#8
0
static int set_drive_idling_method(int val, void *param)
{
    unsigned int dnr;
    drive_t *drive;

    dnr = vice_ptr_to_uint(param);
    drive = drive_context[dnr]->drive;

    /* FIXME: Maybe we should call `drive_cpu_execute()' here?  */
    switch (val) {
        case DRIVE_IDLE_SKIP_CYCLES:
        case DRIVE_IDLE_TRAP_IDLE:
        case DRIVE_IDLE_NO_IDLE:
            break;
        default:
            return -1;
    }

    drive->idling_method = val;

    if (!rom_loaded) {
        return 0;
    }

    driverom_initialize_traps(drive);
    return 0;
}
示例#9
0
static int set_romset_firmware(int val, void *param)
{
    unsigned int num = vice_ptr_to_uint(param);

    romset_firmware[num] = val;

    return 0;
}
示例#10
0
static int set_h6809_rom_name(const char *val, void *param)
{
    unsigned int num = vice_ptr_to_uint(param);

    if (util_string_set(&petres.h6809romName[num], val))
        return 0;

    return petrom_load_6809rom(num);
}
static int set_drive_parallel_cable(int val, void *param)
{
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;

    switch (val) {
        case DRIVE_PC_NONE:
        case DRIVE_PC_STANDARD:
        case DRIVE_PC_DD3:
        case DRIVE_PC_FORMEL64:
            break;
        default:
            return -1;
    }

    drive->parallel_cable = val;
    set_drive_ram(vice_ptr_to_uint(param));

    return 0;
}
示例#12
0
static int set_drive_rpm_wobble(int val, void *param)
{
    unsigned int dnr;
    drive_t *drive;

    dnr = vice_ptr_to_uint(param);
    drive = drive_context[dnr]->drive;

    drive->rpm_wobble = val;
    return 0;
}
示例#13
0
static int set_drive_rtc_save(int val, void *param)
{
    unsigned int dnr;
    drive_t *drive;

    dnr = vice_ptr_to_uint(param);
    drive = drive_context[dnr]->drive;

    drive->rtc_save = val ? 1 : 0;

    return 0;
}
示例#14
0
文件: fdc.c 项目: bobsummerwill/VICE
static void clk_overflow_callback(CLOCK sub, void *data)
{
    unsigned int fnum;

    fnum = vice_ptr_to_uint(data);

    if (fdc[fnum].fdc_state != FDC_UNUSED) {
        if (fdc[fnum].alarm_clk > sub) {
            fdc[fnum].alarm_clk -= sub;
        } else {
            fdc[fnum].alarm_clk = 0;
        }
    }
}
示例#15
0
static int drive_resources_type(int val, void *param)
{
	switch (vice_ptr_to_uint(param))
	{
		case 0:
			return drive0_resources_type(val, param);
		case 1:
		case 2:
		case 3:
			return drive1_resources_type(val, param);
	}

	return -1;
}
示例#16
0
static UI_CALLBACK(save_screenshot)
{
    /* Where does the 1024 come from?  */
    char filename[1024];
    unsigned int wid = vice_ptr_to_uint(UI_MENU_CB_PARAM);

    vsync_suspend_speed_eval();

    /* The following code depends on a zeroed filename.  */
    memset(filename, 0, 1024);

    if (ui_screenshot_dialog(filename, machine_video_canvas_get(wid)) < 0) {
        return;
    }
}
示例#17
0
static UI_CALLBACK(drive_reset)
{
    vsync_suspend_speed_eval();
    drivecpu_trigger_reset(vice_ptr_to_uint(UI_MENU_CB_PARAM));
}
示例#18
0
static int set_file_system_device(int val, void *param)
{
    vdrive_t *vdrive;
    unsigned int unit = vice_ptr_to_uint(param);
    unsigned int idx;
    int old_device_enabled;

    if ((unit < 8) || (unit > 11)) {
        DBG(("set_file_system_device invalid dev #%d\n", unit));
        return -1;
    }
    idx = unit - 8;
    old_device_enabled = file_system_device_enabled[idx];

    vdrive = file_system_get_vdrive(unit);

    DBG(("set_file_system_device dev #%d old dev:%d new dev:%d\n", unit, old_device_enabled, val));

    switch (val) {
        case ATTACH_DEVICE_NONE:
            if (old_device_enabled == ATTACH_DEVICE_REAL) {
                serial_realdevice_disable();
            }
            if (old_device_enabled == ATTACH_DEVICE_RAW) {
                detach_disk_image(vdrive->image, vdrive, unit);
            }

            if (vdrive != NULL && vdrive->image == NULL) {
                vdrive_device_setup(vdrive, unit);
                serial_device_type_set(SERIAL_DEVICE_NONE, unit);
                file_system_set_serial_hooks(unit, 0);
            }
            break;
        case ATTACH_DEVICE_VIRT:
            if (old_device_enabled == ATTACH_DEVICE_REAL) {
                serial_realdevice_disable();
            }
            if (old_device_enabled == ATTACH_DEVICE_RAW) {
                detach_disk_image(vdrive->image, vdrive, unit);
            }

            if (vdrive != NULL && vdrive->image == NULL) {
                vdrive_device_setup(vdrive, unit);
                serial_device_type_set(SERIAL_DEVICE_VIRT, unit);
                file_system_set_serial_hooks(unit, 0);
            }
            break;
        case ATTACH_DEVICE_FS:
            if (old_device_enabled == ATTACH_DEVICE_REAL) {
                serial_realdevice_disable();
            }
            if (old_device_enabled == ATTACH_DEVICE_RAW) {
                detach_disk_image(vdrive->image, vdrive, unit);
            }

            if (vdrive != NULL && vdrive->image != NULL) {
                detach_disk_image_and_free(vdrive->image, vdrive, unit);
                ui_display_drive_current_image(idx, "");
            }
            if (vdrive != NULL && vdrive->image == NULL) {
                vdrive_device_setup(vdrive, unit);
                serial_device_type_set(SERIAL_DEVICE_FS, unit);
                file_system_set_serial_hooks(unit, 1);
            }
            break;
#ifdef HAVE_OPENCBM
        case ATTACH_DEVICE_REAL:
            if (old_device_enabled == ATTACH_DEVICE_RAW) {
                detach_disk_image(vdrive->image, vdrive, unit);
            }
            if (serial_realdevice_enable() < 0) {
                log_warning(attach_log, "Falling back to fs device.");
                return set_file_system_device(ATTACH_DEVICE_FS, param);
            }
            if (vdrive != NULL && vdrive->image != NULL) {
                detach_disk_image_and_free(vdrive->image, vdrive, unit);
                ui_display_drive_current_image(idx, "");
                vdrive_device_setup(vdrive, unit);
            }
            serial_device_type_set(SERIAL_DEVICE_REAL, unit);
            break;
#endif
#ifdef HAVE_RAWDRIVE
        case ATTACH_DEVICE_RAW:
            if (old_device_enabled == ATTACH_DEVICE_REAL) {
                serial_realdevice_disable();
            }
            if (vdrive != NULL && vdrive->image != NULL) {
                detach_disk_image_and_free(vdrive->image, vdrive, unit);
                ui_display_drive_current_image(idx, "");
                vdrive_device_setup(vdrive, unit);
            }
            attach_disk_image(&(vdrive->image), vdrive, "DUMMY", unit,
                              ATTACH_DEVICE_RAW);
            file_system_set_serial_hooks(unit, 0);
            serial_device_type_set(SERIAL_DEVICE_RAW, unit);
            break;
#endif
        default:
            return -1;
    }

    file_system_device_enabled[idx] = val;

    return 0;
}
示例#19
0
void render_24_1x2_04(const video_render_color_tables_t *color_tab, const BYTE *src, BYTE *trg,
                      unsigned int width, const unsigned int height,
                      const unsigned int xs, const unsigned int ys,
                      const unsigned int xt, const unsigned int yt,
                      const unsigned int pitchs, const unsigned int pitcht,
                      const unsigned int doublescan)
{
    const DWORD *colortab = color_tab->physical_colors;
    const BYTE *tmpsrc;
    BYTE *tmptrg;
    unsigned int x, y, wstart, wfast, wend, yys;
    register DWORD color;
    DWORD tcolor;

    src = src + pitchs * ys + xs;
    trg = trg + pitcht * yt + (xt * 3);
    yys = (ys << 1) | (yt & 1);
    if (width < 4) {
        wstart = width;
        wfast = 0;
        wend = 0;
    } else {
        /* alignment: 4 pixels*/
        wstart = (unsigned int)(4 - (vice_ptr_to_uint(trg) & 3));
        wfast = (width - wstart) >> 2; /* fast loop for 4 pixel segments*/
        wend = (width - wstart) & 0x03; /* do not forget the rest*/
    }
    for (y = yys; y < (yys + height); y++) {
        tmpsrc = src;
        tmptrg = trg;
        if ((y & 1) || doublescan) {
            for (x = 0; x < wstart; x++) {
                color = colortab[*tmpsrc++];
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                tmptrg += 3;
            }
            for (x = 0; x < wfast; x++) {
                color = colortab[tmpsrc[0]];
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                color = colortab[tmpsrc[1]];
                tmptrg[3] = (BYTE)color;
                color >>= 8;
                tmptrg[4] = (BYTE)color;
                color >>= 8;
                tmptrg[5] = (BYTE)color;
                color = colortab[tmpsrc[2]];
                tmptrg[6] = (BYTE)color;
                color >>= 8;
                tmptrg[7] = (BYTE)color;
                color >>= 8;
                tmptrg[8] = (BYTE)color;
                color = colortab[tmpsrc[3]];
                tmptrg[9] = (BYTE)color;
                color >>= 8;
                tmptrg[10] = (BYTE)color;
                color >>= 8;
                tmptrg[11] = (BYTE)color;
                tmpsrc += 4;
                tmptrg += 12;
            }
            for (x = 0; x < wend; x++) {
                color = colortab[*tmpsrc++];
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                tmptrg += 3;
            }
            if (y & 1) {
                src += pitchs;
            }
        } else {
            tcolor = (WORD)colortab[0];
            for (x = 0; x < wstart; x++) {
                color = tcolor;
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                tmptrg += 3;
            }
            for (x = 0; x < wfast; x++) {
                color = tcolor;
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                color = tcolor;
                tmptrg[3] = (BYTE)color;
                color >>= 8;
                tmptrg[4] = (BYTE)color;
                color >>= 8;
                tmptrg[5] = (BYTE)color;
                color = tcolor;
                tmptrg[6] = (BYTE)color;
                color >>= 8;
                tmptrg[7] = (BYTE)color;
                color >>= 8;
                tmptrg[8] = (BYTE)color;
                color = tcolor;
                tmptrg[9] = (BYTE)color;
                color >>= 8;
                tmptrg[10] = (BYTE)color;
                color >>= 8;
                tmptrg[11] = (BYTE)color;
                tmpsrc += 4;
                tmptrg += 12;
            }
            for (x = 0; x < wend; x++) {
                color = tcolor;
                tmptrg[0] = (BYTE)color;
                color >>= 8;
                tmptrg[1] = (BYTE)color;
                color >>= 8;
                tmptrg[2] = (BYTE)color;
                tmptrg += 3;
            }
        }
        trg += pitcht;
    }
示例#20
0
void render_08_1x2_04(const video_render_color_tables_t *color_tab, const BYTE *src, BYTE *trg,
                      unsigned int width, const unsigned int height,
                      const unsigned int xs, const unsigned int ys,
                      const unsigned int xt, const unsigned int yt,
                      const unsigned int pitchs, const unsigned int pitcht,
                      const unsigned int doublescan)
{
    const DWORD *colortab = color_tab->physical_colors;
    const BYTE *tmpsrc;
    BYTE *tmptrg;
    unsigned int x, y, wstart, wfast, wend, yys;
    BYTE color;

    src += pitchs * ys + xs;
    trg += pitcht * yt + xt;
    yys = (ys << 1) | (yt & 1);
    if (width < 8) {
        wstart = width;
        wfast = 0;
        wend = 0;
    } else {
        /* alignment: 8 pixels*/
        wstart = (unsigned int)(8 - (vice_ptr_to_uint(trg) & 7));
        wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
        wend = (width - wstart) & 0x07; /* do not forget the rest*/
    }
    for (y = yys; y < (yys + height); y++) {
        tmpsrc = src;
        tmptrg = trg;
        if ((y & 1) || doublescan) {
            for (x = 0; x < wstart; x++) {
                *tmptrg++ = (BYTE)colortab[*tmpsrc++];
            }
            for (x = 0; x < wfast; x++) {
                tmptrg[0] = (BYTE)colortab[tmpsrc[0]];
                tmptrg[1] = (BYTE)colortab[tmpsrc[1]];
                tmptrg[2] = (BYTE)colortab[tmpsrc[2]];
                tmptrg[3] = (BYTE)colortab[tmpsrc[3]];
                tmptrg[4] = (BYTE)colortab[tmpsrc[4]];
                tmptrg[5] = (BYTE)colortab[tmpsrc[5]];
                tmptrg[6] = (BYTE)colortab[tmpsrc[6]];
                tmptrg[7] = (BYTE)colortab[tmpsrc[7]];
                tmpsrc += 8;
                tmptrg += 8;
            }
            for (x = 0; x < wend; x++) {
                *tmptrg++ = (BYTE)colortab[*tmpsrc++];
            }
            if (y & 1) {
                src += pitchs;
            }
        } else {
            color = (BYTE)colortab[0];
            for (x = 0; x < wstart; x++) {
                *tmptrg++ = color;
            }
            for (x = 0; x < wfast; x++) {
                tmptrg[0] = color;
                tmptrg[1] = color;
                tmptrg[2] = color;
                tmptrg[3] = color;
                tmptrg[4] = color;
                tmptrg[5] = color;
                tmptrg[6] = color;
                tmptrg[7] = color;
                tmpsrc += 8;
                tmptrg += 8;
            }
            for (x = 0; x < wend; x++) {
                *tmptrg++ = color;
            }
        }
        trg += pitcht;
    }
}
示例#21
0
static UI_MENU_CALLBACK(uiprinter_formfeed_callback)
{
    printer_formfeed(vice_ptr_to_uint(param));
    return NULL;
}
示例#22
0
static int set_drive_traceflg(int val, void *param)
{
    debug.drivecpu_traceflg[vice_ptr_to_uint(param)] = val;
    return 0;
}
示例#23
0
static int drive_resources_type(int val, void *param)
{
    unsigned int type, dnr;
    int busses;
    drive_t *drive, *drive0;

    dnr = vice_ptr_to_uint(param);
    drive = drive_context[dnr]->drive;

    type = (unsigned int)val;
    busses = iec_available_busses();

    /* if bus for drive type is not allowed, set to default value for bus */
    if (!drive_check_bus(type, busses)) {
        if (busses & IEC_BUS_IEC) {
            type = DRIVE_TYPE_1541;
        } else
        if (busses & IEC_BUS_IEEE) {
            type = DRIVE_TYPE_2031;
        } else {
            type = DRIVE_TYPE_NONE;
        }
    }

    if (is_drive0(dnr)) {
        if (drive_check_dual(type)) {
            int drive1 = mk_drive1(dnr);

            /* dual disk drives disable second emulated unit */
            log_warning(drive->log,
                        "Dual disk drive %d disables emulated drive %d", dnr, drive1);

            drive_resources_type(DRIVE_TYPE_NONE, int_to_void_ptr(drive1));
        }
    } else {
        drive0 = drive_context[mk_drive0(dnr)]->drive;
        if (drive0->enable && drive_check_dual(drive0->type)) {
            /* dual disk drives disable second emulated unit */
            log_warning(drive->log,
                        "Dual disk drive %d disables emulated drive %d", mk_drive0(dnr), dnr);

            type = DRIVE_TYPE_NONE;
        }
    }

    switch (type) {
        case DRIVE_TYPE_1541:
        case DRIVE_TYPE_1541II:
        case DRIVE_TYPE_1551:
        case DRIVE_TYPE_1570:
        case DRIVE_TYPE_1571:
        case DRIVE_TYPE_1571CR:
        case DRIVE_TYPE_1581:
        case DRIVE_TYPE_2000:
        case DRIVE_TYPE_4000:
        case DRIVE_TYPE_2031:
        case DRIVE_TYPE_1001:
        case DRIVE_TYPE_2040:
        case DRIVE_TYPE_3040:
        case DRIVE_TYPE_4040:
        case DRIVE_TYPE_8050:
        case DRIVE_TYPE_8250:
            if (drive->type != type) {
                drive->current_half_track = 2 * 18;
                if ((type == DRIVE_TYPE_1001)
                    || (type == DRIVE_TYPE_8050)
                    || (type == DRIVE_TYPE_8250)) {
                    drive->current_half_track = 2 * 38;
                }
            }
            drive->type = type;
            if (drive_true_emulation) {
                drive->enable = 1;
                drive_enable(drive_context[dnr]);
                /* 1551 drive does not use the IEC bus */
                machine_bus_status_drivetype_set(dnr + 8, drive_check_bus(type,
                                                                          IEC_BUS_IEC));
            } else {
                drive_enable_update_ui(drive_context[dnr]);
            }
            drive_set_disk_drive_type(type, drive_context[dnr]);
            driverom_initialize_traps(drive);
            machine_drive_idling_method(dnr);
            return 0;
        case DRIVE_TYPE_NONE:
            drive->type = type;
            drive_disable(drive_context[dnr]);
            machine_bus_status_drivetype_set(dnr + 8, 0);
            return 0;
        default:
            return -1;
    }
}
示例#24
0
static int drive1_resources_type(int val, void *param)
{
	unsigned int type, dnr;
	int busses;
	drive_t *drive, *drive0;

	dnr = vice_ptr_to_uint(param);
	drive = drive_context[dnr]->drive;
	drive0 = drive_context[0]->drive;

	type = (unsigned int)val;
	busses = iec_available_busses();

	/* if bus for drive type is not allowed, set to default value for bus */
	if (!drive_check_bus(type, dnr, busses))
	{
		if (busses & IEC_BUS_IEC)
			type = DRIVE_TYPE_1541;
		else
			if (busses & IEC_BUS_IEEE)
				type = DRIVE_TYPE_2031;
			else
				type = DRIVE_TYPE_NONE;
	}

	if (drive0->enable && drive_check_dual(drive0->type))
	{
		/* dual disk drives disable second emulated unit */
		#ifdef CELL_DEBUG
		printf("WARNING: Dual disk drive disables second emulated drive\n");
		#endif

		type = DRIVE_TYPE_NONE;
	}

	switch (type)
	{
		case DRIVE_TYPE_1541:
		case DRIVE_TYPE_1541II:
		case DRIVE_TYPE_1551:
		case DRIVE_TYPE_1570:
		case DRIVE_TYPE_1571:
		case DRIVE_TYPE_1571CR:
		case DRIVE_TYPE_1581:
		case DRIVE_TYPE_2031:
		case DRIVE_TYPE_1001:
		case DRIVE_TYPE_2040:
		case DRIVE_TYPE_3040:
		case DRIVE_TYPE_4040:
		case DRIVE_TYPE_8050:
		case DRIVE_TYPE_8250:
			if (drive->type != type) {
				drive->current_half_track = 2 * 18;
				if ((type == DRIVE_TYPE_1001)
						|| (type == DRIVE_TYPE_8050)
						|| (type == DRIVE_TYPE_8250)) {
					drive->current_half_track = 2 * 38;
				}
			}
			drive->type = type;
			if (drive_true_emulation) {
				drive->enable = 1;
				drive_enable(drive_context[dnr]);
				/* 1551 drive does not use the IEC bus */
				machine_bus_status_drivetype_set(dnr + 8, drive_check_bus(type,
							dnr, IEC_BUS_IEC));
			}
			drive_set_disk_drive_type(type, drive_context[dnr]);
			driverom_initialize_traps(drive);
			machine_drive_idling_method(dnr);
			return 0;
		case DRIVE_TYPE_NONE:
			drive->type = type;
			drive_disable(drive_context[dnr]);
			machine_bus_status_drivetype_set(dnr + 8, 0);
			return 0;
		default:
			return -1;
	}
}
示例#25
0
void render_16_1x2_04(const video_render_color_tables_t *color_tab, const BYTE *src, BYTE *trg,
                      unsigned int width, const unsigned int height,
                      const unsigned int xs, const unsigned int ys,
                      const unsigned int xt, const unsigned int yt,
                      const unsigned int pitchs, const unsigned int pitcht,
                      const unsigned int doublescan, video_render_config_t *config)
{
    const DWORD *colortab = color_tab->physical_colors;
    const BYTE *tmpsrc;
    WORD *tmptrg;
    unsigned int x,y,wstart,wfast,wend,yys;
    WORD color;
    int readable = config->readable;

    src=src + pitchs * ys + xs;
    trg=trg + pitcht * yt + (xt << 1);
    yys = (ys << 1) | (yt & 1);
    if (width < 8) {
        wstart = width;
        wfast = 0;
        wend = 0;
    } else {
        /* alignment: 8 pixels*/
        wstart = (unsigned int)(8 - (vice_ptr_to_uint(trg) & 7));
        wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
        wend  = (width - wstart) & 0x07; /* do not forget the rest*/
    }
    for (y = yys; y < (yys + height); y++) {
        tmpsrc = src;
        tmptrg = (WORD *)trg;
        if (!(y & 1) || doublescan) {
            if ((y & 1) && readable && y > yys) { /* copy previous line */
                memcpy(trg, trg - pitcht, width << 1);
            } else {
                for (x = 0; x < wstart; x++) {
                    *tmptrg++ = (WORD)colortab[*tmpsrc++];
                }
                for (x = 0; x < wfast; x++) {
                    tmptrg[0] = (WORD)colortab[tmpsrc[0]];
                    tmptrg[1] = (WORD)colortab[tmpsrc[1]];
                    tmptrg[2] = (WORD)colortab[tmpsrc[2]];
                    tmptrg[3] = (WORD)colortab[tmpsrc[3]];
                    tmptrg[4] = (WORD)colortab[tmpsrc[4]];
                    tmptrg[5] = (WORD)colortab[tmpsrc[5]];
                    tmptrg[6] = (WORD)colortab[tmpsrc[6]];
                    tmptrg[7] = (WORD)colortab[tmpsrc[7]];
                    tmpsrc += 8;
                    tmptrg += 8;
                }
                for (x = 0; x < wend; x++) {
                    *tmptrg++ = (WORD)colortab[*tmpsrc++];
                }
            }
        } else {
            if (readable && y > yys + 1) { /* copy 2 lines before */
                memcpy(trg, trg - pitcht * 2, width << 1);
            } else {
                color = (WORD)colortab[0];
                for (x = 0; x < wstart; x++) {
                    *tmptrg++ = color;
                }
                for (x = 0; x < wfast; x++) {
                    tmptrg[0] = color;
                    tmptrg[1] = color;
                    tmptrg[2] = color;
                    tmptrg[3] = color;
                    tmptrg[4] = color;
                    tmptrg[5] = color;
                    tmptrg[6] = color;
                    tmptrg[7] = color;
                    tmpsrc += 8;
                    tmptrg += 8;
                }
                for (x = 0; x < wend; x++) {
                    *tmptrg++ = color;
                }
            }
        }
        if (y & 1) {
            src += pitchs;
        }
        trg += pitcht;
    }
}