Mercurial > repos > blastem
comparison romdb.c @ 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 | 9e882eca717e |
children | 9ab35686a025 |
comparison
equal
deleted
inserted
replaced
937:9364dad5561a | 938:4c17c7f46331 |
---|---|
106 break; | 106 break; |
107 case I2C_DEVICE_ACK: | 107 case I2C_DEVICE_ACK: |
108 if (state->latch & 1) { | 108 if (state->latch & 1) { |
109 state->state = I2C_READ; | 109 state->state = I2C_READ; |
110 state->counter = 8; | 110 state->counter = 8; |
111 if (state->size < 256) { | |
112 state->address = state->latch >> 1; | |
113 } | |
111 state->latch = state->buffer[state->address]; | 114 state->latch = state->buffer[state->address]; |
112 } else { | 115 } else { |
113 if (state->size < 256) { | 116 if (state->size < 256) { |
114 state->address = state->latch >> 1; | 117 state->address = state->latch >> 1; |
115 state->state = I2C_WRITE; | 118 state->state = I2C_WRITE; |
363 } | 366 } |
364 uint16_t ret = 0; | 367 uint16_t ret = 0; |
365 if (map->sda_read_bit < 16) { | 368 if (map->sda_read_bit < 16) { |
366 ret = get_sda(&gen->eeprom) << map->sda_read_bit; | 369 ret = get_sda(&gen->eeprom) << map->sda_read_bit; |
367 } | 370 } |
368 return ret; | 371 return ret; |
369 } | 372 } |
370 | 373 |
371 uint8_t read_eeprom_i2c_b(uint32_t address, void * context) | 374 uint8_t read_eeprom_i2c_b(uint32_t address, void * context) |
372 { | 375 { |
373 genesis_context *gen = ((m68k_context *)context)->system; | 376 genesis_context *gen = ((m68k_context *)context)->system; |