games/md: small cpu and vdp bug fixes

front
aiju 2014-05-25 21:45:13 +02:00
parent c5214cd6d9
commit 235cc0747d
4 changed files with 9 additions and 6 deletions

View File

@ -252,7 +252,7 @@ add(u32int u, u32int w, int c, int s)
if((v >> 32) != 0)
rS |= FLAGC;
if((v >> 31) != 0)
rS |= FLAGV;
rS |= FLAGN;
if((~(w ^ u) & (v ^ u) & (1<<31)) != 0)
rS |= FLAGV;
if((u32int)v != 0)
@ -461,7 +461,7 @@ step(void)
int n, m, d;
static int cnt;
if(0 && pc == 0x13dc4){
if(0 && pc == 0x48ee){
trace++;
print("%x\n", curpc);
}

View File

@ -3,6 +3,7 @@ typedef signed short s16int;
typedef signed long s32int;
extern u32int curpc, irq;
extern int trace;
extern u8int reg[32];
extern u8int dma;

View File

@ -91,6 +91,8 @@ keyproc(void *)
close(fd);
threadexitsall(nil);
}
if(utfrune(buf, 't'))
trace = !trace;
}
if(buf[0] != 'k' && buf[0] != 'K')
continue;

View File

@ -187,13 +187,13 @@ static struct sprite {
static void
spritesinit(void)
{
u16int *t, *p, dy, *c;
u16int t, *p, dy, *c;
u32int v;
int i, ns, np;
struct sprite *q;
t = vram + (reg[SPRTAB] << 8 & 0x7f00);
p = t;
t = (reg[SPRTAB] << 8 & 0x7f00);
p = vram + t;
q = spr;
ns = (reg[MODE4] & WIDE) != 0 ? 20 : 16;
np = 0;
@ -229,7 +229,7 @@ spritesinit(void)
vdpstat |= STATOVR;
break;
}
}while(p = t + ((p[1] & 0x7f) << 2), p != t);
}while(p = vram + (u16int)(t + ((p[1] & 0x7f) << 2)), p - vram != t);
lsp = q;
}