Fix 8 MB SVGA VRAM limitations

This commit is contained in:
Darius Goad 2016-07-22 19:08:36 -05:00
parent 485d3d9b39
commit 663e15fd49

View file

@ -772,7 +772,7 @@ int svga_init(svga_t *svga, void *p, int memsize,
svga->vram = malloc(memsize);
svga->vram_limit = memsize;
svga->vrammask = memsize - 1;
svga->changedvram = malloc(/*(memsize >> 12) << 1*/0x800000 >> 12);
svga->changedvram = malloc(/*(memsize >> 12) << 1*/memsize >> 12);
svga->recalctimings_ex = recalctimings_ex;
svga->video_in = video_in;
svga->video_out = video_out;
@ -848,7 +848,7 @@ void svga_write(uint32_t addr, uint8_t val, void *p)
{
addr<<=2;
}
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return;
@ -1021,7 +1021,7 @@ uint8_t svga_read(uint32_t addr, void *p)
// pclog("%i\n", svga->readmode);
if (svga->chain4 || svga->fb_only)
{
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return 0xff;
return svga->vram[addr];
@ -1035,7 +1035,7 @@ uint8_t svga_read(uint32_t addr, void *p)
else
addr<<=2;
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return 0xff;
@ -1108,7 +1108,7 @@ void svga_write_linear(uint32_t addr, uint8_t val, void *p)
{
addr<<=2;
}
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return;
if (svga_output) pclog("%08X\n", addr);
@ -1271,7 +1271,7 @@ uint8_t svga_read_linear(uint32_t addr, void *p)
if (svga->chain4 || svga->fb_only)
{
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return 0xff;
return svga->vram[addr & 0x7fffff];
@ -1285,7 +1285,7 @@ uint8_t svga_read_linear(uint32_t addr, void *p)
else
addr<<=2;
addr &= 0x7fffff;
addr %= svga->vram_limit;
if (addr >= svga->vram_limit)
return 0xff;
@ -1400,7 +1400,7 @@ void svga_writew(uint32_t addr, uint16_t val, void *p)
if (svga_output) pclog("svga_writew: %05X ", addr);
addr = (addr & svga->banked_mask) + svga->write_bank;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return;
if (addr >= svga->vram_limit)
return;
@ -1431,7 +1431,7 @@ void svga_writel(uint32_t addr, uint32_t val, void *p)
if (svga_output) pclog("svga_writel: %05X ", addr);
addr = (addr & svga->banked_mask) + svga->write_bank;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return;
if (addr >= svga->vram_limit)
return;
@ -1457,7 +1457,7 @@ uint16_t svga_readw(uint32_t addr, void *p)
// pclog("Readw %05X ", addr);
addr = (addr & svga->banked_mask) + svga->read_bank;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return 0xffff;
// pclog("%08X %04X\n", addr, *(uint16_t *)&vram[addr]);
if (addr >= svga->vram_limit) return 0xffff;
@ -1481,7 +1481,7 @@ uint32_t svga_readl(uint32_t addr, void *p)
// pclog("Readl %05X ", addr);
addr = (addr & svga->banked_mask) + svga->read_bank;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return 0xffffffff;
// pclog("%08X %08X\n", addr, *(uint32_t *)&vram[addr]);
if (addr >= svga->vram_limit) return 0xffffffff;
@ -1508,7 +1508,7 @@ void svga_writew_linear(uint32_t addr, uint16_t val, void *p)
cycles_lost += video_timing_w;
if (svga_output) pclog("Write LFBw %08X %04X\n", addr, val);
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return;
if (addr >= svga->vram_limit)
return;
@ -1537,7 +1537,7 @@ void svga_writel_linear(uint32_t addr, uint32_t val, void *p)
cycles_lost += video_timing_l;
if (svga_output) pclog("Write LFBl %08X %08X\n", addr, val);
addr &= 0x7fffff;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return;
if (addr >= svga->vram_limit)
return;
@ -1559,7 +1559,7 @@ uint16_t svga_readw_linear(uint32_t addr, void *p)
cycles -= video_timing_w;
cycles_lost += video_timing_w;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return 0xffff;
if (addr >= svga->vram_limit) return 0xffff;
@ -1580,7 +1580,7 @@ uint32_t svga_readl_linear(uint32_t addr, void *p)
cycles -= video_timing_l;
cycles_lost += video_timing_l;
addr &= 0x7FFFFF;
addr %= svga->vram_limit;
if ((!svga->extvram) && (addr >= 0x10000)) return 0xffffffff;
if (addr >= svga->vram_limit) return 0xffffffff;