void *tandy_rom_init() { FILE *f, *ff; int c; tandy_rom = malloc(0x80000); f = romfopen(L"roms/tandy1000sl2/8079047.hu1", L"rb"); ff = romfopen(L"roms/tandy1000sl2/8079048.hu2", L"rb"); for (c = 0x0000; c < 0x80000; c += 2) { tandy_rom[c] = getc(f); tandy_rom[c + 1] = getc(ff); } fclose(ff); fclose(f); mem_mapping_add(&tandy_rom_mapping, 0xe0000, 0x10000, tandy_read_rom, tandy_read_romw, tandy_read_roml, NULL, NULL, NULL, tandy_rom, MEM_MAPPING_EXTERNAL, NULL); io_sethandler(0xffe8, 0x0008, tandy_rom_bank_read, NULL, NULL, tandy_rom_bank_write, NULL, NULL, NULL); return tandy_rom; }
int rom_init(rom_t *rom, char *fn, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { FILE *f = romfopen(fn, "rb"); if (!f) { #ifndef RELEASE_BUILD pclog("ROM image not found : %s\n", fn); #endif return -1; } rom->rom = malloc(size); fseek(f, file_offset, SEEK_SET); fread(rom->rom, size, 1, f); fclose(f); rom->mask = mask; mem_mapping_add(&rom->mapping, address, size, rom_read, rom_readw, rom_readl, mem_write_null, mem_write_nullw, mem_write_nulll, rom->rom, flags, rom); return 0; }
int rom_init_interleaved(rom_t *rom, char *fn_low, char *fn_high, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { FILE *f_low = romfopen(fn_low, "rb"); FILE *f_high = romfopen(fn_high, "rb"); int c; if (!f_low || !f_high) { #ifndef RELEASE_BUILD if (!f_low) pclog("ROM image not found : %s\n", fn_low); else #else if (f_low) #endif fclose(f_low); #ifndef RELEASE_BUILD if (!f_high) pclog("ROM image not found : %s\n", fn_high); else #else if (f_high) #endif fclose(f_high); return -1; } rom->rom = malloc(size); fseek(f_low, file_offset, SEEK_SET); fseek(f_high, file_offset, SEEK_SET); for (c = 0; c < size; c += 2) { rom->rom[c] = getc(f_low); rom->rom[c + 1] = getc(f_high); } fclose(f_high); fclose(f_low); rom->mask = mask; mem_mapping_add(&rom->mapping, address, size, rom_read, rom_readw, rom_readl, mem_write_null, mem_write_nullw, mem_write_nulll, rom->rom, flags, rom); return 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; }
void *intel_flash_init() { FILE *f; flash_t *flash = malloc(sizeof(flash_t)); int q = ((romset == ROM_REVENGE) || (romset == ROM_ENDEAVOR)); memset(flash, 0, sizeof(flash_t)); /* if (romset == ROM_440BX) { mem_mapping_add(&flash->read_mapping, 0x80000, 0x20000, flash_read, NULL, NULL, NULL, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, (void *)flash); mem_mapping_add(&flash->write_mapping, 0x80000, 0x20000, NULL, NULL, NULL, flash_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, (void *)flash); } */ 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_disable(&flash->read_mapping); flash->command = CMD_READ_ARRAY; flash->status = 0; memset(&rom[q ? 0xd000 : 0x1d000], 0xFF, 0x1000); configure_path(); fn = (char *) malloc(255); /* strcpy(fn, path); strcat(fn, "oemlogo.bin"); f = romfopen(fn, "rb"); if (f) { fread(&rom[0x1c000], 0x1000, 1, f); fclose(f); } */ strcpy(fn, path); strcat(fn, "escd.bin"); f = romfopen(fn, "rb"); if (f) { fread(&rom[q ? 0xd000 : 0x1d000], 0x1000, 1, f); fclose(f); } return flash; }