Skip to content

Commit

Permalink
Fix G100 VBIOS mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Jan 2, 2024
1 parent af5aafb commit 318403b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/video/vid_mga.c
Original file line number Diff line number Diff line change
Expand Up @@ -6202,9 +6202,11 @@ mystique_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
if (!(mystique->pci_regs[0x43] & 0x40))
return;
mystique->pci_regs[addr] = val;
if (addr == 0x30)
mystique->pci_regs[addr] &= 1;
if (mystique->pci_regs[0x30] & 0x01) {
uint32_t addr = (mystique->pci_regs[0x32] << 16) | (mystique->pci_regs[0x33] << 24);
mem_mapping_set_addr(&mystique->bios_rom.mapping, addr, 0x8000);
mem_mapping_set_addr(&mystique->bios_rom.mapping, addr, (mystique->type == MGA_G100) ? 0x10000 : 0x8000);
} else
mem_mapping_disable(&mystique->bios_rom.mapping);
return;
Expand All @@ -6228,11 +6230,11 @@ mystique_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
if (val & 0x40) {
if (mystique->pci_regs[0x30] & 0x01) {
uint32_t addr = (mystique->pci_regs[0x32] << 16) | (mystique->pci_regs[0x33] << 24);
mem_mapping_set_addr(&mystique->bios_rom.mapping, addr, 0x8000);
mem_mapping_set_addr(&mystique->bios_rom.mapping, addr, (mystique->type == MGA_G100) ? 0x10000 : 0x8000);
} else
mem_mapping_disable(&mystique->bios_rom.mapping);
} else
mem_mapping_set_addr(&mystique->bios_rom.mapping, 0x000c0000, 0x8000);
mem_mapping_set_addr(&mystique->bios_rom.mapping, 0x000c0000, (mystique->type == MGA_G100) ? 0x10000 : 0x8000);
}
break;

Expand Down Expand Up @@ -6331,7 +6333,10 @@ mystique_init(const device_t *info)
else
romfn = ROM_MYSTIQUE_220;

rom_init(&mystique->bios_rom, romfn, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
if (mystique->type == MGA_G100)
rom_init(&mystique->bios_rom, romfn, 0xc0000, 0x10000, 0xffff, 0, MEM_MAPPING_EXTERNAL);
else
rom_init(&mystique->bios_rom, romfn, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
mem_mapping_disable(&mystique->bios_rom.mapping);

mystique->vram_size = device_get_config_int("memory");
Expand Down

0 comments on commit 318403b

Please sign in to comment.