uint16_t v25_common_device::v25_read_word(unsigned a) { if (BIT(a, 0)) return (v25_read_byte(a) | (v25_read_byte(a + 1) << 8)); // not sure about this - manual says FFFFC-FFFFE are "reserved" if (a == 0xffffe) return (m_program->read_byte(a) | (m_data->read_byte(0x1ff) << 8)); else if ((a & 0xffe00) == m_IDB && (m_RAMEN || BIT(a, 8))) return m_data->read_word(a & 0x1ff); else return m_program->read_word(a); }
int v25_read_word(v25_state_t *nec_state, unsigned a) { if( a & 1 ) return (v25_read_byte(nec_state, a) | (v25_read_byte(nec_state, a + 1) << 8)); unsigned page = a >> 8; unsigned offs = a & 0xff; if(RAMEN && page == (nec_state->IDB << 4 | 0xE)) return nec_state->ram.w[offs/2]; if(page == (nec_state->IDB << 4 | 0xF)) return (read_sfr(nec_state, offs) | (read_sfr(nec_state, offs+1) << 8)); if(a == 0xFFFFE) /* not sure about this */ return (nec_state->program->read_byte(a) | (read_sfr(nec_state, 0xFF) << 8)); return nec_state->program->read_word(a); }