shithub: sms

Download patch

ref: 8dd83d00a53de5ab6c05f14a29e6103d0cdfa254
parent: 756e800fc10c88e4f9b3b9dc31928714184a9ea0
author: Jean-André Santoni <jean.andre.santoni@gmail.com>
date: Sat Jul 27 18:58:13 EDT 2024

Clean

--- a/sms.c
+++ b/sms.c
@@ -15,7 +15,7 @@
 int t = 0;
 uint32_t r[16];
 extern uint16_t pc, curpc, sp;
-uint32_t asp, irq, stop;
+uint32_t irq;
 int doflush = 0;
 uint8_t *rom = NULL;
 uint8_t *mem = NULL;
--- a/vdp.c
+++ b/vdp.c
@@ -41,7 +41,7 @@
 	uint16_t screenmap = (reg[PANT] & 0x0e) << 10;
 
 	uint8_t y = vdpy + reg[VERSCR];
-	if (y >= 224) y -= 224;
+	y %= 224;
 	int ty = y >> 3;
 	int tyoff = y & 7;
 
@@ -58,8 +58,7 @@
 	int paloff = (info & 1 << 3) != 0 ? 16 : 0;
 
 	int data = (tidx << 5) + ((vflip ? 7 - tyoff : tyoff) << 2);
-	int xx = 7 - txoff;
-	if (hflip) xx = txoff;
+	int xx = hflip ? txoff : 7 - txoff;
 
 	int c = ((vram[data] >> xx) & 1) +
 			(((vram[data + 1] >> xx) & 1) << 1) +
@@ -187,7 +186,7 @@
 	vdpbuf = vram[vdpaddr];
 	vdpaddr++;
 	vdpaddr &= 0x3fff;
-	// printf("	vdp read from data port %x\n", v);
+	// printf("    vdp read from data port %x\n", v);
 	first = 1;
 	return v;
 }
@@ -198,7 +197,7 @@
 	uint8_t v = vdpstat | 0x1f;
 	vdpstat = 0;
 	z80irq = 0;
-	// printf("	vdp read status flags %x\n", v);
+	// printf("    vdp read status flags %x\n", v);
 	first = 1;
 	return v;
 }
@@ -206,7 +205,7 @@
 uint8_t
 vdphcounter(void)
 {
-	// printf("	vdp read hcounter %x\n", vdpx);
+	// printf("    vdp read hcounter %x\n", vdpx);
 	return vdpx;
 }
 
@@ -213,7 +212,7 @@
 uint8_t
 vdpvcounter(void)
 {
-	// printf("	vdp read vcounter %x\n", vdpy);
+	// printf("    vdp read vcounter %x\n", vdpy);
 	return vdpy;
 }
 
--