UINT8 tms34061_device::read(address_space &space, int col, int row, int func) { int result = 0; offs_t offs; /* the function code determines what to do */ switch (func) { /* both 0 and 2 map to register access */ case 0: case 2: result = register_r(space, col); break; /* function 1 maps to XY access; col is the address adjustment */ case 1: result = xypixel_r(space, col); break; /* funtion 3 maps to direct access */ case 3: offs = ((row << m_rowshift) | col) & m_vrammask; result = m_vram[offs]; break; /* function 4 performs a shift reg transfer to VRAM */ case 4: offs = col << m_rowshift; if (m_regs[TMS34061_CONTROL2] & 0x0040) offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16; offs &= m_vrammask; memcpy(&m_vram[offs], m_shiftreg, (size_t)1 << m_rowshift); memset(&m_latchram[offs], m_latchdata, (size_t)1 << m_rowshift); break; /* function 5 performs a shift reg transfer from VRAM */ case 5: offs = col << m_rowshift; if (m_regs[TMS34061_CONTROL2] & 0x0040) offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16; offs &= m_vrammask; m_shiftreg = &m_vram[offs]; break; /* log anything else */ default: logerror("%s:Unsupported TMS34061 function %d\n", space.machine().describe_context(), func); break; } return result; }
UINT8 tms34061_r(int col, int row, int func) { int result = 0; offs_t offs; /* the function code determines what to do */ switch (func) { /* both 0 and 2 map to register access */ case 0: case 2: result = register_r(col); break; /* function 1 maps to XY access; col is the address adjustment */ case 1: result = xypixel_r(col); break; /* funtion 3 maps to direct access */ case 3: offs = ((row << tms34061.intf.rowshift) | col) & tms34061.vrammask; result = tms34061.vram[offs]; break; /* function 4 performs a shift reg transfer to VRAM */ case 4: offs = col << tms34061.intf.rowshift; if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; memcpy(&tms34061.vram[offs], tms34061.shiftreg, (size_t)1 << tms34061.intf.rowshift); memset(&tms34061.latchram[offs], tms34061.latchdata, (size_t)1 << tms34061.intf.rowshift); break; /* function 5 performs a shift reg transfer from VRAM */ case 5: offs = col << tms34061.intf.rowshift; if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; tms34061.shiftreg = &tms34061.vram[offs]; break; /* log anything else */ default: logerror("Unsupported TMS34061 function %d - PC: %04X\n", func, activecpu_get_pc()); break; } return result; }