Previous 199869 Revisions Next

r17777 Monday 10th September, 2012 at 11:54:04 UTC by hap
(UPD->uPD)
[src/emu/sound]upd7759.c

trunk/src/emu/sound/upd7759.c
r17776r17777
66
77    TODO:
88    - is there a doable method to dump the internal maskrom? :(
9      As far as we know, decapping is the only option
910    - low-level emulation
1011    - watchdog? - according to uPD775x datasheet, the chip goes into standy mode
1112      if CS/ST/RESET have not been accessed for more than 3 seconds
r17776r17777
1516
1617    uPD7759 Description:
1718
18    The UPD7759 is a speech processing LSI that utilizes ADPCM to produce
19    The uPD7759 is a speech processing LSI that utilizes ADPCM to produce
1920    speech or other sampled sounds.  It can directly address up to 1Mbit
2021    (128k) of external data ROM, or the host CPU can control the speech
21    data transfer.  The UPD7759 is usually hooked up to a 640 kHz clock and
22    data transfer.  The uPD7759 is usually hooked up to a 640 kHz clock and
2223    has one 8-bit input port, a start pin, a busy pin, and a clock output.
2324
2425    The chip is composed of 3 parts:
r17776r17777
6364    This allows the engine to be a little more adaptative than a
6465    classical ADPCM algorithm.
6566
66    The UPD7759 can run in two modes, master (also known as standalone)
67    The uPD7759 can run in two modes, master (also known as standalone)
6768    and slave.  The mode is selected through the "md" pin.  No known
6869    game changes modes on the fly, and it's unsure if that's even
6970    possible to do.
r17776r17777
8485    them by two gives the sample start offset in the rom.  A 0x00 marks
8586    the end of each sample.
8687
87    It seems that the UPD7759 reads at least part of the rom header at
88    It seems that the uPD7759 reads at least part of the rom header at
8889    startup.  Games doing rom banking are careful to reset the chip after
8990    each change.
9091
r17776r17777
111112    55G    24-pin SOP   96 Kbit ROM
112113    56C    18-pin DIP  256 Kbit ROM
113114    56G    24-pin SOP  256 Kbit ROM
114    P56CR  20-pin DIP  256 Kbit ROM (OTP)
115    P56G   24-pin SOP  256 Kbit ROM (OTP)
115    P56CR  20-pin DIP  256 Kbit ROM (OTP) - dumping the ROM is trivial
116    P56G   24-pin SOP  256 Kbit ROM (OTP) - "
116117    57C    18-pin DIP  512 Kbit ROM
117118    57G    24-pin SOP  512 Kbit ROM
118119    58C    18-pin DIP    1 Mbit ROM
r17776r17777
302303      /* Start state: we begin here as soon as a sample is triggered */
303304      case STATE_START:
304305         chip->req_sample = chip->rom ? chip->fifo_in : 0x10;
305         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: req_sample = %02X\n", chip->req_sample);
306         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: req_sample = %02X\n", chip->req_sample);
306307
307308         /* 35+ cycles after we get here, the /DRQ goes low
308309             *     (first byte (number of samples in ROM) should be sent in response)
r17776r17777
318319      /* First request state: issue a request for the first byte */
319320      /* The expected response will be the index of the last sample */
320321      case STATE_FIRST_REQ:
321         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: first data request\n");
322         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: first data request\n");
322323         chip->drq = 1;
323324
324325         /* 44 cycles later, we will latch this value and request another byte */
r17776r17777
330331      /* The second byte read will be just a dummy */
331332      case STATE_LAST_SAMPLE:
332333         chip->last_sample = chip->rom ? chip->rom[0] : chip->fifo_in;
333         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: last_sample = %02X, requesting dummy 1\n", chip->last_sample);
334         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: last_sample = %02X, requesting dummy 1\n", chip->last_sample);
334335         chip->drq = 1;
335336
336337         /* 28 cycles later, we will latch this value and request another byte */
r17776r17777
341342      /* First dummy state: ignore any data here and issue a request for the third byte */
342343      /* The expected response will be the MSB of the sample address */
343344      case STATE_DUMMY1:
344         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: dummy1, requesting offset_hi\n");
345         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: dummy1, requesting offset_hi\n");
345346         chip->drq = 1;
346347
347348         /* 32 cycles later, we will latch this value and request another byte */
r17776r17777
353354      /* The expected response will be the LSB of the sample address */
354355      case STATE_ADDR_MSB:
355356         chip->offset = (chip->rom ? chip->rom[chip->req_sample * 2 + 5] : chip->fifo_in) << (8 + chip->sample_offset_shift);
356         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_hi = %02X, requesting offset_lo\n", chip->offset >> (8 + chip->sample_offset_shift));
357         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: offset_hi = %02X, requesting offset_lo\n", chip->offset >> (8 + chip->sample_offset_shift));
357358         chip->drq = 1;
358359
359360         /* 44 cycles later, we will latch this value and request another byte */
r17776r17777
365366      /* The expected response will be just a dummy */
366367      case STATE_ADDR_LSB:
367368         chip->offset |= (chip->rom ? chip->rom[chip->req_sample * 2 + 6] : chip->fifo_in) << chip->sample_offset_shift;
368         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_lo = %02X, requesting dummy 2\n", (chip->offset >> chip->sample_offset_shift) & 0xff);
369         if (chip->offset > chip->rommask) logerror("upd7759 offset %X > rommask %X\n",chip->offset, chip->rommask);
369         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: offset_lo = %02X, requesting dummy 2\n", (chip->offset >> chip->sample_offset_shift) & 0xff);
370         if (chip->offset > chip->rommask) logerror("uPD7759 offset %X > rommask %X\n",chip->offset, chip->rommask);
370371         chip->drq = 1;
371372
372373         /* 36 cycles later, we will latch this value and request another byte */
r17776r17777
379380      case STATE_DUMMY2:
380381         chip->offset++;
381382         chip->first_valid_header = 0;
382         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: dummy2, requesting block header\n");
383         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: dummy2, requesting block header\n");
383384         chip->drq = 1;
384385
385386         /* 36?? cycles later, we will latch this value and request another byte */
r17776r17777
397398            chip->offset = chip->repeat_offset;
398399         }
399400         chip->block_header = chip->rom ? chip->rom[chip->offset++ & chip->rommask] : chip->fifo_in;
400         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: header (@%05X) = %02X, requesting next byte\n", chip->offset, chip->block_header);
401         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: header (@%05X) = %02X, requesting next byte\n", chip->offset, chip->block_header);
401402         chip->drq = 1;
402403
403404         /* our next step depends on the top two bits */
r17776r17777
440441      /* The expected response will be the first data byte */
441442      case STATE_NIBBLE_COUNT:
442443         chip->nibbles_left = (chip->rom ? chip->rom[chip->offset++ & chip->rommask] : chip->fifo_in) + 1;
443         if (DEBUG_STATES) DEBUG_METHOD("UPD7759: nibble_count = %u, requesting next byte\n", (unsigned)chip->nibbles_left);
444         if (DEBUG_STATES) DEBUG_METHOD("uPD7759: nibble_count = %u, requesting next byte\n", (unsigned)chip->nibbles_left);
444445         chip->drq = 1;
445446
446447         /* 36?? cycles later, we will latch this value and request another byte */
r17776r17777
788789const device_type UPD7759 = &device_creator<upd7759_device>;
789790
790791upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
791   : device_t(mconfig, UPD7759, "UPD7759", tag, owner, clock),
792   : device_t(mconfig, UPD7759, "uPD7759", tag, owner, clock),
792793     device_sound_interface(mconfig, *this)
793794{
794795   m_token = global_alloc_array_clear(UINT8, sizeof(upd7759_state));
r17776r17777
842843const device_type UPD7756 = &device_creator<upd7756_device>;
843844
844845upd7756_device::upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
845   : upd7759_device(mconfig, UPD7756, "UPD7756", tag, owner, clock)
846   : upd7759_device(mconfig, UPD7756, "uPD7756", tag, owner, clock)
846847{
847848}
848849

Previous 199869 Revisions Next


© 1997-2024 The MAME Team