ref: 255dafa383bf409f7f1cfeb8538fb7b385fe58a1
parent: 7364b1ede690311dab399df099dd59978de35fe6
author: Jean-André Santoni <jean.andre.santoni@gmail.com>
date: Sun Jul 14 13:28:31 EDT 2024
Fix vdpaddr
--- a/vdp.c
+++ b/vdp.c
@@ -5,12 +5,10 @@
extern uint8_t *pic;
-uint8_t vdpcode;
-uint8_t vdpaddr;
-uint8_t vdpbuf;
-uint8_t vdpstat = 0;
+uint8_t vdpcode, vdpbuf, vdpstat = 0;
+uint16_t vdpaddr;
int vdpx = 0, vdpy, vdpyy, frame, intla;
-int first = 0;
+int first = 1;
uint16_t hctr;
static int xmax, xdisp;
static int sx, snx, col, pri, lum;
@@ -335,13 +333,15 @@
printf(" vdp write to control port %x\n", v); if(first){- first = 0;
- vdpaddr = (vdpaddr & 0xFF00) | v;
- return;
+ printf("first\n");+ first = 0;
+ vdpaddr = (vdpaddr & 0xFF00) | v;
+ return;
}
vdpcode = (v >> 6) & 0x03;
vdpaddr = (vdpaddr & 0x00ff) | ((v & 0x3f) << 8);
+ printf("vdp code and address %x %x\n", vdpcode, vdpaddr);first = 1;
switch(vdpcode){@@ -357,7 +357,9 @@
void
vdpdata(uint8_t v)
{- printf(" vdp write to data port %x\n", v);+ printf(" vdp (code: %x) write to data port %x\n", vdpcode, v);+ first = 1;
+ vdpbuf = v;
switch(vdpcode){case 0: case 1: case 2: vram[vdpaddr] = v; break;
case 3: cramwrite(vdpaddr, v); break;
@@ -451,7 +453,7 @@
if(vdpy == yvbl){vdpstat |= STATVBL | STATINT;
frame ^= 1;
- z80irq = 1;
+ // z80irq = 1;
if((reg[MODE2] & IE0) != 0)
irq |= INTVBL;
}
--- a/z80.c
+++ b/z80.c
@@ -414,7 +414,7 @@
uint16_t a, n;
op = fetch8();
- printf("ed %.2x\n", op);+ // printf("ed %.2x\n", op); switch(op){case 0xa0: case 0xa1: case 0xa8: case 0xa9:
case 0xb0: case 0xb1: case 0xb8: case 0xb9:
@@ -682,10 +682,9 @@
}
}
curpc = pc;
- if(1)
- printf("%x AF %.2x%.2x BC %.2x%.2x DE %.2x%.2x HL %.2x%.2x IX %.4x IY %.4x\n", curpc, s[rA], s[rF], s[rB], s[rC], s[rD], s[rE], s[rH], s[rL], ix[0], ix[1]);+ // printf("%x AF %.2x%.2x BC %.2x%.2x DE %.2x%.2x HL %.2x%.2x IX %.4x IY %.4x\n", curpc, s[rA], s[rF], s[rB], s[rC], s[rD], s[rE], s[rH], s[rL], ix[0], ix[1]);op = fetch8();
- printf("op: %x\n", op);+ // printf("op: %x\n", op); switch(op >> 6){case 1: return move(op >> 3 & 7, op & 7);
case 2: return alu(op >> 3 & 7, op & 7);
--
⑨