changeset 938:4c17c7f46331

Accept address on 128-byte EEPROMs on both read and write
author Michael Pavone <pavone@retrodev.com>
date Wed, 24 Feb 2016 19:24:13 -0800
parents 9364dad5561a
children 00c57f1925c3
files romdb.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/romdb.c	Tue Feb 23 21:17:56 2016 -0800
+++ b/romdb.c	Wed Feb 24 19:24:13 2016 -0800
@@ -108,6 +108,9 @@
 			if (state->latch & 1) {
 				state->state = I2C_READ;
 				state->counter = 8;
+				if (state->size < 256) {
+					state->address = state->latch >> 1;
+				}
 				state->latch = state->buffer[state->address];
 			} else {
 				if (state->size < 256) {
@@ -365,7 +368,7 @@
 	if (map->sda_read_bit < 16) {
 		ret = get_sda(&gen->eeprom) << map->sda_read_bit;
 	}
-	return ret;
+	return ret;	
 }
 
 uint8_t read_eeprom_i2c_b(uint32_t address, void * context)