trunk/src/emu/sound/l7a1045_l6028_dsp_a.c
| r245467 | r245468 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | L7A1045 L6028 DSP-A |
| 3 | L7A1045 L6028 DSP-A |
| 4 | 4 | (QFP120 package) |
| 5 | 5 | |
| 6 | 6 | this is the audio chip used on the following |
| r245467 | r245468 | |
| 44 | 44 | |
| 45 | 45 | 7 ---------------- ---------------- llllllllrrrrrrrr left/right volume |
| 46 | 46 | |
| 47 | | 8 ---------------- ---------------- ---------------- (read only?) |
| 47 | 8 ---------------- ---------------- ---------------- (read only?) |
| 48 | 48 | |
| 49 | 49 | 9 ---------------- ---------------- ---------------- (read only?) |
| 50 | 50 | |
| r245467 | r245468 | |
| 149 | 149 | if ((start + pos) >= end) |
| 150 | 150 | { |
| 151 | 151 | m_key &= ~(1 << i); |
| 152 | | |
| 152 | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | sample = (INT8)m_rom[(start + pos) & (m_rom_size-1)]; |
| r245467 | r245468 | |
| 168 | 168 | |
| 169 | 169 | WRITE16_MEMBER( l7a1045_sound_device::l7a1045_sound_w ) |
| 170 | 170 | { |
| 171 | | m_stream->update(); |
| 171 | m_stream->update(); // TODO |
| 172 | 172 | |
| 173 | | switch (offset) |
| 174 | | { |
| 175 | | case 0x00:l7a1045_sound_select_w(space, offset, data, mem_mask); break; |
| 176 | | case 0x01:l7a1045_sound_data_02_w(space, offset, data, mem_mask); break; |
| 177 | | case 0x02:l7a1045_sound_data_04_w(space, offset, data, mem_mask); break; |
| 178 | | case 0x03:l7a1045_sound_data_06_w(space, offset, data, mem_mask); break; |
| 179 | | } |
| 180 | | |
| 173 | if(offset == 0) |
| 174 | sound_select_w(space, offset, data, mem_mask); |
| 175 | else |
| 176 | sound_data_w(space,offset - 1,data,mem_mask); |
| 181 | 177 | } |
| 182 | 178 | |
| 183 | 179 | |
| r245467 | r245468 | |
| 199 | 195 | } |
| 200 | 196 | |
| 201 | 197 | |
| 202 | | WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_select_w) |
| 198 | WRITE16_MEMBER(l7a1045_sound_device::sound_select_w) |
| 203 | 199 | { |
| 204 | 200 | // I'm guessing these addresses are the sound chip / DSP? |
| 205 | 201 | |
| r245467 | r245468 | |
| 222 | 218 | |
| 223 | 219 | } |
| 224 | 220 | |
| 225 | | WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_02_w) // upper? word of various registers? |
| 221 | WRITE16_MEMBER(l7a1045_sound_device::sound_data_w) |
| 226 | 222 | { |
| 227 | | m_audiodat[m_audioregister][m_audiochannel].dat[2] = data; |
| 223 | // if(m_audioregister == 0) |
| 224 | // printf("%04x %04x (%04x|%04x %04x)\n",offset,data,offset ^ 2,m_audioregister,m_audiochannel); |
| 228 | 225 | |
| 229 | | // write with registers 00, 01, 04, 06, 05, 03, 07, 02 on startup |
| 230 | | // groups writes of register 0a per channel |
| 226 | m_audiodat[m_audioregister][m_audiochannel].dat[offset] = data; |
| 231 | 227 | |
| 232 | | // register 08 / 09 not written? |
| 233 | | switch (m_audioregister) |
| 228 | if(offset == 0) |
| 234 | 229 | { |
| 235 | | default: |
| 236 | 230 | |
| 237 | | case 0x08: |
| 238 | | case 0x09: |
| 239 | | printf("%08x: unexpected write port 0x0002 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 240 | | break; |
| 241 | | |
| 242 | | // case 0x00: |
| 243 | | case 0x01: |
| 244 | | case 0x04: |
| 245 | | case 0x06: |
| 246 | | case 0x05: |
| 247 | | case 0x03: |
| 248 | | case 0x02: |
| 249 | | case 0x07: |
| 250 | | |
| 251 | | case 0x0a: |
| 252 | | // printf("%08x: write port 0x0002 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 253 | | break; |
| 254 | | |
| 231 | switch (m_audioregister) |
| 232 | { |
| 255 | 233 | case 0x00: |
| 256 | 234 | // hack |
| 257 | | l7a1045_voice *vptr = &m_voice[m_audiochannel]; |
| 235 | l7a1045_voice *vptr = &m_voice[m_audiochannel]; |
| 258 | 236 | |
| 259 | 237 | m_key |= 1 << m_audiochannel; |
| 260 | 238 | |
| 261 | 239 | vptr->frac = 0; |
| 262 | 240 | vptr->pos = 0; |
| 263 | 241 | |
| 264 | | vptr->start = (m_audiodat[0][m_audiochannel].dat[0] & 0x000f) << (16 + 4); |
| 265 | | vptr->start |= (m_audiodat[0][m_audiochannel].dat[1] & 0xffff) << (4); |
| 266 | | vptr->start |= (m_audiodat[0][m_audiochannel].dat[2] & 0xf000) >> (12); |
| 242 | vptr->start = (m_audiodat[0][m_audiochannel].dat[2] & 0x000f) << (16 + 4); |
| 243 | vptr->start |= (m_audiodat[0][m_audiochannel].dat[1] & 0xffff) << (4); |
| 244 | vptr->start |= (m_audiodat[0][m_audiochannel].dat[0] & 0xf000) >> (12); |
| 267 | 245 | |
| 268 | 246 | vptr->start &= m_rom_size - 1; |
| 269 | 247 | |
| 270 | 248 | //printf("%08x: REGISTER 00 write port 0x0002 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 271 | 249 | break; |
| 272 | 250 | } |
| 273 | | |
| 274 | 251 | } |
| 275 | | |
| 276 | | WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_04_w) // lower? word of various registers? |
| 277 | | { |
| 278 | | m_audiodat[m_audioregister][m_audiochannel].dat[1] = data; |
| 279 | | |
| 280 | | // write with registers 00, 04, 06, 05, 03, 07, 02, 01 on startup |
| 281 | | // groups writes of register 0a per channel |
| 282 | | |
| 283 | | // register 08 / 09 not written? |
| 284 | | |
| 285 | | switch (m_audioregister) |
| 286 | | { |
| 287 | | default: |
| 288 | | |
| 289 | | case 0x08: |
| 290 | | case 0x09: |
| 291 | | printf("%08x: unexpected write port 0x0004 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 292 | | break; |
| 293 | | |
| 294 | | // case 0x00: |
| 295 | | case 0x04: |
| 296 | | case 0x06: |
| 297 | | case 0x05: |
| 298 | | case 0x03: |
| 299 | | case 0x07: |
| 300 | | case 0x01: |
| 301 | | case 0x02: |
| 302 | | |
| 303 | | case 0x0a: |
| 304 | | //printf("%08x: write port 0x0004 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 305 | | break; |
| 306 | | |
| 307 | | case 0x00: |
| 308 | | //printf("%08x: REGISTER 00 write port 0x0004 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 309 | | break; |
| 310 | | } |
| 311 | | |
| 312 | 252 | } |
| 313 | | WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_06_w) // other part? of various registers.. less used than 02/04, maybe flags? |
| 314 | | { |
| 315 | | // 00 / 01 written at startup |
| 316 | | // nothing else used? |
| 317 | 253 | |
| 318 | | m_audiodat[m_audioregister][m_audiochannel].dat[0] = data; |
| 319 | | switch (m_audioregister) |
| 320 | | { |
| 321 | | default: |
| 322 | 254 | |
| 323 | | case 0x02: |
| 324 | | case 0x03: |
| 325 | | case 0x04: |
| 326 | | case 0x05: |
| 327 | | case 0x06: |
| 328 | | case 0x07: |
| 329 | | case 0x08: |
| 330 | | case 0x09: |
| 331 | | case 0x0a: |
| 332 | | printf("%08x: unexpected write port 0x0006 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 333 | | break; |
| 334 | | |
| 335 | | // case 0x00: |
| 336 | | case 0x01: |
| 337 | | //printf("%08x: unexpected write port 0x0006 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 338 | | break; |
| 339 | | |
| 340 | | case 0x00: |
| 341 | | |
| 342 | | // it writes 2 values here for each sample |
| 343 | | // the 2nd one seems to contain the upper 4 bits of the sample address |
| 344 | | // so why does it write different data first? |
| 345 | | //printf("%08x: REGISTER 00 write port 0x0006 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); |
| 346 | | break; |
| 347 | | |
| 348 | | } |
| 349 | | } |
| 350 | | |
| 351 | | |
| 352 | 255 | READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0004_r) |
| 353 | 256 | { |
| 354 | 257 | // it writes the channel select before reading this.. so either it works on channels, or the command.. |