Example #1
0
void initpc()
{
    char *p;
//        allegro_init();
    get_executable_name(pcempath,511);
    pclog("executable_name = %s\n", pcempath);
    p=get_filename(pcempath);
    *p=0;
    pclog("path = %s\n", pcempath);

    fdd_init();
    keyboard_init();
    mouse_init();
    joystick_init();
    midi_init();

    loadconfig(NULL);
    pclog("Config loaded\n");

    loadfont("mda.rom", 0, cga_fontdat, cga_fontdatm);
    loadfont("roms/pc1512/40078.ic127", 0, pc1512_fontdat, pc1512_fontdatm);
    loadfont("roms/pc200/40109.bin", 0, pc200_fontdat, pc200_fontdatm);

    codegen_init();

    cpuspeed2=(AT)?2:1;
//        cpuspeed2=cpuspeed;
    atfullspeed=0;

    device_init();

    initvideo();
    mem_init();
    loadbios();
    mem_add_bios();

    timer_reset();
    sound_reset();
    fdc_init();
// #ifdef USE_NETWORKING
    vlan_reset();	//NETWORK
    network_card_init(network_card_current);
// #endif

    loaddisc(0,discfns[0]);
    loaddisc(1,discfns[1]);

    //loadfont();
    loadnvr();
    sound_init();
    resetide();
#if __unix
    if (cdrom_drive == -1)
        cdrom_null_open(cdrom_drive);
    else
#endif
        ioctl_open(cdrom_drive);

    pit_reset();
    /*        if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed();
    ali1429_reset();
//        CPUID=(is486 && (cpuspeed==7 || cpuspeed>=9));
//        pclog("Init - CPUID %i %i\n",CPUID,cpuspeed);
    shadowbios=0;

#if __unix
    if (cdrom_drive == -1)
        cdrom_null_reset();
    else
#endif
        ioctl_reset();
}
Example #2
0
void resetpchard()
{
    if (!modelchanged)
        device_close_all();
    else
        modelchanged = 0;
    device_init();

    midi_close();
    midi_init();

    timer_reset();
    sound_reset();
    mem_resize();

    if (pcfirsttime)
    {
        fdc_init();
        pcfirsttime = 0;
    }
    else
        fdc_hard_reset();

    model_init();
    video_init();
    speaker_init();

// #ifdef USE_NETWORKING
    vlan_reset();	//NETWORK
    network_card_init(network_card_current);
// #endif

    sound_card_init(sound_card_current);
    if (GUS)
        device_add(&gus_device);
    if (GAMEBLASTER)
        device_add(&cms_device);
    if (SSI2001)
        device_add(&ssi2001_device);
    if (voodoo_enabled)
        device_add(&voodoo_device);
    pc_reset();

    resetide();

    loadnvr();

//        cpuspeed2 = (AT)?2:1;
//        atfullspeed = 0;
//        setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed);

    shadowbios = 0;
    ali1429_reset();

    keyboard_at_reset();

//        output=3;

#if __unix
    if (cdrom_drive == -1)
        cdrom_null_reset();
    else
#endif
        ioctl_reset();
}
Example #3
0
void piix_write(int func, int addr, uint8_t val, void *priv)
{
//        pclog("piix_write: func=%d addr=%02x val=%02x %04x:%08x\n", func, addr, val, CS, pc);
        if (func > 1)
           return;
        
        if (func == 1) /*IDE*/
        {
                switch (addr)
                {
                        case 0x04:
			// pclog("IDE on/off\n");
			if (romset == ROM_P55T2P4)  resetide();
                        card_piix_ide[0x04] = (card_piix_ide[0x04] & ~5) | (val & 5);
                        break;
                        case 0x07:
                        card_piix_ide[0x07] = (card_piix_ide[0x07] & ~0x38) | (val & 0x38);
                        break;
                        case 0x0d:
                        card_piix_ide[0x0d] = val;
                        break;
                        
                        case 0x20:
                        card_piix_ide[0x20] = (val & ~0x0f) | 1;
                        break;
                        case 0x21:
                        card_piix_ide[0x21] = val;
                        break;
                        
#if 0
			case 0x33:
			/* Note by OBattler: This is a hack, but it's needed to reset the cylinders of the IDE devices. */
			if (romset != ROM_P55T2P4)  break;
			if (val != piix_33)
			{
				resetide();
			}
			piix_33 = val;
			break;
#endif

                        case 0x40:
                        card_piix_ide[0x40] = val;
                        break;
                        case 0x41:
                        if ((val ^ card_piix_ide[0x41]) & 0x80)
                        {
                                ide_pri_disable();
                                if (val & 0x80)
                                        ide_pri_enable();
                        }
                        card_piix_ide[0x41] = val;
                        break;
                        case 0x42:
                        card_piix_ide[0x42] = val;
                        break;
                        case 0x43:
                        if ((val ^ card_piix_ide[0x43]) & 0x80)
                        {
                                ide_sec_disable();
                                if (val & 0x80)
                                   ide_sec_enable();                                  
                        }
                        card_piix_ide[0x43] = val;
                        break;
			case 0x44:
			if (piix_type >= 3)  card_piix_ide[0x44] = val;
			break;
                }
                if (addr == 4 || (addr & ~3) == 0x20) /*Bus master base address*/                
                {
                        uint16_t base = (card_piix_ide[0x20] & 0xf0) | (card_piix_ide[0x21] << 8);
                        io_removehandler(0, 0x10000, piix_bus_master_read, NULL, NULL, piix_bus_master_write, NULL, NULL,  NULL);
                        if (card_piix_ide[0x04] & 1)
                                io_sethandler(base, 0x10, piix_bus_master_read, NULL, NULL, piix_bus_master_write, NULL, NULL,  NULL);
                }
//                pclog("PIIX write %02X %02X\n", addr, val);
        }
        else
        {
                switch (addr)
                {
                        case 0x00: case 0x01: case 0x02: case 0x03:
                        case 0x08: case 0x09: case 0x0a: case 0x0b:
                        case 0x0e:
                        return;
                }
		if (addr == 0x6A)
		{
			if (piix_type == 1)
				card_piix[addr] = (val & 0xFC) | (card_piix[addr] | 3);
			else if (piix_type == 3)
				card_piix[addr] = (val & 0xFD) | (card_piix[addr] | 2);
		}
		else
	                card_piix[addr] = val;
        }
}