diff tern.c @ 768:2f48a3c187c6

Add support for reading cartridge memory map from ROM database, though without EEPROM support for now
author Michael Pavone <pavone@retrodev.com>
date Tue, 07 Jul 2015 19:33:33 -0700
parents 1b2f8280ba81
children 724bbec47f86
line wrap: on
line diff
--- a/tern.c	Mon Jul 06 19:46:46 2015 -0700
+++ b/tern.c	Tue Jul 07 19:33:33 2015 -0700
@@ -107,7 +107,11 @@
 {
 	tern_val ret;
 	if (tern_find(head, key, &ret)) {
-		return ret.ptrval;
+		if (ret.intval & 1) {
+			return (void *)(ret.intval & ~1);
+		} else {
+			return ret.ptrval;
+		}
 	}
 	return def;
 }
@@ -193,7 +197,7 @@
 		tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1);
 	}
 	if (head->right) {
-		tern_foreach_int(head->left, fun, data, keybuf, pos);
+		tern_foreach_int(head->right, fun, data, keybuf, pos);
 	}
 }