commit 5d83731

Devine Lu Linvega  ·  2022-06-14 17:47:52 +0000 UTC
parent 2a1a506
Added warning for incompatible emulator devices
2 files changed,  +9, -0
+4, -0
 1@@ -33,6 +33,7 @@ static Window window;
 2 
 3 char *rom_path;
 4 
 5+#define SUPPORT 0x1f07 /* devices mask */
 6 #define WIDTH (64 * 8)
 7 #define HEIGHT (40 * 8)
 8 
 9@@ -79,6 +80,7 @@ static void
10 emu_deo(Uxn *u, Uint8 addr, Uint8 v)
11 {
12 	Uint8 p = addr & 0x0f, d = addr & 0xf0;
13+	Uint16 mask = 0x1 << (d >> 4);
14 	u->dev[addr] = v;
15 	switch(d) {
16 	case 0x00:
17@@ -91,6 +93,8 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 v)
18 	case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
19 	case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
20 	}
21+	if(p == 0x01 && !(SUPPORT & mask))
22+		fprintf(stderr, "Warning: Incompatible emulation, device: %02x.\n", d >> 4);
23 }
24 
25 static void
+5, -0
 1@@ -17,6 +17,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 2 WITH REGARD TO THIS SOFTWARE.
 3 */
 4 
 5+#define SUPPORT 0x1c03 /* devices mask */
 6+
 7 static int
 8 emu_error(char *msg, const char *err)
 9 {
10@@ -59,6 +61,7 @@ static void
11 emu_deo(Uxn *u, Uint8 addr, Uint8 v)
12 {
13 	Uint8 p = addr & 0x0f, d = addr & 0xf0;
14+	Uint16 mask = 0x1 << (d >> 4);
15 	u->dev[addr] = v;
16 	switch(d) {
17 	case 0x00: system_deo(u, &u->dev[d], p); break;
18@@ -66,6 +69,8 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 v)
19 	case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
20 	case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
21 	}
22+	if(p == 0x01 && !(SUPPORT & mask))
23+		fprintf(stderr, "Warning: Incompatible emulation, device: %02x.\n", d >> 4);
24 }
25 
26 int