summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/games/md/cpu.c4
-rw-r--r--sys/src/games/md/dat.h1
-rw-r--r--sys/src/games/md/md.c2
-rw-r--r--sys/src/games/md/vdp.c8
4 files changed, 9 insertions, 6 deletions
diff --git a/sys/src/games/md/cpu.c b/sys/src/games/md/cpu.c
index 92eda53f4..eb5ded675 100644
--- a/sys/src/games/md/cpu.c
+++ b/sys/src/games/md/cpu.c
@@ -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);
}
diff --git a/sys/src/games/md/dat.h b/sys/src/games/md/dat.h
index f82098827..ab0fffdda 100644
--- a/sys/src/games/md/dat.h
+++ b/sys/src/games/md/dat.h
@@ -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;
diff --git a/sys/src/games/md/md.c b/sys/src/games/md/md.c
index d762a8b6a..a4df3b611 100644
--- a/sys/src/games/md/md.c
+++ b/sys/src/games/md/md.c
@@ -91,6 +91,8 @@ keyproc(void *)
close(fd);
threadexitsall(nil);
}
+ if(utfrune(buf, 't'))
+ trace = !trace;
}
if(buf[0] != 'k' && buf[0] != 'K')
continue;
diff --git a/sys/src/games/md/vdp.c b/sys/src/games/md/vdp.c
index a4f26884e..7b8f1c602 100644
--- a/sys/src/games/md/vdp.c
+++ b/sys/src/games/md/vdp.c
@@ -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;
}