Applied all applicable PCem commit;
Fixed window resizing when mandated by the guest - should hopefully stabilize Direct3D.
This commit is contained in:
@@ -201,6 +201,21 @@ void x86_int(int num)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
addr = (num << 2) + idt.base;
|
||||||
|
|
||||||
|
if (addr + 3 > idt.limit)
|
||||||
|
{
|
||||||
|
if(idt.limit < 35)
|
||||||
|
{
|
||||||
|
cpu_state.abrt = 0;
|
||||||
|
softresetx86();
|
||||||
|
cpu_set_edx();
|
||||||
|
pclog("IDT limit is less than 35 in real mode - reset\n");
|
||||||
|
}
|
||||||
|
else x86_int(8);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (stack32)
|
if (stack32)
|
||||||
{
|
{
|
||||||
writememw(ss,ESP-2,flags);
|
writememw(ss,ESP-2,flags);
|
||||||
@@ -215,7 +230,6 @@ void x86_int(int num)
|
|||||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||||
SP-=6;
|
SP-=6;
|
||||||
}
|
}
|
||||||
addr = (num << 2) + idt.base;
|
|
||||||
|
|
||||||
flags&=~I_FLAG;
|
flags&=~I_FLAG;
|
||||||
flags&=~T_FLAG;
|
flags&=~T_FLAG;
|
||||||
@@ -238,6 +252,14 @@ void x86_int_sw(int num)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
addr = (num << 2) + idt.base;
|
||||||
|
|
||||||
|
if (addr + 3 > idt.limit)
|
||||||
|
{
|
||||||
|
x86_int(13);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (stack32)
|
if (stack32)
|
||||||
{
|
{
|
||||||
writememw(ss,ESP-2,flags);
|
writememw(ss,ESP-2,flags);
|
||||||
@@ -252,7 +274,6 @@ void x86_int_sw(int num)
|
|||||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||||
SP-=6;
|
SP-=6;
|
||||||
}
|
}
|
||||||
addr = (num << 2) + idt.base;
|
|
||||||
|
|
||||||
flags&=~I_FLAG;
|
flags&=~I_FLAG;
|
||||||
flags&=~T_FLAG;
|
flags&=~T_FLAG;
|
||||||
|
|||||||
@@ -587,7 +587,6 @@ void resetx86()
|
|||||||
use32=0;
|
use32=0;
|
||||||
cpu_cur_status = 0;
|
cpu_cur_status = 0;
|
||||||
stack32=0;
|
stack32=0;
|
||||||
cpu_state.pc=0;
|
|
||||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||||
msw=0;
|
msw=0;
|
||||||
if (is486)
|
if (is486)
|
||||||
@@ -599,9 +598,20 @@ void resetx86()
|
|||||||
cr4 = 0;
|
cr4 = 0;
|
||||||
eflags=0;
|
eflags=0;
|
||||||
cgate32=0;
|
cgate32=0;
|
||||||
loadcs(0xFFFF);
|
if(AT)
|
||||||
rammask = AT ? 0xFFFFFFFF : 0xfffff;
|
{
|
||||||
|
loadcs(cpu_16bitbus ? 0xFF000 : 0xFFFF000);
|
||||||
|
cpu_state.pc=0xFFF0;
|
||||||
|
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadcs(0xFFFF);
|
||||||
|
cpu_state.pc=0;
|
||||||
|
rammask = 0xfffff;
|
||||||
|
}
|
||||||
idt.base = 0;
|
idt.base = 0;
|
||||||
|
idt.limit = 0xFFFF;
|
||||||
flags=2;
|
flags=2;
|
||||||
makeznptable();
|
makeznptable();
|
||||||
resetreadlookup();
|
resetreadlookup();
|
||||||
@@ -628,16 +638,27 @@ void softresetx86()
|
|||||||
use32=0;
|
use32=0;
|
||||||
stack32=0;
|
stack32=0;
|
||||||
cpu_cur_status = 0;
|
cpu_cur_status = 0;
|
||||||
cpu_state.pc=0;
|
|
||||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||||
msw=0;
|
msw=0;
|
||||||
cr0=0;
|
cr0=0;
|
||||||
cr4 = 0;
|
cr4 = 0;
|
||||||
eflags=0;
|
eflags=0;
|
||||||
cgate32=0;
|
cgate32=0;
|
||||||
loadcs(0xFFFF);
|
if(AT)
|
||||||
|
{
|
||||||
|
loadcs(cpu_16bitbus ? 0xFF000 : 0xFFFF000);
|
||||||
|
cpu_state.pc=0xFFF0;
|
||||||
|
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadcs(0xFFFF);
|
||||||
|
cpu_state.pc=0;
|
||||||
|
rammask = 0xfffff;
|
||||||
|
}
|
||||||
flags=2;
|
flags=2;
|
||||||
idt.base = 0;
|
idt.base = 0;
|
||||||
|
idt.limit = 0xFFFF;
|
||||||
x86seg_reset();
|
x86seg_reset();
|
||||||
x86_was_reset = 1;
|
x86_was_reset = 1;
|
||||||
port_92_clear_reset();
|
port_92_clear_reset();
|
||||||
@@ -2537,9 +2558,17 @@ void execx86(int cycs)
|
|||||||
cycles-=((cpu_mod==3)?8:28);
|
cycles-=((cpu_mod==3)?8:28);
|
||||||
break;
|
break;
|
||||||
case 0x20: case 0x30: /*SHL b,CL*/
|
case 0x20: case 0x30: /*SHL b,CL*/
|
||||||
if ((temp<<(c-1))&0x80) flags|=C_FLAG;
|
if (c > 8)
|
||||||
else flags&=~C_FLAG;
|
{
|
||||||
temp<<=c;
|
temp = 0;
|
||||||
|
flags &= ~C_FLAG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((temp<<(c-1))&0x80) flags|=C_FLAG;
|
||||||
|
else flags&=~C_FLAG;
|
||||||
|
temp<<=c;
|
||||||
|
}
|
||||||
seteab(temp);
|
seteab(temp);
|
||||||
setznp8(temp);
|
setznp8(temp);
|
||||||
cycles-=(c*4);
|
cycles-=(c*4);
|
||||||
@@ -2547,9 +2576,17 @@ void execx86(int cycs)
|
|||||||
flags|=A_FLAG;
|
flags|=A_FLAG;
|
||||||
break;
|
break;
|
||||||
case 0x28: /*SHR b,CL*/
|
case 0x28: /*SHR b,CL*/
|
||||||
if ((temp>>(c-1))&1) flags|=C_FLAG;
|
if (c > 8)
|
||||||
else flags&=~C_FLAG;
|
{
|
||||||
temp>>=c;
|
temp = 0;
|
||||||
|
flags &= ~C_FLAG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((temp>>(c-1))&1) flags|=C_FLAG;
|
||||||
|
else flags&=~C_FLAG;
|
||||||
|
temp>>=c;
|
||||||
|
}
|
||||||
seteab(temp);
|
seteab(temp);
|
||||||
setznp8(temp);
|
setznp8(temp);
|
||||||
cycles-=(c*4);
|
cycles-=(c*4);
|
||||||
@@ -2680,9 +2717,17 @@ void execx86(int cycs)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x28: /*SHR w,CL*/
|
case 0x28: /*SHR w,CL*/
|
||||||
if ((tempw>>(c-1))&1) flags|=C_FLAG;
|
if (c > 16)
|
||||||
else flags&=~C_FLAG;
|
{
|
||||||
tempw>>=c;
|
tempw = 0;
|
||||||
|
flags &= ~C_FLAG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((tempw>>(c-1))&1) flags|=C_FLAG;
|
||||||
|
else flags&=~C_FLAG;
|
||||||
|
tempw>>=c;
|
||||||
|
}
|
||||||
seteaw(tempw);
|
seteaw(tempw);
|
||||||
setznp16(tempw);
|
setznp16(tempw);
|
||||||
cycles-=(c*4);
|
cycles-=(c*4);
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ static int opMOV_AL_a16(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint8_t temp;
|
uint8_t temp;
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr);
|
||||||
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
AL = temp;
|
AL = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -261,6 +262,7 @@ static int opMOV_AL_a32(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint8_t temp;
|
uint8_t temp;
|
||||||
uint32_t addr = getlong();
|
uint32_t addr = getlong();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr);
|
||||||
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
AL = temp;
|
AL = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -271,6 +273,7 @@ static int opMOV_AX_a16(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr + 1);
|
||||||
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
AX = temp;
|
AX = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -281,6 +284,7 @@ static int opMOV_AX_a32(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
uint32_t addr = getlong();
|
uint32_t addr = getlong();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr + 1);
|
||||||
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
AX = temp;
|
AX = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -291,6 +295,7 @@ static int opMOV_EAX_a16(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr + 3);
|
||||||
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
EAX = temp;
|
EAX = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -301,6 +306,7 @@ static int opMOV_EAX_a32(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
uint32_t addr = getlong();
|
uint32_t addr = getlong();
|
||||||
|
CHECK_READ(cpu_state.ea_seg, addr, addr + 3);
|
||||||
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||||
EAX = temp;
|
EAX = temp;
|
||||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||||
@@ -311,6 +317,7 @@ static int opMOV_EAX_a32(uint32_t fetchdat)
|
|||||||
static int opMOV_a16_AL(uint32_t fetchdat)
|
static int opMOV_a16_AL(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr);
|
||||||
writememb(cpu_state.ea_seg->base, addr, AL);
|
writememb(cpu_state.ea_seg->base, addr, AL);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
||||||
@@ -319,6 +326,7 @@ static int opMOV_a16_AL(uint32_t fetchdat)
|
|||||||
static int opMOV_a32_AL(uint32_t fetchdat)
|
static int opMOV_a32_AL(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t addr = getlong();
|
uint32_t addr = getlong();
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr);
|
||||||
writememb(cpu_state.ea_seg->base, addr, AL);
|
writememb(cpu_state.ea_seg->base, addr, AL);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
||||||
@@ -327,6 +335,7 @@ static int opMOV_a32_AL(uint32_t fetchdat)
|
|||||||
static int opMOV_a16_AX(uint32_t fetchdat)
|
static int opMOV_a16_AX(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 1);
|
||||||
writememw(cpu_state.ea_seg->base, addr, AX);
|
writememw(cpu_state.ea_seg->base, addr, AX);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
||||||
@@ -335,6 +344,7 @@ static int opMOV_a16_AX(uint32_t fetchdat)
|
|||||||
static int opMOV_a32_AX(uint32_t fetchdat)
|
static int opMOV_a32_AX(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 1);
|
||||||
writememw(cpu_state.ea_seg->base, addr, AX);
|
writememw(cpu_state.ea_seg->base, addr, AX);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
||||||
@@ -343,6 +353,7 @@ static int opMOV_a32_AX(uint32_t fetchdat)
|
|||||||
static int opMOV_a16_EAX(uint32_t fetchdat)
|
static int opMOV_a16_EAX(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t addr = getwordf();
|
uint16_t addr = getwordf();
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 3);
|
||||||
writememl(cpu_state.ea_seg->base, addr, EAX);
|
writememl(cpu_state.ea_seg->base, addr, EAX);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 3, -1, 0,0,0,1, 0);
|
PREFETCH_RUN(2, 3, -1, 0,0,0,1, 0);
|
||||||
@@ -351,6 +362,7 @@ static int opMOV_a16_EAX(uint32_t fetchdat)
|
|||||||
static int opMOV_a32_EAX(uint32_t fetchdat)
|
static int opMOV_a32_EAX(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
||||||
|
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 3);
|
||||||
writememl(cpu_state.ea_seg->base, addr, EAX);
|
writememl(cpu_state.ea_seg->base, addr, EAX);
|
||||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||||
PREFETCH_RUN(2, 5, -1, 0,0,0,1, 1);
|
PREFETCH_RUN(2, 5, -1, 0,0,0,1, 1);
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ void loadcs(uint16_t seg)
|
|||||||
_cs.limit=0xFFFF;
|
_cs.limit=0xFFFF;
|
||||||
_cs.limit_low = 0;
|
_cs.limit_low = 0;
|
||||||
_cs.limit_high = 0xffff;
|
_cs.limit_high = 0xffff;
|
||||||
CS=seg;
|
CS=seg & 0xFFFF;
|
||||||
if (eflags&VM_FLAG) _cs.access=(3<<5) | 2 | 0x80;
|
if (eflags&VM_FLAG) _cs.access=(3<<5) | 2 | 0x80;
|
||||||
else _cs.access=(0<<5) | 2 | 0x80;
|
else _cs.access=(0<<5) | 2 | 0x80;
|
||||||
if (CPL==3 && oldcpl!=3) flushmmucache_cr3();
|
if (CPL==3 && oldcpl!=3) flushmmucache_cr3();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include "../86box.h"
|
#include "../86box.h"
|
||||||
#include "../cpu/cpu.h"
|
#include "../cpu/cpu.h"
|
||||||
|
#include "../cpu/x86.h"
|
||||||
#include "../io.h"
|
#include "../io.h"
|
||||||
#include "../mem.h"
|
#include "../mem.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
@@ -18,8 +19,12 @@ static uint8_t headland_regs[256];
|
|||||||
|
|
||||||
static void headland_write(uint16_t addr, uint8_t val, void *priv)
|
static void headland_write(uint16_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
|
uint8_t old_val;
|
||||||
|
|
||||||
if (addr & 1)
|
if (addr & 1)
|
||||||
{
|
{
|
||||||
|
old_val = headland_regs[headland_index];
|
||||||
|
|
||||||
if (headland_index == 0xc1 && !is486) val = 0;
|
if (headland_index == 0xc1 && !is486) val = 0;
|
||||||
headland_regs[headland_index] = val;
|
headland_regs[headland_index] = val;
|
||||||
if (headland_index == 0x82)
|
if (headland_index == 0x82)
|
||||||
@@ -31,6 +36,11 @@ static void headland_write(uint16_t addr, uint8_t val, void *priv)
|
|||||||
else
|
else
|
||||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTERNAL | MEM_WRITE_INTERNAL);
|
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTERNAL | MEM_WRITE_INTERNAL);
|
||||||
}
|
}
|
||||||
|
else if (headland_index == 0x87)
|
||||||
|
{
|
||||||
|
if ((val & 1) && !(old_val & 1))
|
||||||
|
softresetx86();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
headland_index = val;
|
headland_index = val;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "../cpu/cpu.h"
|
#include "../cpu/cpu.h"
|
||||||
#include "../io.h"
|
#include "../io.h"
|
||||||
#include "../mem.h"
|
#include "../mem.h"
|
||||||
|
#include "../rom.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -20,8 +21,9 @@ static uint32_t get_laserxt_ems_addr(uint32_t addr)
|
|||||||
{
|
{
|
||||||
if(laserxt_emspage[(addr >> 14) & 3] & 0x80)
|
if(laserxt_emspage[(addr >> 14) & 3] & 0x80)
|
||||||
{
|
{
|
||||||
addr = 0xA0000 + ((laserxt_emspage[(addr >> 14) & 3] & 0x0F) << 14) + ((laserxt_emspage[(addr >> 14) & 3] & 0x40) << 12) + (addr & 0x3FFF);
|
addr = (romset == ROM_LTXT ? 0x70000 + (((mem_size + 64) & 255) << 10) : 0x30000 + (((mem_size + 320) & 511) << 10)) + ((laserxt_emspage[(addr >> 14) & 3] & 0x0F) << 14) + ((laserxt_emspage[(addr >> 14) & 3] & 0x40) << 12) + (addr & 0x3FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +117,7 @@ static void laserxt_init(void)
|
|||||||
io_sethandler(0x4208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
io_sethandler(0x4208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
||||||
io_sethandler(0x8208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
io_sethandler(0x8208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
||||||
io_sethandler(0xc208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
io_sethandler(0xc208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
|
||||||
|
mem_mapping_set_addr(&ram_low_mapping, 0, romset == ROM_LTXT ? 0x70000 + (((mem_size + 64) & 255) << 10) : 0x30000 + (((mem_size + 320) & 511) << 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ machine_t machines[] = {
|
|||||||
{ "[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 128, 640, 128, 0, machine_tandy1k_init, NULL },
|
{ "[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 128, 640, 128, 0, machine_tandy1k_init, NULL },
|
||||||
{ "[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 256, 640, 128, 0, machine_tandy1k_init, NULL },
|
{ "[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 256, 640, 128, 0, machine_tandy1k_init, NULL },
|
||||||
{ "[8088] VTech Laser Turbo XT", ROM_LTXT, "ltxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
|
{ "[8088] VTech Laser Turbo XT", ROM_LTXT, "ltxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
|
||||||
{ "[8088] VTech Laser XT3", ROM_LXT3, "lxt3", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
|
|
||||||
|
|
||||||
{ "[8086] Amstrad PC1512", ROM_PC1512, "pc1512", {{"", cpus_pc1512}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
|
{ "[8086] Amstrad PC1512", ROM_PC1512, "pc1512", {{"", cpus_pc1512}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
|
||||||
{ "[8086] Amstrad PC1640", ROM_PC1640, "pc1640", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_amstrad_init, NULL },
|
{ "[8086] Amstrad PC1640", ROM_PC1640, "pc1640", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_amstrad_init, NULL },
|
||||||
@@ -53,6 +52,7 @@ machine_t machines[] = {
|
|||||||
{ "[8086] Amstrad PC20(0)", ROM_PC200, "pc200", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
|
{ "[8086] Amstrad PC20(0)", ROM_PC200, "pc200", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
|
||||||
{ "[8086] Olivetti M24", ROM_OLIM24, "olivetti_m24", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, machine_olim24_init, NULL },
|
{ "[8086] Olivetti M24", ROM_OLIM24, "olivetti_m24", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, machine_olim24_init, NULL },
|
||||||
{ "[8086] Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 512, 768, 128, 0, machine_tandy1k_init, NULL },
|
{ "[8086] Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 512, 768, 128, 0, machine_tandy1k_init, NULL },
|
||||||
|
{ "[8086] VTech Laser XT3", ROM_LXT3, "lxt3", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 512, 1152, 128, 0, machine_xt_laserxt_init, NULL },
|
||||||
|
|
||||||
{ "[286 ISA] AMI 286 clone", ROM_AMI286, "ami286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_neat_init, NULL },
|
{ "[286 ISA] AMI 286 clone", ROM_AMI286, "ami286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_neat_init, NULL },
|
||||||
{ "[286 ISA] Award 286 clone", ROM_AWARD286, "award286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_scat_init, NULL },
|
{ "[286 ISA] Award 286 clone", ROM_AWARD286, "award286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_scat_init, NULL },
|
||||||
|
|||||||
38
src/mem.c
38
src/mem.c
@@ -1336,14 +1336,14 @@ void mem_add_bios()
|
|||||||
mem_mapping_add(&bios_mapping[6], 0xf8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x18000 & biosmask), MEM_MAPPING_EXTERNAL, 0);
|
mem_mapping_add(&bios_mapping[6], 0xf8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x18000 & biosmask), MEM_MAPPING_EXTERNAL, 0);
|
||||||
mem_mapping_add(&bios_mapping[7], 0xfc000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x1c000 & biosmask), MEM_MAPPING_EXTERNAL, 0);
|
mem_mapping_add(&bios_mapping[7], 0xfc000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x1c000 & biosmask), MEM_MAPPING_EXTERNAL, 0);
|
||||||
|
|
||||||
mem_mapping_add(&bios_high_mapping[0], 0xfffe0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom, 0, 0);
|
mem_mapping_add(&bios_high_mapping[0], (AT && cpu_16bitbus) ? 0xfe0000 : 0xfffe0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom, 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[1], 0xfffe4000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x4000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[1], (AT && cpu_16bitbus) ? 0xfe4000 : 0xfffe4000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x4000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[2], 0xfffe8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x8000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[2], (AT && cpu_16bitbus) ? 0xfe8000 : 0xfffe8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x8000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[3], 0xfffec000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0xc000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[3], (AT && cpu_16bitbus) ? 0xfec000 : 0xfffec000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0xc000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[4], 0xffff0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x10000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[4], (AT && cpu_16bitbus) ? 0xff0000 : 0xffff0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x10000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[5], 0xffff4000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x14000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[5], (AT && cpu_16bitbus) ? 0xff4000 : 0xffff4000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x14000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[6], 0xffff8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x18000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[6], (AT && cpu_16bitbus) ? 0xff8000 : 0xffff8000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x18000 & biosmask), 0, 0);
|
||||||
mem_mapping_add(&bios_high_mapping[7], 0xffffc000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x1c000 & biosmask), 0, 0);
|
mem_mapping_add(&bios_high_mapping[7], (AT && cpu_16bitbus) ? 0xffc000 : 0xffffc000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x1c000 & biosmask), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mem_a20_key = 0, mem_a20_alt = 0;
|
int mem_a20_key = 0, mem_a20_alt = 0;
|
||||||
@@ -1400,14 +1400,12 @@ void mem_init(void)
|
|||||||
|
|
||||||
mem_set_mem_state(0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
mem_set_mem_state(0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||||
mem_set_mem_state(0x0c0000, 0x40000, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL);
|
mem_set_mem_state(0x0c0000, 0x40000, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL);
|
||||||
if (mem_size > 1024)
|
|
||||||
{
|
|
||||||
mem_set_mem_state(0x100000, (mem_size - 1024) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem_mapping_add(&ram_low_mapping, 0x00000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram, MEM_MAPPING_INTERNAL, NULL);
|
mem_mapping_add(&ram_low_mapping, 0x00000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram, MEM_MAPPING_INTERNAL, NULL);
|
||||||
if (mem_size > 1024)
|
if (mem_size > 1024) {
|
||||||
|
mem_set_mem_state(0x100000, (mem_size - 1024) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||||
mem_mapping_add(&ram_high_mapping, 0x100000, ((mem_size - 1024) * 1024), mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0x100000, MEM_MAPPING_INTERNAL, NULL);
|
mem_mapping_add(&ram_high_mapping, 0x100000, ((mem_size - 1024) * 1024), mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0x100000, MEM_MAPPING_INTERNAL, NULL);
|
||||||
|
}
|
||||||
if (mem_size > 768)
|
if (mem_size > 768)
|
||||||
mem_mapping_add(&ram_mid_mapping, 0xc0000, 0x40000, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0xc0000, MEM_MAPPING_INTERNAL, NULL);
|
mem_mapping_add(&ram_mid_mapping, 0xc0000, 0x40000, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0xc0000, MEM_MAPPING_INTERNAL, NULL);
|
||||||
|
|
||||||
@@ -1496,14 +1494,12 @@ void mem_resize()
|
|||||||
|
|
||||||
mem_set_mem_state(0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
mem_set_mem_state(0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||||
mem_set_mem_state(0x0c0000, 0x40000, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL);
|
mem_set_mem_state(0x0c0000, 0x40000, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL);
|
||||||
if (mem_size > 1024)
|
|
||||||
{
|
|
||||||
mem_set_mem_state(0x100000, (mem_size - 1024) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem_mapping_add(&ram_low_mapping, 0x00000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram, MEM_MAPPING_INTERNAL, NULL);
|
mem_mapping_add(&ram_low_mapping, 0x00000, (mem_size > 640) ? 0xa0000 : mem_size * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram, MEM_MAPPING_INTERNAL, NULL);
|
||||||
if (mem_size > 1024)
|
if (mem_size > 1024) {
|
||||||
mem_mapping_add(&ram_high_mapping, 0x100000, (mem_size - 1024) * 1024, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0x100000, MEM_MAPPING_INTERNAL, NULL);
|
mem_set_mem_state(0x100000, (mem_size - 1024) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||||
|
mem_mapping_add(&ram_high_mapping, 0x100000, ((mem_size - 1024) * 1024), mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0x100000, MEM_MAPPING_INTERNAL, NULL);
|
||||||
|
}
|
||||||
if (mem_size > 768)
|
if (mem_size > 768)
|
||||||
mem_mapping_add(&ram_mid_mapping, 0xc0000, 0x40000, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0xc0000, MEM_MAPPING_INTERNAL, NULL);
|
mem_mapping_add(&ram_mid_mapping, 0xc0000, 0x40000, mem_read_ram, mem_read_ramw, mem_read_raml, mem_write_ram, mem_write_ramw, mem_write_raml, ram + 0xc0000, MEM_MAPPING_INTERNAL, NULL);
|
||||||
|
|
||||||
@@ -1537,12 +1533,12 @@ void mem_a20_recalc(void)
|
|||||||
int state = mem_a20_key | mem_a20_alt;
|
int state = mem_a20_key | mem_a20_alt;
|
||||||
if (state && !mem_a20_state)
|
if (state && !mem_a20_state)
|
||||||
{
|
{
|
||||||
rammask = 0xffffffff;
|
rammask = (AT && cpu_16bitbus) ? 0xffffff : 0xffffffff;
|
||||||
flushmmucache();
|
flushmmucache();
|
||||||
}
|
}
|
||||||
else if (!state && mem_a20_state)
|
else if (!state && mem_a20_state)
|
||||||
{
|
{
|
||||||
rammask = 0xffefffff;
|
rammask = (AT && cpu_16bitbus) ? 0xefffff : 0xffefffff;
|
||||||
flushmmucache();
|
flushmmucache();
|
||||||
}
|
}
|
||||||
mem_a20_state = state;
|
mem_a20_state = state;
|
||||||
|
|||||||
@@ -399,7 +399,6 @@ void pit_write(uint16_t addr, uint8_t val, void *p)
|
|||||||
pit->rl[t] = pit_read_timer(pit, t);
|
pit->rl[t] = pit_read_timer(pit, t);
|
||||||
}
|
}
|
||||||
pit->rereadlatch[t]=1;
|
pit->rereadlatch[t]=1;
|
||||||
if (t == 2) ppispeakon=speakon=(pit->m[2]==0)?0:1;
|
|
||||||
pit->initial[t] = 1;
|
pit->initial[t] = 1;
|
||||||
if (!pit->m[t])
|
if (!pit->m[t])
|
||||||
pit_set_out(pit, t, 0);
|
pit_set_out(pit, t, 0);
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ extern int plat_vidapi(char *name);
|
|||||||
extern char *plat_vidapi_name(int api);
|
extern char *plat_vidapi_name(int api);
|
||||||
extern int plat_setvid(int api);
|
extern int plat_setvid(int api);
|
||||||
extern void plat_setfullscreen(int on);
|
extern void plat_setfullscreen(int on);
|
||||||
|
extern void plat_vid_api_resize(int x, int y);
|
||||||
extern void plat_resize(int max_x, int max_y);
|
extern void plat_resize(int max_x, int max_y);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ void sdac_ramdac_out(uint16_t addr, uint8_t val, sdac_ramdac_t *ramdac, svga_t *
|
|||||||
ramdac->magic_count = 0;
|
ramdac->magic_count = 0;
|
||||||
if (ramdac->rs2)
|
if (ramdac->rs2)
|
||||||
{
|
{
|
||||||
if (!ramdac->reg_ff) ramdac->regs[ramdac->windex] = (ramdac->regs[ramdac->windex] & 0xff00) | val;
|
if (!ramdac->reg_ff) ramdac->regs[ramdac->windex & 0xff] = (ramdac->regs[ramdac->windex & 0xff] & 0xff00) | val;
|
||||||
else ramdac->regs[ramdac->windex] = (ramdac->regs[ramdac->windex] & 0x00ff) | (val << 8);
|
else ramdac->regs[ramdac->windex & 0xff] = (ramdac->regs[ramdac->windex & 0xff] & 0x00ff) | (val << 8);
|
||||||
ramdac->reg_ff = !ramdac->reg_ff;
|
ramdac->reg_ff = !ramdac->reg_ff;
|
||||||
if (!ramdac->reg_ff) ramdac->windex++;
|
if (!ramdac->reg_ff) ramdac->windex++;
|
||||||
}
|
}
|
||||||
@@ -128,8 +128,8 @@ uint8_t sdac_ramdac_in(uint16_t addr, sdac_ramdac_t *ramdac, svga_t *svga)
|
|||||||
ramdac->magic_count=0;
|
ramdac->magic_count=0;
|
||||||
if (ramdac->rs2)
|
if (ramdac->rs2)
|
||||||
{
|
{
|
||||||
if (!ramdac->reg_ff) temp = ramdac->regs[ramdac->rindex] & 0xff;
|
if (!ramdac->reg_ff) temp = ramdac->regs[ramdac->rindex & 0xff] & 0xff;
|
||||||
else temp = ramdac->regs[ramdac->rindex] >> 8;
|
else temp = ramdac->regs[ramdac->rindex & 0xff] >> 8;
|
||||||
ramdac->reg_ff = !ramdac->reg_ff;
|
ramdac->reg_ff = !ramdac->reg_ff;
|
||||||
if (!ramdac->reg_ff)
|
if (!ramdac->reg_ff)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -262,21 +262,7 @@ void svga_out(uint16_t addr, uint8_t val, void *p)
|
|||||||
if (svga->ramdac_type == RAMDAC_8BIT)
|
if (svga->ramdac_type == RAMDAC_8BIT)
|
||||||
svga->pallook[svga->dac_write] = makecol32(svga->vgapal[svga->dac_write].r, svga->vgapal[svga->dac_write].g, svga->vgapal[svga->dac_write].b);
|
svga->pallook[svga->dac_write] = makecol32(svga->vgapal[svga->dac_write].r, svga->vgapal[svga->dac_write].g, svga->vgapal[svga->dac_write].b);
|
||||||
else
|
else
|
||||||
{
|
svga->pallook[svga->dac_write] = makecol32(video_6to8[svga->vgapal[svga->dac_write].r & 0x3f], video_6to8[svga->vgapal[svga->dac_write].g & 0x3f], video_6to8[svga->vgapal[svga->dac_write].b & 0x3f]);
|
||||||
svga->vgapal[svga->dac_write].r &= 0x3f;
|
|
||||||
svga->vgapal[svga->dac_write].g &= 0x3f;
|
|
||||||
svga->vgapal[svga->dac_write].b &= 0x3f;
|
|
||||||
|
|
||||||
// if ((romset == ROM_IBMPS1_2011) || (romset == ROM_IBMPS1_2121) || (romset == ROM_IBMPS2_M30_286))
|
|
||||||
if (romset == ROM_IBMPS1_2011)
|
|
||||||
{
|
|
||||||
svga->pallook[svga->dac_write] = makecol32((svga->vgapal[svga->dac_write].r & 0x3f) * 4, (svga->vgapal[svga->dac_write].g & 0x3f) * 4, (svga->vgapal[svga->dac_write].b & 0x3f) * 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
svga->pallook[svga->dac_write] = makecol32(video_6to8[svga->vgapal[svga->dac_write].r], video_6to8[svga->vgapal[svga->dac_write].g], video_6to8[svga->vgapal[svga->dac_write].b]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if 1
|
#if 1
|
||||||
// FIXME: temp to see if this fixes 2401 on PS/1.
|
// FIXME: temp to see if this fixes 2401 on PS/1.
|
||||||
svga->sense = (svga->vgapal[svga->dac_write].r & svga->vgapal[svga->dac_write].g & svga->vgapal[svga->dac_write].b) & 0x10;
|
svga->sense = (svga->vgapal[svga->dac_write].r & svga->vgapal[svga->dac_write].g & svga->vgapal[svga->dac_write].b) & 0x10;
|
||||||
@@ -477,14 +463,23 @@ pclog("SVGAread = %02x\n", temp);
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
svga->dac_pos++;
|
svga->dac_pos++;
|
||||||
return svga->vgapal[svga->dac_read].r;
|
if (svga->ramdac_type == RAMDAC_8BIT)
|
||||||
|
return svga->vgapal[svga->dac_read].r;
|
||||||
|
else
|
||||||
|
return svga->vgapal[svga->dac_read].r & 0x3f;
|
||||||
case 1:
|
case 1:
|
||||||
svga->dac_pos++;
|
svga->dac_pos++;
|
||||||
return svga->vgapal[svga->dac_read].g;
|
if (svga->ramdac_type == RAMDAC_8BIT)
|
||||||
|
return svga->vgapal[svga->dac_read].g;
|
||||||
|
else
|
||||||
|
return svga->vgapal[svga->dac_read].g & 0x3f;
|
||||||
case 2:
|
case 2:
|
||||||
svga->dac_pos=0;
|
svga->dac_pos=0;
|
||||||
svga->dac_read = (svga->dac_read + 1) & 255;
|
svga->dac_read = (svga->dac_read + 1) & 255;
|
||||||
return svga->vgapal[(svga->dac_read - 1) & 255].b;
|
if (svga->ramdac_type == RAMDAC_8BIT)
|
||||||
|
return svga->vgapal[(svga->dac_read - 1) & 255].b;
|
||||||
|
else
|
||||||
|
return svga->vgapal[(svga->dac_read - 1) & 255].b& 0x3f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x3CC:
|
case 0x3CC:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of the 3DFX Voodoo Graphics controller.
|
* Emulation of the 3DFX Voodoo Graphics controller.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_voodoo.c 1.0.8 2017/11/04
|
* Version: @(#)vid_voodoo.c 1.0.9 2017/11/11
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* leilei
|
* leilei
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../mem.h"
|
#include "../mem.h"
|
||||||
#include "../pci.h"
|
#include "../pci.h"
|
||||||
|
#include "../rom.h"
|
||||||
#include "../timer.h"
|
#include "../timer.h"
|
||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../plat.h"
|
#include "../plat.h"
|
||||||
@@ -36,7 +37,6 @@
|
|||||||
#include "vid_voodoo.h"
|
#include "vid_voodoo.h"
|
||||||
#include "vid_voodoo_dither.h"
|
#include "vid_voodoo_dither.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef MIN
|
#ifdef MIN
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#endif
|
#endif
|
||||||
@@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
#define TEX_CACHE_MAX 64
|
#define TEX_CACHE_MAX 64
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
VOODOO_1 = 0,
|
VOODOO_1 = 0,
|
||||||
@@ -66,7 +65,6 @@ enum
|
|||||||
VOODOO_2 = 2
|
VOODOO_2 = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static uint32_t texture_offset[LOD_MAX+3] =
|
static uint32_t texture_offset[LOD_MAX+3] =
|
||||||
{
|
{
|
||||||
0,
|
0,
|
||||||
@@ -196,6 +194,7 @@ typedef struct voodoo_params_t
|
|||||||
uint32_t texBaseAddr[2], texBaseAddr1[2], texBaseAddr2[2], texBaseAddr38[2];
|
uint32_t texBaseAddr[2], texBaseAddr1[2], texBaseAddr2[2], texBaseAddr38[2];
|
||||||
|
|
||||||
uint32_t tex_base[2][LOD_MAX+2];
|
uint32_t tex_base[2][LOD_MAX+2];
|
||||||
|
uint32_t tex_end[2][LOD_MAX+2];
|
||||||
int tex_width[2];
|
int tex_width[2];
|
||||||
int tex_w_mask[2][LOD_MAX+2];
|
int tex_w_mask[2][LOD_MAX+2];
|
||||||
int tex_w_nmask[2][LOD_MAX+2];
|
int tex_w_nmask[2][LOD_MAX+2];
|
||||||
@@ -227,7 +226,7 @@ typedef struct texture_t
|
|||||||
volatile int refcount, refcount_r[2];
|
volatile int refcount, refcount_r[2];
|
||||||
int is16;
|
int is16;
|
||||||
uint32_t palette_checksum;
|
uint32_t palette_checksum;
|
||||||
uint32_t addr_start, addr_end;
|
uint32_t addr_start[4], addr_end[4];
|
||||||
uint32_t *data;
|
uint32_t *data;
|
||||||
} texture_t;
|
} texture_t;
|
||||||
|
|
||||||
@@ -243,7 +242,7 @@ typedef struct voodoo_t
|
|||||||
uint16_t dac_pll_regs[16];
|
uint16_t dac_pll_regs[16];
|
||||||
|
|
||||||
float pixel_clock;
|
float pixel_clock;
|
||||||
int64_t line_time;
|
int line_time;
|
||||||
|
|
||||||
voodoo_params_t params;
|
voodoo_params_t params;
|
||||||
|
|
||||||
@@ -286,7 +285,7 @@ typedef struct voodoo_t
|
|||||||
uint32_t videoDimensions;
|
uint32_t videoDimensions;
|
||||||
uint32_t hSync, vSync;
|
uint32_t hSync, vSync;
|
||||||
|
|
||||||
int64_t h_total, v_total, v_disp;
|
int h_total, v_total, v_disp;
|
||||||
int h_disp;
|
int h_disp;
|
||||||
int v_retrace;
|
int v_retrace;
|
||||||
|
|
||||||
@@ -1021,11 +1020,12 @@ enum
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
LOD_ODD = (1 << 18),
|
LOD_ODD = (1 << 18),
|
||||||
LOD_SPLIT = (1 << 19),
|
LOD_SPLIT = (1 << 19),
|
||||||
LOD_S_IS_WIDER = (1 << 20),
|
LOD_S_IS_WIDER = (1 << 20),
|
||||||
LOD_TMIRROR_S = (1 << 28),
|
LOD_TMULTIBASEADDR = (1 << 24),
|
||||||
LOD_TMIRROR_T = (1 << 29)
|
LOD_TMIRROR_S = (1 << 28),
|
||||||
|
LOD_TMIRROR_T = (1 << 29)
|
||||||
};
|
};
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -1184,6 +1184,7 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
int shift = 8;
|
int shift = 8;
|
||||||
int lod;
|
int lod;
|
||||||
uint32_t base = voodoo->params.texBaseAddr[tmu];
|
uint32_t base = voodoo->params.texBaseAddr[tmu];
|
||||||
|
uint32_t offset = 0;
|
||||||
int tex_lod = 0;
|
int tex_lod = 0;
|
||||||
|
|
||||||
if (voodoo->params.tLOD[tmu] & LOD_S_IS_WIDER)
|
if (voodoo->params.tLOD[tmu] & LOD_S_IS_WIDER)
|
||||||
@@ -1200,6 +1201,8 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
height >>= 1;
|
height >>= 1;
|
||||||
shift--;
|
shift--;
|
||||||
tex_lod++;
|
tex_lod++;
|
||||||
|
if (voodoo->params.tLOD[tmu] & LOD_TMULTIBASEADDR)
|
||||||
|
base = voodoo->params.texBaseAddr1[tmu];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lod = 0; lod <= LOD_MAX+1; lod++)
|
for (lod = 0; lod <= LOD_MAX+1; lod++)
|
||||||
@@ -1210,7 +1213,11 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
height = 1;
|
height = 1;
|
||||||
if (shift < 0)
|
if (shift < 0)
|
||||||
shift = 0;
|
shift = 0;
|
||||||
voodoo->params.tex_base[tmu][lod] = base;
|
voodoo->params.tex_base[tmu][lod] = base + offset;
|
||||||
|
if (voodoo->params.tformat[tmu] & 8)
|
||||||
|
voodoo->params.tex_end[tmu][lod] = base + offset + (width * height * 2);
|
||||||
|
else
|
||||||
|
voodoo->params.tex_end[tmu][lod] = base + offset + (width * height);
|
||||||
voodoo->params.tex_w_mask[tmu][lod] = width - 1;
|
voodoo->params.tex_w_mask[tmu][lod] = width - 1;
|
||||||
voodoo->params.tex_w_nmask[tmu][lod] = ~(width - 1);
|
voodoo->params.tex_w_nmask[tmu][lod] = ~(width - 1);
|
||||||
voodoo->params.tex_h_mask[tmu][lod] = height - 1;
|
voodoo->params.tex_h_mask[tmu][lod] = height - 1;
|
||||||
@@ -1222,9 +1229,9 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
if (!(voodoo->params.tLOD[tmu] & LOD_ODD) || lod != 0)
|
if (!(voodoo->params.tLOD[tmu] & LOD_ODD) || lod != 0)
|
||||||
{
|
{
|
||||||
if (voodoo->params.tformat[tmu] & 8)
|
if (voodoo->params.tformat[tmu] & 8)
|
||||||
base += width * height * 2;
|
offset += width * height * 2;
|
||||||
else
|
else
|
||||||
base += width * height;
|
offset += width * height;
|
||||||
|
|
||||||
if (voodoo->params.tLOD[tmu] & LOD_SPLIT)
|
if (voodoo->params.tLOD[tmu] & LOD_SPLIT)
|
||||||
{
|
{
|
||||||
@@ -1240,6 +1247,25 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
shift--;
|
shift--;
|
||||||
tex_lod++;
|
tex_lod++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (voodoo->params.tLOD[tmu] & LOD_TMULTIBASEADDR)
|
||||||
|
{
|
||||||
|
switch (tex_lod)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
base = voodoo->params.texBaseAddr[tmu];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
base = voodoo->params.texBaseAddr1[tmu];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
base = voodoo->params.texBaseAddr2[tmu];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
base = voodoo->params.texBaseAddr38[tmu];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1277,7 @@ static void voodoo_recalc_tex(voodoo_t *voodoo, int tmu)
|
|||||||
|
|
||||||
static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu)
|
static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu)
|
||||||
{
|
{
|
||||||
int c;
|
int c, d;
|
||||||
int lod;
|
int lod;
|
||||||
int lod_min, lod_max;
|
int lod_min, lod_max;
|
||||||
uint32_t addr = 0, addr_end;
|
uint32_t addr = 0, addr_end;
|
||||||
@@ -1278,10 +1304,15 @@ static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu)
|
|||||||
else
|
else
|
||||||
palette_checksum = 0;
|
palette_checksum = 0;
|
||||||
|
|
||||||
|
if ((voodoo->params.tLOD[tmu] & LOD_SPLIT) && (voodoo->params.tLOD[tmu] & LOD_ODD) && (voodoo->params.tLOD[tmu] & LOD_TMULTIBASEADDR))
|
||||||
|
addr = params->texBaseAddr1[tmu];
|
||||||
|
else
|
||||||
|
addr = params->texBaseAddr[tmu];
|
||||||
|
|
||||||
/*Try to find texture in cache*/
|
/*Try to find texture in cache*/
|
||||||
for (c = 0; c < TEX_CACHE_MAX; c++)
|
for (c = 0; c < TEX_CACHE_MAX; c++)
|
||||||
{
|
{
|
||||||
if (voodoo->texture_cache[tmu][c].base == params->texBaseAddr[tmu] &&
|
if (voodoo->texture_cache[tmu][c].base == addr &&
|
||||||
voodoo->texture_cache[tmu][c].tLOD == (params->tLOD[tmu] & 0xf00fff) &&
|
voodoo->texture_cache[tmu][c].tLOD == (params->tLOD[tmu] & 0xf00fff) &&
|
||||||
voodoo->texture_cache[tmu][c].palette_checksum == palette_checksum)
|
voodoo->texture_cache[tmu][c].palette_checksum == palette_checksum)
|
||||||
{
|
{
|
||||||
@@ -1310,12 +1341,16 @@ static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu)
|
|||||||
|
|
||||||
c = voodoo->texture_last_removed;
|
c = voodoo->texture_last_removed;
|
||||||
|
|
||||||
voodoo->texture_cache[tmu][c].base = params->texBaseAddr[tmu];
|
|
||||||
|
if ((voodoo->params.tLOD[tmu] & LOD_SPLIT) && (voodoo->params.tLOD[tmu] & LOD_ODD) && (voodoo->params.tLOD[tmu] & LOD_TMULTIBASEADDR))
|
||||||
|
voodoo->texture_cache[tmu][c].base = params->texBaseAddr1[tmu];
|
||||||
|
else
|
||||||
|
voodoo->texture_cache[tmu][c].base = params->texBaseAddr[tmu];
|
||||||
voodoo->texture_cache[tmu][c].tLOD = params->tLOD[tmu] & 0xf00fff;
|
voodoo->texture_cache[tmu][c].tLOD = params->tLOD[tmu] & 0xf00fff;
|
||||||
|
|
||||||
lod_min = (params->tLOD[tmu] >> 2) & 15;
|
lod_min = (params->tLOD[tmu] >> 2) & 15;
|
||||||
lod_max = (params->tLOD[tmu] >> 8) & 15;
|
lod_max = (params->tLOD[tmu] >> 8) & 15;
|
||||||
// pclog(" add new texture to %i tformat=%i %08x LOD=%i-%i\n", c, voodoo->params.tformat[tmu], params->texBaseAddr[tmu], lod_min, lod_max);
|
// pclog(" add new texture to %i tformat=%i %08x LOD=%i-%i tmu=%i\n", c, voodoo->params.tformat[tmu], params->texBaseAddr[tmu], lod_min, lod_max, tmu);
|
||||||
|
|
||||||
for (lod = lod_min; lod <= lod_max; lod++)
|
for (lod = lod_min; lod <= lod_max; lod++)
|
||||||
{
|
{
|
||||||
@@ -1547,13 +1582,51 @@ static void use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu)
|
|||||||
voodoo->texture_cache[tmu][c].palette_checksum = palette_checksum;
|
voodoo->texture_cache[tmu][c].palette_checksum = palette_checksum;
|
||||||
else
|
else
|
||||||
voodoo->texture_cache[tmu][c].palette_checksum = 0;
|
voodoo->texture_cache[tmu][c].palette_checksum = 0;
|
||||||
|
|
||||||
addr = voodoo->params.tex_base[tmu][lod_min];
|
if (lod_min == 0)
|
||||||
addr_end = voodoo->params.tex_base[tmu][lod_max+1];
|
{
|
||||||
voodoo->texture_cache[tmu][c].addr_start = addr;
|
voodoo->texture_cache[tmu][c].addr_start[0] = voodoo->params.tex_base[tmu][0];
|
||||||
voodoo->texture_cache[tmu][c].addr_end = addr_end;
|
voodoo->texture_cache[tmu][c].addr_end[0] = voodoo->params.tex_end[tmu][0];
|
||||||
for (; addr <= addr_end; addr += (1 << TEX_DIRTY_SHIFT))
|
}
|
||||||
voodoo->texture_present[tmu][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT] = 1;
|
else
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[0] = voodoo->texture_cache[tmu][c].addr_end[0] = 0;
|
||||||
|
|
||||||
|
if (lod_min <= 1 && lod_max >= 1)
|
||||||
|
{
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[1] = voodoo->params.tex_base[tmu][1];
|
||||||
|
voodoo->texture_cache[tmu][c].addr_end[1] = voodoo->params.tex_end[tmu][1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[1] = voodoo->texture_cache[tmu][c].addr_end[1] = 0;
|
||||||
|
|
||||||
|
if (lod_min <= 2 && lod_max >= 2)
|
||||||
|
{
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[2] = voodoo->params.tex_base[tmu][2];
|
||||||
|
voodoo->texture_cache[tmu][c].addr_end[2] = voodoo->params.tex_end[tmu][2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[2] = voodoo->texture_cache[tmu][c].addr_end[2] = 0;
|
||||||
|
|
||||||
|
if (lod_max >= 3)
|
||||||
|
{
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[3] = voodoo->params.tex_base[tmu][(lod_min > 3) ? lod_min : 3];
|
||||||
|
voodoo->texture_cache[tmu][c].addr_end[3] = voodoo->params.tex_end[tmu][(lod_max < 8) ? lod_max : 8];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
voodoo->texture_cache[tmu][c].addr_start[3] = voodoo->texture_cache[tmu][c].addr_end[3] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
for (d = 0; d < 4; d++)
|
||||||
|
{
|
||||||
|
addr = voodoo->texture_cache[tmu][c].addr_start[d];
|
||||||
|
addr_end = voodoo->texture_cache[tmu][c].addr_end[d];
|
||||||
|
|
||||||
|
if (addr_end != 0)
|
||||||
|
{
|
||||||
|
for (; addr <= addr_end; addr += (1 << TEX_DIRTY_SHIFT))
|
||||||
|
voodoo->texture_present[tmu][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
params->tex_entry[tmu] = c;
|
params->tex_entry[tmu] = c;
|
||||||
voodoo->texture_cache[tmu][c].refcount++;
|
voodoo->texture_cache[tmu][c].refcount++;
|
||||||
@@ -1570,23 +1643,31 @@ static void flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu)
|
|||||||
{
|
{
|
||||||
if (voodoo->texture_cache[tmu][c].base != -1)
|
if (voodoo->texture_cache[tmu][c].base != -1)
|
||||||
{
|
{
|
||||||
int addr_start = voodoo->texture_cache[tmu][c].addr_start;
|
int d;
|
||||||
int addr_end = voodoo->texture_cache[tmu][c].addr_end;
|
|
||||||
|
for (d = 0; d < 4; d++)
|
||||||
if (dirty_addr >= (addr_start & voodoo->texture_mask & ~0x3ff) && dirty_addr < (((addr_end & voodoo->texture_mask) + 0x3ff) & ~0x3ff))
|
|
||||||
{
|
{
|
||||||
|
int addr_start = voodoo->texture_cache[tmu][c].addr_start[d];
|
||||||
|
int addr_end = voodoo->texture_cache[tmu][c].addr_end[d];
|
||||||
|
|
||||||
|
if (addr_end != 0)
|
||||||
|
{
|
||||||
|
if (dirty_addr >= (addr_start & voodoo->texture_mask & ~0x3ff) && dirty_addr < (((addr_end & voodoo->texture_mask) + 0x3ff) & ~0x3ff))
|
||||||
|
{
|
||||||
// pclog(" Evict texture %i %08x\n", c, voodoo->texture_cache[tmu][c].base);
|
// pclog(" Evict texture %i %08x\n", c, voodoo->texture_cache[tmu][c].base);
|
||||||
|
|
||||||
if (voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[0] ||
|
if (voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[0] ||
|
||||||
(voodoo->render_threads == 2 && voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[1]))
|
(voodoo->render_threads == 2 && voodoo->texture_cache[tmu][c].refcount != voodoo->texture_cache[tmu][c].refcount_r[1]))
|
||||||
wait_for_idle = 1;
|
wait_for_idle = 1;
|
||||||
|
|
||||||
voodoo->texture_cache[tmu][c].base = -1;
|
voodoo->texture_cache[tmu][c].base = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (; addr_start <= addr_end; addr_start += (1 << TEX_DIRTY_SHIFT))
|
for (; addr_start <= addr_end; addr_start += (1 << TEX_DIRTY_SHIFT))
|
||||||
voodoo->texture_present[tmu][(addr_start & voodoo->texture_mask) >> TEX_DIRTY_SHIFT] = 1;
|
voodoo->texture_present[tmu][(addr_start & voodoo->texture_mask) >> TEX_DIRTY_SHIFT] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2600,9 +2681,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
|
|||||||
int dither = params->fbzMode & FBZ_DITHER;*/
|
int dither = params->fbzMode & FBZ_DITHER;*/
|
||||||
int texels;
|
int texels;
|
||||||
int c;
|
int c;
|
||||||
#ifndef NO_CODEGEN
|
|
||||||
uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y);
|
uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y);
|
||||||
#endif
|
|
||||||
int y_diff = SLI_ENABLED ? 2 : 1;
|
int y_diff = SLI_ENABLED ? 2 : 1;
|
||||||
|
|
||||||
if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH ||
|
if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH ||
|
||||||
@@ -2693,7 +2772,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
|
|||||||
state->xend += state->dx2;
|
state->xend += state->dx2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_CODEGEN
|
#ifndef NO_CODEGEN
|
||||||
if (voodoo->use_recompiler)
|
if (voodoo->use_recompiler)
|
||||||
voodoo_draw = voodoo_get_block(voodoo, params, state, odd_even);
|
voodoo_draw = voodoo_get_block(voodoo, params, state, odd_even);
|
||||||
@@ -2854,7 +2932,6 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
|
|||||||
state->texel_count = 0;
|
state->texel_count = 0;
|
||||||
state->x = x;
|
state->x = x;
|
||||||
state->x2 = x2;
|
state->x2 = x2;
|
||||||
|
|
||||||
#ifndef NO_CODEGEN
|
#ifndef NO_CODEGEN
|
||||||
if (voodoo->use_recompiler)
|
if (voodoo->use_recompiler)
|
||||||
{
|
{
|
||||||
@@ -2875,7 +2952,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
|
|||||||
// if (voodoo->fbzMode & FBZ_RGB_WMASK)
|
// if (voodoo->fbzMode & FBZ_RGB_WMASK)
|
||||||
{
|
{
|
||||||
int update = 1;
|
int update = 1;
|
||||||
uint8_t cother_r = 0, cother_g = 0, cother_b = 0, aother;
|
uint8_t cother_r, cother_g, cother_b, aother;
|
||||||
uint8_t clocal_r, clocal_g, clocal_b, alocal;
|
uint8_t clocal_r, clocal_g, clocal_b, alocal;
|
||||||
int src_r = 0, src_g = 0, src_b = 0, src_a = 0;
|
int src_r = 0, src_g = 0, src_b = 0, src_a = 0;
|
||||||
int msel_r, msel_g, msel_b, msel_a;
|
int msel_r, msel_g, msel_b, msel_a;
|
||||||
@@ -3324,7 +3401,6 @@ static void voodoo_triangle(voodoo_t *voodoo, voodoo_params_t *params, int odd_e
|
|||||||
int lodbias;
|
int lodbias;
|
||||||
|
|
||||||
voodoo->tri_count++;
|
voodoo->tri_count++;
|
||||||
memset(&state, 0x00, sizeof(state));
|
|
||||||
|
|
||||||
dx = 8 - (params->vertexAx & 0xf);
|
dx = 8 - (params->vertexAx & 0xf);
|
||||||
if ((params->vertexAx & 0xf) > 8)
|
if ((params->vertexAx & 0xf) > 8)
|
||||||
@@ -5575,11 +5651,7 @@ static void voodoo_fb_writew(uint32_t addr, uint16_t val, void *p)
|
|||||||
*(uint16_t *)(&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]) = new_depth;
|
*(uint16_t *)(&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]) = new_depth;
|
||||||
|
|
||||||
skip_pixel:
|
skip_pixel:
|
||||||
#if 1
|
|
||||||
x = 0;
|
|
||||||
#else
|
|
||||||
x = x;
|
x = x;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5795,7 +5867,7 @@ static void voodoo_tex_writel(uint32_t addr, uint32_t val, void *p)
|
|||||||
*(uint32_t *)(&voodoo->tex_mem[tmu][addr & voodoo->texture_mask]) = val;
|
*(uint32_t *)(&voodoo->tex_mem[tmu][addr & voodoo->texture_mask]) = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WAKE_DELAY (TIMER_USEC * 100LL)
|
#define WAKE_DELAY (TIMER_USEC * 100)
|
||||||
static inline void wake_fifo_thread(voodoo_t *voodoo)
|
static inline void wake_fifo_thread(voodoo_t *voodoo)
|
||||||
{
|
{
|
||||||
if (!voodoo->wake_timer)
|
if (!voodoo->wake_timer)
|
||||||
@@ -5819,7 +5891,7 @@ static void voodoo_wake_timer(void *p)
|
|||||||
{
|
{
|
||||||
voodoo_t *voodoo = (voodoo_t *)p;
|
voodoo_t *voodoo = (voodoo_t *)p;
|
||||||
|
|
||||||
voodoo->wake_timer = 0LL;
|
voodoo->wake_timer = 0;
|
||||||
|
|
||||||
thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/
|
thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/
|
||||||
}
|
}
|
||||||
@@ -5906,7 +5978,7 @@ static void wake_fifo_threads(voodoo_set_t *set, voodoo_t *voodoo)
|
|||||||
static uint32_t voodoo_readl(uint32_t addr, void *p)
|
static uint32_t voodoo_readl(uint32_t addr, void *p)
|
||||||
{
|
{
|
||||||
voodoo_t *voodoo = (voodoo_t *)p;
|
voodoo_t *voodoo = (voodoo_t *)p;
|
||||||
uint32_t temp = 0;
|
uint32_t temp;
|
||||||
int fifo_size;
|
int fifo_size;
|
||||||
voodoo->rd_count++;
|
voodoo->rd_count++;
|
||||||
addr &= 0xffffff;
|
addr &= 0xffffff;
|
||||||
@@ -6130,7 +6202,7 @@ static void voodoo_pixelclock_update(voodoo_t *voodoo)
|
|||||||
int n2 = ((voodoo->dac_pll_regs[0] >> 13) & 0x07);
|
int n2 = ((voodoo->dac_pll_regs[0] >> 13) & 0x07);
|
||||||
float t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2);
|
float t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2);
|
||||||
double clock_const;
|
double clock_const;
|
||||||
int64_t line_length;
|
int line_length;
|
||||||
|
|
||||||
if ((voodoo->dac_data[6] & 0xf0) == 0x20 ||
|
if ((voodoo->dac_data[6] & 0xf0) == 0x20 ||
|
||||||
(voodoo->dac_data[6] & 0xf0) == 0x60 ||
|
(voodoo->dac_data[6] & 0xf0) == 0x60 ||
|
||||||
@@ -6144,7 +6216,7 @@ static void voodoo_pixelclock_update(voodoo_t *voodoo)
|
|||||||
voodoo->pixel_clock = t;
|
voodoo->pixel_clock = t;
|
||||||
|
|
||||||
clock_const = cpuclock / t;
|
clock_const = cpuclock / t;
|
||||||
voodoo->line_time = (int64_t)((double)line_length * clock_const * (double)(1 << TIMER_SHIFT));
|
voodoo->line_time = (int)((double)line_length * clock_const * (double)(1 << TIMER_SHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void voodoo_writel(uint32_t addr, uint32_t val, void *p)
|
static void voodoo_writel(uint32_t addr, uint32_t val, void *p)
|
||||||
@@ -7232,7 +7304,7 @@ static void voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uin
|
|||||||
void voodoo_callback(void *p)
|
void voodoo_callback(void *p)
|
||||||
{
|
{
|
||||||
voodoo_t *voodoo = (voodoo_t *)p;
|
voodoo_t *voodoo = (voodoo_t *)p;
|
||||||
int y_add = (enable_overscan && !suppress_overscan) ? 16 : 0;
|
int y_add = (enable_overscan && !suppress_overscan) ? (overscan_y >> 1) : 0;
|
||||||
int x_add = (enable_overscan && !suppress_overscan) ? 8 : 0;
|
int x_add = (enable_overscan && !suppress_overscan) ? 8 : 0;
|
||||||
|
|
||||||
if (voodoo->fbiInit0 & FBIINIT0_VGA_PASS)
|
if (voodoo->fbiInit0 & FBIINIT0_VGA_PASS)
|
||||||
@@ -7380,7 +7452,7 @@ skip_draw:
|
|||||||
if (voodoo->line_time)
|
if (voodoo->line_time)
|
||||||
voodoo->timer_count += voodoo->line_time;
|
voodoo->timer_count += voodoo->line_time;
|
||||||
else
|
else
|
||||||
voodoo->timer_count += TIMER_USEC * 32LL;
|
voodoo->timer_count += TIMER_USEC * 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void voodoo_add_status_info(char *s, int max_len, void *p)
|
static void voodoo_add_status_info(char *s, int max_len, void *p)
|
||||||
@@ -7488,8 +7560,7 @@ static void voodoo_speed_changed(void *p)
|
|||||||
// pclog("Voodoo read_time=%i write_time=%i burst_time=%i %08x %08x\n", voodoo->read_time, voodoo->write_time, voodoo->burst_time, voodoo->fbiInit1, voodoo->fbiInit4);
|
// pclog("Voodoo read_time=%i write_time=%i burst_time=%i %08x %08x\n", voodoo->read_time, voodoo->write_time, voodoo->burst_time, voodoo->fbiInit1, voodoo->fbiInit4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *voodoo_card_init()
|
||||||
void *voodoo_card_init(void)
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
voodoo_t *voodoo = malloc(sizeof(voodoo_t));
|
voodoo_t *voodoo = malloc(sizeof(voodoo_t));
|
||||||
@@ -7538,12 +7609,12 @@ void *voodoo_card_init(void)
|
|||||||
|
|
||||||
for (c = 0; c < TEX_CACHE_MAX; c++)
|
for (c = 0; c < TEX_CACHE_MAX; c++)
|
||||||
{
|
{
|
||||||
voodoo->texture_cache[0][c].data = malloc((256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2 + 1*1) * 4);
|
voodoo->texture_cache[0][c].data = malloc((256*256 + 256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2) * 4);
|
||||||
voodoo->texture_cache[0][c].base = -1; /*invalid*/
|
voodoo->texture_cache[0][c].base = -1; /*invalid*/
|
||||||
voodoo->texture_cache[0][c].refcount = 0;
|
voodoo->texture_cache[0][c].refcount = 0;
|
||||||
if (voodoo->dual_tmus)
|
if (voodoo->dual_tmus)
|
||||||
{
|
{
|
||||||
voodoo->texture_cache[1][c].data = malloc((256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2 + 1*1) * 4);
|
voodoo->texture_cache[1][c].data = malloc((256*256 + 256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2) * 4);
|
||||||
voodoo->texture_cache[1][c].base = -1; /*invalid*/
|
voodoo->texture_cache[1][c].base = -1; /*invalid*/
|
||||||
voodoo->texture_cache[1][c].refcount = 0;
|
voodoo->texture_cache[1][c].refcount = 0;
|
||||||
}
|
}
|
||||||
@@ -7626,7 +7697,7 @@ void *voodoo_card_init(void)
|
|||||||
return voodoo;
|
return voodoo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *voodoo_init(device_t *info)
|
void *voodoo_init()
|
||||||
{
|
{
|
||||||
voodoo_set_t *voodoo_set = malloc(sizeof(voodoo_set_t));
|
voodoo_set_t *voodoo_set = malloc(sizeof(voodoo_set_t));
|
||||||
uint32_t tmuConfig = 1;
|
uint32_t tmuConfig = 1;
|
||||||
@@ -7686,25 +7757,21 @@ void *voodoo_init(device_t *info)
|
|||||||
|
|
||||||
void voodoo_card_close(voodoo_t *voodoo)
|
void voodoo_card_close(voodoo_t *voodoo)
|
||||||
{
|
{
|
||||||
#ifdef VOODOO_DEBUG
|
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
FILE *f;
|
FILE *f;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef VOODOO_DEBUG
|
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
f = romfopen(L"texram.dmp", L"wb");
|
f = rom_fopen(L"texram.dmp", L"wb");
|
||||||
fwrite(voodoo->tex_mem[0], voodoo->texture_size*1024*1024, 1, f);
|
fwrite(voodoo->tex_mem[0], voodoo->texture_size*1024*1024, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (voodoo->dual_tmus)
|
if (voodoo->dual_tmus)
|
||||||
{
|
{
|
||||||
f = romfopen(L"texram2.dmp", L"wb");
|
f = rom_fopen(L"texram2.dmp", L"wb");
|
||||||
fwrite(voodoo->tex_mem[1], voodoo->texture_size*1024*1024, 1, f);
|
fwrite(voodoo->tex_mem[1], voodoo->texture_size*1024*1024, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
thread_kill(voodoo->fifo_thread);
|
thread_kill(voodoo->fifo_thread);
|
||||||
|
|||||||
@@ -802,7 +802,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
|
|
||||||
if (depth_jump_pos)
|
if (depth_jump_pos)
|
||||||
*(uint8_t *)&code_block[depth_jump_pos] = (block_pos - depth_jump_pos) - 1;
|
*(uint8_t *)&code_block[depth_jump_pos] = (block_pos - depth_jump_pos) - 1;
|
||||||
if (depth_jump_pos2)
|
if (depth_jump_pos)
|
||||||
*(uint8_t *)&code_block[depth_jump_pos2] = (block_pos - depth_jump_pos2) - 1;
|
*(uint8_t *)&code_block[depth_jump_pos2] = (block_pos - depth_jump_pos2) - 1;
|
||||||
|
|
||||||
if ((params->fogMode & (FOG_ENABLE|FOG_CONSTANT|FOG_Z|FOG_ALPHA)) == FOG_ENABLE)
|
if ((params->fogMode & (FOG_ENABLE|FOG_CONSTANT|FOG_Z|FOG_ALPHA)) == FOG_ENABLE)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||||
#define BITMAP windows_BITMAP
|
#define BITMAP windows_BITMAP
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef BITMAP
|
#undef BITMAP
|
||||||
@@ -761,7 +761,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
|
|
||||||
if (depth_jump_pos)
|
if (depth_jump_pos)
|
||||||
*(uint8_t *)&code_block[depth_jump_pos] = (block_pos - depth_jump_pos) - 1;
|
*(uint8_t *)&code_block[depth_jump_pos] = (block_pos - depth_jump_pos) - 1;
|
||||||
if (depth_jump_pos2)
|
if (depth_jump_pos)
|
||||||
*(uint8_t *)&code_block[depth_jump_pos2] = (block_pos - depth_jump_pos2) - 1;
|
*(uint8_t *)&code_block[depth_jump_pos2] = (block_pos - depth_jump_pos2) - 1;
|
||||||
|
|
||||||
if ((params->fogMode & (FOG_ENABLE|FOG_CONSTANT|FOG_Z|FOG_ALPHA)) == FOG_ENABLE)
|
if ((params->fogMode & (FOG_ENABLE|FOG_CONSTANT|FOG_Z|FOG_ALPHA)) == FOG_ENABLE)
|
||||||
@@ -1129,10 +1129,14 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0xfd);
|
addbyte(0xfd);
|
||||||
addbyte(0xc8);
|
addbyte(0xc8);
|
||||||
}
|
}
|
||||||
addbyte(0x66); /*PACKUSWB XMM3, XMM1*/
|
addbyte(0xf3); /*MOVD XMM3, XMM1*/
|
||||||
|
addbyte(0x0f);
|
||||||
|
addbyte(0x7e);
|
||||||
|
addbyte(0xd9);
|
||||||
|
addbyte(0x66); /*PACKUSWB XMM3, XMM3*/
|
||||||
addbyte(0x0f);
|
addbyte(0x0f);
|
||||||
addbyte(0x67);
|
addbyte(0x67);
|
||||||
addbyte(0xd9);
|
addbyte(0xdb);
|
||||||
if (tca_sub_clocal_1)
|
if (tca_sub_clocal_1)
|
||||||
{
|
{
|
||||||
addbyte(0x66); /*MOVD EBX, XMM3*/
|
addbyte(0x66); /*MOVD EBX, XMM3*/
|
||||||
@@ -1204,7 +1208,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0x35); /*XOR EAX, 0xff*/
|
addbyte(0x35); /*XOR EAX, 0xff*/
|
||||||
addlong(0xff);
|
addlong(0xff);
|
||||||
}
|
}
|
||||||
addbyte(0x8e); /*ADD EAX, 1*/
|
addbyte(0x83); /*ADD EAX, 1*/
|
||||||
addbyte(0xc0);
|
addbyte(0xc0);
|
||||||
addbyte(1);
|
addbyte(1);
|
||||||
addbyte(0x0f); /*IMUL EAX, EBX*/
|
addbyte(0x0f); /*IMUL EAX, EBX*/
|
||||||
@@ -1457,17 +1461,9 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0xff);
|
addbyte(0xff);
|
||||||
addbyte(0x66); /*PADDW XMM1, XMM4*/
|
addbyte(0x66); /*PADDW XMM1, XMM4*/
|
||||||
addbyte(0x0f);
|
addbyte(0x0f);
|
||||||
addbyte(0xfc);
|
addbyte(0xfd);
|
||||||
addbyte(0xcc);
|
addbyte(0xcc);
|
||||||
}
|
}
|
||||||
if (tc_invert_output)
|
|
||||||
{
|
|
||||||
addbyte(0x66); /*PXOR XMM1, FF*/
|
|
||||||
addbyte(0x0f);
|
|
||||||
addbyte(0xef);
|
|
||||||
addbyte(0x0d);
|
|
||||||
addlong((uint32_t)&xmm_ff_w);
|
|
||||||
}
|
|
||||||
|
|
||||||
addbyte(0x66); /*PACKUSWB XMM0, XMM0*/
|
addbyte(0x66); /*PACKUSWB XMM0, XMM0*/
|
||||||
addbyte(0x0f);
|
addbyte(0x0f);
|
||||||
@@ -1481,6 +1477,14 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0x0f);
|
addbyte(0x0f);
|
||||||
addbyte(0x67);
|
addbyte(0x67);
|
||||||
addbyte(0xc9);
|
addbyte(0xc9);
|
||||||
|
if (tc_invert_output)
|
||||||
|
{
|
||||||
|
addbyte(0x66); /*PXOR XMM1, FF*/
|
||||||
|
addbyte(0x0f);
|
||||||
|
addbyte(0xef);
|
||||||
|
addbyte(0x0d);
|
||||||
|
addlong((uint32_t)&xmm_ff_b);
|
||||||
|
}
|
||||||
|
|
||||||
if (tca_zero_other)
|
if (tca_zero_other)
|
||||||
{
|
{
|
||||||
@@ -1658,7 +1662,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0xc0);
|
addbyte(0xc0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->alphaMode & ((1 << 0) | (1 << 4)))
|
if ((params->alphaMode & ((1 << 0) | (1 << 4))) || (!(cc_mselect == 0 && cc_reverse_blend == 0) && (cc_mselect == CC_MSELECT_AOTHER || cc_mselect == CC_MSELECT_ALOCAL)))
|
||||||
{
|
{
|
||||||
/*EBX = a_other*/
|
/*EBX = a_other*/
|
||||||
switch (a_sel)
|
switch (a_sel)
|
||||||
@@ -1823,7 +1827,6 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
{
|
{
|
||||||
addbyte(0xf6); /*TEST state->tex_a, 0x80*/
|
addbyte(0xf6); /*TEST state->tex_a, 0x80*/
|
||||||
addbyte(0x87);
|
addbyte(0x87);
|
||||||
addbyte(0x23);
|
|
||||||
addlong(offsetof(voodoo_state_t, tex_a));
|
addlong(offsetof(voodoo_state_t, tex_a));
|
||||||
addbyte(0x80);
|
addbyte(0x80);
|
||||||
addbyte(0x74);/*JZ !cc_localselect*/
|
addbyte(0x74);/*JZ !cc_localselect*/
|
||||||
@@ -1833,7 +1836,8 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
|||||||
addbyte(0x6e);
|
addbyte(0x6e);
|
||||||
addbyte(0x8e);
|
addbyte(0x8e);
|
||||||
addlong(offsetof(voodoo_params_t, color0));
|
addlong(offsetof(voodoo_params_t, color0));
|
||||||
/*JMP +*/
|
addbyte(0xeb); /*JMP +*/
|
||||||
|
addbyte(8);
|
||||||
/*!cc_localselect:*/
|
/*!cc_localselect:*/
|
||||||
addbyte(0xf3); /*MOVDQU XMM1, ib*/ /* ir, ig and ib must be in same dqword!*/
|
addbyte(0xf3); /*MOVDQU XMM1, ib*/ /* ir, ig and ib must be in same dqword!*/
|
||||||
addbyte(0x0f);
|
addbyte(0x0f);
|
||||||
@@ -3285,7 +3289,7 @@ static void voodoo_codegen_init(voodoo_t *voodoo)
|
|||||||
long pagemask = ~(pagesize - 1);
|
long pagemask = ~(pagesize - 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM*2, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM*2, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
#else
|
#else
|
||||||
voodoo->codegen_data = malloc(sizeof(voodoo_x86_data_t) * BLOCK_NUM*2);
|
voodoo->codegen_data = malloc(sizeof(voodoo_x86_data_t) * BLOCK_NUM*2);
|
||||||
@@ -3325,7 +3329,7 @@ static void voodoo_codegen_init(voodoo_t *voodoo)
|
|||||||
|
|
||||||
static void voodoo_codegen_close(voodoo_t *voodoo)
|
static void voodoo_codegen_close(voodoo_t *voodoo)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||||
VirtualFree(voodoo->codegen_data, 0, MEM_RELEASE);
|
VirtualFree(voodoo->codegen_data, 0, MEM_RELEASE);
|
||||||
#else
|
#else
|
||||||
free(voodoo->codegen_data);
|
free(voodoo->codegen_data);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Platform main support module for Windows.
|
* Platform main support module for Windows.
|
||||||
*
|
*
|
||||||
* Version: @(#)win.c 1.0.32 2017/11/04
|
* Version: @(#)win.c 1.0.33 2017/11/11
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -622,7 +622,11 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if (scrnsz_y < 0)
|
if (scrnsz_y < 0)
|
||||||
scrnsz_y = 0;
|
scrnsz_y = 0;
|
||||||
|
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||||
|
|
||||||
|
plat_vid_api_resize(scrnsz_x, scrnsz_y);
|
||||||
|
|
||||||
|
MoveWindow(hwndSBAR, 0, scrnsz_y + 6, scrnsz_x, 17, TRUE);
|
||||||
|
|
||||||
if (mouse_capture) {
|
if (mouse_capture) {
|
||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
|
|||||||
@@ -303,6 +303,19 @@ endblit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
plat_vid_api_resize(int x, int y)
|
||||||
|
{
|
||||||
|
if (vid_apis[video_fullscreen][vid_api].resize)
|
||||||
|
{
|
||||||
|
startblit();
|
||||||
|
video_wait_for_blit();
|
||||||
|
vid_apis[video_fullscreen][vid_api].resize(x, y);
|
||||||
|
endblit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Tell the UI and/or renderers about a new screen resolution. */
|
/* Tell the UI and/or renderers about a new screen resolution. */
|
||||||
void
|
void
|
||||||
plat_resize(int x, int y)
|
plat_resize(int x, int y)
|
||||||
@@ -335,12 +348,4 @@ pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y);
|
|||||||
ClipCursor(&r);
|
ClipCursor(&r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, tell the renderer about the new screen size we want. */
|
|
||||||
if (vid_apis[video_fullscreen][vid_api].resize) {
|
|
||||||
startblit();
|
|
||||||
video_wait_for_blit();
|
|
||||||
vid_apis[video_fullscreen][vid_api].resize(x, y);
|
|
||||||
endblit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user