games/md: interlacing, sort of
This commit is contained in:
parent
f55c43fe8d
commit
41ef4524ab
|
@ -23,7 +23,7 @@ extern int keys, scale;
|
||||||
extern u16int vram[32768], vsram[40];
|
extern u16int vram[32768], vsram[40];
|
||||||
extern u32int cramc[64];
|
extern u32int cramc[64];
|
||||||
extern u16int vdpstat;
|
extern u16int vdpstat;
|
||||||
extern int vdpx, vdpy;
|
extern int vdpx, vdpy, frame, intla;
|
||||||
|
|
||||||
extern u8int ym[512], ymstat;
|
extern u8int ym[512], ymstat;
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,8 @@ memread(u32int a)
|
||||||
v = vdpx - (vdpx >= 360 ? 406 : 0);
|
v = vdpx - (vdpx >= 360 ? 406 : 0);
|
||||||
else
|
else
|
||||||
v = vdpx - (vdpx >= 296 ? 342 : 0);
|
v = vdpx - (vdpx >= 296 ? 342 : 0);
|
||||||
|
if(intla)
|
||||||
|
return vdpy - (vdpy >= 234 ? 5 : 0) << 8 & 0xfe00 | frame << 8 | v >> 1 & 0xff;
|
||||||
return vdpy - (vdpy >= 234 ? 5 : 0) << 8 | v >> 1 & 0xff;
|
return vdpy - (vdpy >= 234 ? 5 : 0) << 8 | v >> 1 & 0xff;
|
||||||
default:
|
default:
|
||||||
goto invalid;
|
goto invalid;
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
|
|
||||||
u8int pic[320*224*4*3];
|
u8int pic[320*224*4*3];
|
||||||
u16int vdpstat = 0x3400;
|
u16int vdpstat = 0x3400;
|
||||||
int vdpx, vdpy;
|
int vdpx, vdpy, vdpyy, frame, intla;
|
||||||
u16int hctr;
|
u16int hctr;
|
||||||
static int xmax, xdisp, ymax = 262, yvbl = 234;
|
static int xmax, xdisp;
|
||||||
static int sx, snx, col, pri, lum;
|
static int sx, snx, col, pri, lum;
|
||||||
enum { DARK, NORM, BRIGHT };
|
enum { DARK, NORM, BRIGHT };
|
||||||
|
enum { ymax = 262, yvbl = 234 };
|
||||||
|
|
||||||
void
|
void
|
||||||
vdpmode(void)
|
vdpmode(void)
|
||||||
|
@ -22,6 +23,7 @@ vdpmode(void)
|
||||||
xdisp = 256;
|
xdisp = 256;
|
||||||
xmax = 342;
|
xmax = 342;
|
||||||
}
|
}
|
||||||
|
intla = (reg[MODE4] & 6) == 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -43,6 +45,8 @@ pixeldraw(int x, int y, int v)
|
||||||
u.b[2] = v;
|
u.b[2] = v;
|
||||||
u.b[3] = 0;
|
u.b[3] = 0;
|
||||||
if(scale == 2){
|
if(scale == 2){
|
||||||
|
if(intla)
|
||||||
|
y = y << 1 | frame;
|
||||||
q = (u32int*)pic + (x + y * 320) * 2;
|
q = (u32int*)pic + (x + y * 320) * 2;
|
||||||
q[0] = u.w;
|
q[0] = u.w;
|
||||||
q[1] = u.w;
|
q[1] = u.w;
|
||||||
|
@ -97,9 +101,15 @@ tile(struct pctxt *p)
|
||||||
a += p->tx;
|
a += p->tx;
|
||||||
p->t = vram[a];
|
p->t = vram[a];
|
||||||
y = p->tny;
|
y = p->tny;
|
||||||
if((p->t & 0x1000) != 0)
|
if(intla){
|
||||||
y = 7 - y;
|
if((p->t & 0x1000) != 0)
|
||||||
a = (p->t & 0x7ff) << 4 | y << 1;
|
y = 15 - y;
|
||||||
|
a = (p->t & 0x7ff) << 5 | y << 1;
|
||||||
|
}else{
|
||||||
|
if((p->t & 0x1000) != 0)
|
||||||
|
y = 7 - y;
|
||||||
|
a = (p->t & 0x7ff) << 4 | y << 1;
|
||||||
|
}
|
||||||
p->c = vram[a] << 16 | vram[a+1];
|
p->c = vram[a] << 16 | vram[a+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +139,15 @@ planeinit(void)
|
||||||
v = -(vram[a + i] & 0x3ff);
|
v = -(vram[a + i] & 0x3ff);
|
||||||
p->tnx = v & 7;
|
p->tnx = v & 7;
|
||||||
p->tx = v >> 3 & pctxt[i].w - 1;
|
p->tx = v >> 3 & pctxt[i].w - 1;
|
||||||
v = vsram[i] + vdpy;
|
if(intla){
|
||||||
p->tny = v & 7;
|
v = vsram[i] + vdpyy;
|
||||||
p->ty = v >> 3 & pctxt[i].h - 1;
|
p->tny = v & 15;
|
||||||
|
p->ty = v >> 4 & pctxt[i].h - 1;
|
||||||
|
}else{
|
||||||
|
v = vsram[i] + vdpy;
|
||||||
|
p->tny = v & 7;
|
||||||
|
p->ty = v >> 3 & pctxt[i].h - 1;
|
||||||
|
}
|
||||||
tile(p);
|
tile(p);
|
||||||
if(p->tnx != 0)
|
if(p->tnx != 0)
|
||||||
if((p->t & 0x800) != 0)
|
if((p->t & 0x800) != 0)
|
||||||
|
@ -237,9 +253,15 @@ spritesinit(void)
|
||||||
np = 0;
|
np = 0;
|
||||||
nt = 0;
|
nt = 0;
|
||||||
do{
|
do{
|
||||||
q->y = (p[0] & 0x3ff) - 128;
|
if(intla){
|
||||||
q->h = (p[1] >> 8 & 3) + 1 << 3;
|
q->y = (p[0] & 0x3ff) - 256;
|
||||||
dy = vdpy - q->y;
|
q->h = (p[1] >> 8 & 3) + 1 << 4;
|
||||||
|
dy = vdpyy - q->y;
|
||||||
|
}else{
|
||||||
|
q->y = (p[0] & 0x3ff) - 128;
|
||||||
|
q->h = (p[1] >> 8 & 3) + 1 << 3;
|
||||||
|
dy = vdpy - q->y;
|
||||||
|
}
|
||||||
if(dy >= q->h)
|
if(dy >= q->h)
|
||||||
continue;
|
continue;
|
||||||
q->t = p[2];
|
q->t = p[2];
|
||||||
|
@ -249,7 +271,7 @@ spritesinit(void)
|
||||||
if(q->x == 0xff80)
|
if(q->x == 0xff80)
|
||||||
break;
|
break;
|
||||||
q->w = (p[1] >> 10 & 3) + 1 << 3;
|
q->w = (p[1] >> 10 & 3) + 1 << 3;
|
||||||
c = ((q->t & 0x7ff) << 4) + (dy << 1);
|
c = ((q->t & 0x7ff) << 4+intla) + (dy << 1);
|
||||||
for(i = 0; i < q->w >> 3 && np < xdisp; i++){
|
for(i = 0; i < q->w >> 3 && np < xdisp; i++){
|
||||||
v = vram[c] << 16 | vram[(u16int)(c+1)];
|
v = vram[c] << 16 | vram[(u16int)(c+1)];
|
||||||
c += q->h << 1;
|
c += q->h << 1;
|
||||||
|
@ -354,6 +376,8 @@ vdpstep(void)
|
||||||
vdpstat &= ~(STATINT | STATVBL | STATOVR | STATCOLL);
|
vdpstat &= ~(STATINT | STATVBL | STATOVR | STATCOLL);
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
if(intla)
|
||||||
|
vdpyy = vdpy << 1 | frame;
|
||||||
if(vdpy == 0 || vdpy >= 225)
|
if(vdpy == 0 || vdpy >= 225)
|
||||||
hctr = reg[HORCTR];
|
hctr = reg[HORCTR];
|
||||||
else
|
else
|
||||||
|
@ -364,6 +388,7 @@ vdpstep(void)
|
||||||
}
|
}
|
||||||
if(vdpy == yvbl){
|
if(vdpy == yvbl){
|
||||||
vdpstat |= STATVBL | STATINT;
|
vdpstat |= STATVBL | STATINT;
|
||||||
|
frame ^= 1;
|
||||||
z80irq = 1;
|
z80irq = 1;
|
||||||
if((reg[MODE2] & IE0) != 0)
|
if((reg[MODE2] & IE0) != 0)
|
||||||
irq |= INTVBL;
|
irq |= INTVBL;
|
||||||
|
|
Loading…
Reference in a new issue