Example #1
0
void hercules_out(uint16_t addr, uint8_t val, void *p)
{
        hercules_t *hercules = (hercules_t *)p;
//        pclog("Herc out %04X %02X\n",addr,val);
        switch (addr)
        {
                case 0x3b0: case 0x3b2: case 0x3b4: case 0x3b6:
                hercules->crtcreg = val & 31;
                return;
                case 0x3b1: case 0x3b3: case 0x3b5: case 0x3b7:
                hercules->crtc[hercules->crtcreg] = val;
                if (hercules->crtc[10] == 6 && hercules->crtc[11] == 7) /*Fix for Generic Turbo XT BIOS, which sets up cursor registers wrong*/
                {
                        hercules->crtc[10] = 0xb;
                        hercules->crtc[11] = 0xc;
                }
                hercules_recalctimings(hercules);
                return;
                case 0x3b8:
                hercules->ctrl = val;
                return;
                case 0x3bf:
                hercules->ctrl2 = val;
                if (val & 2)
                        mem_mapping_set_addr(&hercules->mapping, 0xb0000, 0x10000);
                else
                        mem_mapping_set_addr(&hercules->mapping, 0xb0000, 0x08000);
                return;
        }
}
Example #2
0
void *intel_flash_init()
{
        FILE *f;
        flash_t *flash = malloc(sizeof(flash_t));
	int is_ami = ((romset == ROM_REVENGE) || (romset == ROM_PLATO) || (romset == ROM_ENDEAVOR));
	int has_dmi = ((romset == ROM_430HX) || (romset == ROM_430VX) || (romset == ROM_430TX) || (romset == ROM_440FX) || (romset == ROM_KN97));
	int is_bxb = ((romset == ROM_ACERV35N) || (romset == ROM_ACERV12LC));
        memset(flash, 0, sizeof(flash_t));

        mem_mapping_add(&flash->read_mapping,
       	            0xe0000, 
               	    0x20000,
       	            flash_read, NULL, NULL,
                    NULL, NULL, NULL,
               	    NULL, MEM_MAPPING_EXTERNAL, (void *)flash);
        mem_mapping_add(&flash->write_mapping,
                    0xe0000, 
       	            0x20000,
       	            NULL, NULL, NULL,
                    flash_write, NULL, NULL,
       	            NULL, MEM_MAPPING_EXTERNAL, (void *)flash);
        mem_mapping_add(&ext_read_mapping,
       	            0xfffe0000, 
               	    0x20000,
       	            flash_read, NULL, NULL,
                    NULL, NULL, NULL,
               	    NULL, MEM_MAPPING_EXTERNAL, (void *)flash);
        mem_mapping_add(&ext_write_mapping,
                    0xfffe0000, 
       	            0x20000,
       	            NULL, NULL, NULL,
                    flash_write, NULL, NULL,
       	            NULL, MEM_MAPPING_EXTERNAL, (void *)flash);
        mem_mapping_disable(&flash->read_mapping);
        mem_mapping_disable(&ext_read_mapping);

	if (!is_ami)
	{
		/* Non-AMI BIOS'es talk to the flash in high RAM. */
		if (romset != ROM_440FX)
		{
			mem_mapping_disable(&flash->write_mapping);
		}
		else
		{
			mem_mapping_set_addr(&flash->write_mapping, 0xf0000, 0x10000);
		}
		mem_mapping_enable(&ext_write_mapping);
	}
	else
	{
		/* AMI BIOS'es talk to the flash in low RAM. */
		mem_mapping_enable(&flash->write_mapping);
		mem_mapping_set_addr(&flash->write_mapping, 0xe0000, 0x20000);
		mem_mapping_disable(&ext_write_mapping);
	}

        flash->command = CMD_READ_ARRAY;
        flash->status = 0;
        
        memset(&rom[is_ami ? 0xd000 : (is_bxb ? 0x2000 : 0x1d000)], 0xFF, 0x1000);

	configure_path();
	fn = (char *) malloc(255);
	strcpy(fn, path);
	strcat(fn, "escd.bin");
        f = romfopen(fn, "rb");
        if (f)
        {
                fread(&rom[is_ami ? 0xd000 : (is_bxb ? 0x2000 : 0x1d000)], 0x1000, 1, f);
                fclose(f);
        }
	if (has_dmi || is_bxb)
	{
		strcpy(fn, path);
		strcat(fn, "dmi.bin");
	        f = romfopen(fn, "rb");
	        if (f)
	        {
	                fread(&rom[is_bxb ? 0x3000 : 0x1c000], 0x1000, 1, f);
	                fclose(f);
	        }
	}

	closed = 0;
        
        return flash;
}