Previous 199869 Revisions Next

r32951 Saturday 25th October, 2014 at 15:13:15 UTC by Carl
fix line endings, hopefully (nw)
[src/emu/cpu/powerpc]ppc.h ppccom.c
[src/mame/drivers]cobra.c firebeat.c hornet.c

trunk/src/emu/cpu/powerpc/ppc.h
r241462r241463
159159#define PPCDRC_COMPATIBLE_OPTIONS   (PPCDRC_STRICT_VERIFY | PPCDRC_FLUSH_PC | PPCDRC_ACCURATE_SINGLES)
160160#define PPCDRC_FASTEST_OPTIONS      (0)
161161
162 
163 
164/***************************************************************************
165    PUBLIC FUNCTIONS
166***************************************************************************/
167 
162
163
164/***************************************************************************
165    PUBLIC FUNCTIONS
166***************************************************************************/
167
168168#define MCFG_PPC_BUS_FREQUENCY(_frequency) \
169169   ppc_device::set_bus_frequency(*device, _frequency);
170170
r241462r241463
213213public:
214214   // construction/destruction
215215   ppc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, int address_bits, int data_bits, powerpc_flavor flavor, UINT32 cap, UINT32 tb_divisor, address_map_constructor internal_map);
216 
217   static void set_bus_frequency(device_t &device, UINT32 bus_frequency) { downcast<ppc_device &>(device).c_bus_frequency = bus_frequency; }
218 
219   void ppc_set_dcstore_callback(write32_delegate callback);
220   
221   void ppcdrc_set_options(UINT32 options);
222   void ppcdrc_add_fastram(offs_t start, offs_t end, UINT8 readonly, void *base);
223   void ppcdrc_add_hotspot(offs_t pc, UINT32 opcode, UINT32 cycles);
224216
217   static void set_bus_frequency(device_t &device, UINT32 bus_frequency) { downcast<ppc_device &>(device).c_bus_frequency = bus_frequency; }
218
219   void ppc_set_dcstore_callback(write32_delegate callback);
220   
221   void ppcdrc_set_options(UINT32 options);
222   void ppcdrc_add_fastram(offs_t start, offs_t end, UINT8 readonly, void *base);
223   void ppcdrc_add_hotspot(offs_t pc, UINT32 opcode, UINT32 cycles);
224
225225   TIMER_CALLBACK_MEMBER(decrementer_int_callback);
226226   TIMER_CALLBACK_MEMBER(ppc4xx_buffered_dma_callback);
227227   TIMER_CALLBACK_MEMBER(ppc4xx_fit_callback);
r241462r241463
479479      UINT8           regs[9];
480480      UINT8           txbuf;
481481      UINT8           rxbuf;
482      emu_timer *     timer;
483      UINT8           rxbuffer[256];
484      UINT32          rxin, rxout;
485      write8_delegate tx_cb;
486   };
487 
488   ppc4xx_spu_state m_spu;
482      emu_timer *     timer;
483      UINT8           rxbuffer[256];
484      UINT32          rxin, rxout;
485      write8_delegate tx_cb;
486   };
487
488   ppc4xx_spu_state m_spu;
489489   emu_timer *     m_fit_timer;
490490   emu_timer *     m_pit_timer;
491491   emu_timer *     m_wdog_timer;
r241462r241463
503503   UINT64          m_dec_zero_cycles;
504504   emu_timer *     m_decrementer_int_timer;
505505
506   read32_delegate  m_dcr_read_func;
507   write32_delegate m_dcr_write_func;
508 
509   write32_delegate m_dcstore_cb;
510 
511   read32_delegate m_ext_dma_read_cb[4];
512   write32_delegate m_ext_dma_write_cb[4];
513 
514   /* PowerPC function pointers for memory accesses/exceptions */
515   jmp_buf m_exception_jmpbuf;
506   read32_delegate  m_dcr_read_func;
507   write32_delegate m_dcr_write_func;
508
509   write32_delegate m_dcstore_cb;
510
511   read32_delegate m_ext_dma_read_cb[4];
512   write32_delegate m_ext_dma_write_cb[4];
513
514   /* PowerPC function pointers for memory accesses/exceptions */
515   jmp_buf m_exception_jmpbuf;
516516   UINT8 (*m_ppcread8)(address_space &space, offs_t address);
517517   UINT16 (*m_ppcread16)(address_space &space, offs_t address);
518518   UINT32 (*m_ppcread32)(address_space &space, offs_t address);
r241462r241463
751751
752752class ppc4xx_device : public ppc_device
753753{
754public:
755   ppc4xx_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, powerpc_flavor flavor, UINT32 cap, UINT32 tb_divisor);
756 
757   void ppc4xx_spu_set_tx_handler(write8_delegate callback);
758   void ppc4xx_spu_receive_byte(UINT8 byteval);
759 
760   void ppc4xx_set_dma_read_handler(int channel, read32_delegate callback, int rate);
761   void ppc4xx_set_dma_write_handler(int channel, write32_delegate callback, int rate);
762   void ppc4xx_set_dcr_read_handler(read32_delegate dcr_read_func);
763   void ppc4xx_set_dcr_write_handler(write32_delegate dcr_write_func);
764 
754public:
755   ppc4xx_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, powerpc_flavor flavor, UINT32 cap, UINT32 tb_divisor);
756
757   void ppc4xx_spu_set_tx_handler(write8_delegate callback);
758   void ppc4xx_spu_receive_byte(UINT8 byteval);
759
760   void ppc4xx_set_dma_read_handler(int channel, read32_delegate callback, int rate);
761   void ppc4xx_set_dma_write_handler(int channel, write32_delegate callback, int rate);
762   void ppc4xx_set_dcr_read_handler(read32_delegate dcr_read_func);
763   void ppc4xx_set_dcr_write_handler(write32_delegate dcr_write_func);
764
765765   DECLARE_READ8_MEMBER( ppc4xx_spu_r );
766766   DECLARE_WRITE8_MEMBER( ppc4xx_spu_w );
767767
trunk/src/emu/cpu/powerpc/ppccom.c
r241462r241463
214214   , m_core(NULL)
215215   , m_bus_freq_multiplier(1)
216216   , m_vtlb(NULL)
217   , m_flavor(flavor)
218   , m_cap(cap)
219   , m_tb_divisor(tb_divisor)
220   , m_cache(CACHE_SIZE + sizeof(internal_ppc_state))
221   , m_drcuml(NULL)
222   , m_drcfe(NULL)
217   , m_flavor(flavor)
218   , m_cap(cap)
219   , m_tb_divisor(tb_divisor)
220   , m_cache(CACHE_SIZE + sizeof(internal_ppc_state))
221   , m_drcuml(NULL)
222   , m_drcfe(NULL)
223223   , m_drcoptions(0)
224{
225   m_program_config.m_logaddr_width = 32;
226   m_program_config.m_page_shift = POWERPC_MIN_PAGE_SHIFT;
227}
228 
229//ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
224{
225   m_program_config.m_logaddr_width = 32;
226   m_program_config.m_page_shift = POWERPC_MIN_PAGE_SHIFT;
227}
228
229//ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
230230//  : ppc_device(mconfig, PPC403, "PPC403", tag, owner, clock, "ppc403", 32?, 64?)
231231//{
232232//}
r241462r241463
12381238    ppccom_dcstore_callback - call the dcstore
12391239    callback if installed
12401240-------------------------------------------------*/
1241 
1242void ppc_device::ppccom_dcstore_callback()
1243{
1244   if (!m_dcstore_cb.isnull())
1245   {
1246      m_dcstore_cb(*m_program, m_core->param0, 0, 0xffffffff);
1247   }
1248}
1249 
12501241
1242void ppc_device::ppccom_dcstore_callback()
1243{
1244   if (!m_dcstore_cb.isnull())
1245   {
1246      m_dcstore_cb(*m_program, m_core->param0, 0, 0xffffffff);
1247   }
1248}
1249
1250
12511251/***************************************************************************
12521252    TLB HANDLING
12531253***************************************************************************/
r241462r241463
20582058
20592059/*-------------------------------------------------
20602060    ppc_set_dcstore_callback - installs a callback
2061    for detecting datacache stores with dcbst
2062-------------------------------------------------*/
2063 
2064void ppc_device::ppc_set_dcstore_callback(write32_delegate callback)
2065{
2066   m_dcstore_cb = callback;
2067}
2068 
2069 
2061    for detecting datacache stores with dcbst
2062-------------------------------------------------*/
2063
2064void ppc_device::ppc_set_dcstore_callback(write32_delegate callback)
2065{
2066   m_dcstore_cb = callback;
2067}
2068
2069
20702070void ppc_device::execute_set_input(int inputnum, int state)
20712071{
20722072   switch (inputnum)
r241462r241463
22852285      {
22862286         /* byte transfer */
22872287         case 1:
2288         do
2289         {
2290            UINT8 data = 0;
2291            if (!m_ext_dma_read_cb[dmachan].isnull())
2292               data = (m_ext_dma_read_cb[dmachan])(*m_program, 1, 0xffffffff);
2293            m_program->write_byte(dmaregs[DCR4XX_DMADA0], data);
2294            dmaregs[DCR4XX_DMADA0] += destinc;
2295         } while (!ppc4xx_dma_decrement_count(dmachan));
2288         do
2289         {
2290            UINT8 data = 0;
2291            if (!m_ext_dma_read_cb[dmachan].isnull())
2292               data = (m_ext_dma_read_cb[dmachan])(*m_program, 1, 0xffffffff);
2293            m_program->write_byte(dmaregs[DCR4XX_DMADA0], data);
2294            dmaregs[DCR4XX_DMADA0] += destinc;
2295         } while (!ppc4xx_dma_decrement_count(dmachan));
22962296         break;
22972297
22982298         /* word transfer */
22992299         case 2:
2300         do
2301         {
2302            UINT16 data = 0;
2303            if (!m_ext_dma_read_cb[dmachan].isnull())
2304               data = (m_ext_dma_read_cb[dmachan])(*m_program, 2, 0xffffffff);
2305            m_program->write_word(dmaregs[DCR4XX_DMADA0], data);
2306            dmaregs[DCR4XX_DMADA0] += destinc;
2307         } while (!ppc4xx_dma_decrement_count(dmachan));
2300         do
2301         {
2302            UINT16 data = 0;
2303            if (!m_ext_dma_read_cb[dmachan].isnull())
2304               data = (m_ext_dma_read_cb[dmachan])(*m_program, 2, 0xffffffff);
2305            m_program->write_word(dmaregs[DCR4XX_DMADA0], data);
2306            dmaregs[DCR4XX_DMADA0] += destinc;
2307         } while (!ppc4xx_dma_decrement_count(dmachan));
23082308         break;
23092309
23102310         /* dword transfer */
23112311         case 4:
2312         do
2313         {
2314            UINT32 data = 0;
2315            if (!m_ext_dma_read_cb[dmachan].isnull())
2316               data = (m_ext_dma_read_cb[dmachan])(*m_program, 4, 0xffffffff);
2317            m_program->write_dword(dmaregs[DCR4XX_DMADA0], data);
2318            dmaregs[DCR4XX_DMADA0] += destinc;
2319         } while (!ppc4xx_dma_decrement_count(dmachan));
2312         do
2313         {
2314            UINT32 data = 0;
2315            if (!m_ext_dma_read_cb[dmachan].isnull())
2316               data = (m_ext_dma_read_cb[dmachan])(*m_program, 4, 0xffffffff);
2317            m_program->write_dword(dmaregs[DCR4XX_DMADA0], data);
2318            dmaregs[DCR4XX_DMADA0] += destinc;
2319         } while (!ppc4xx_dma_decrement_count(dmachan));
23202320         break;
23212321      }
23222322   }
r241462r241463
23292329      {
23302330         /* byte transfer */
23312331         case 1:
2332         do
2333         {
2334            UINT8 data = m_program->read_byte(dmaregs[DCR4XX_DMADA0]);
2335            if (!m_ext_dma_write_cb[dmachan].isnull())
2336               (m_ext_dma_write_cb[dmachan])(*m_program, 1, data, 0xffffffff);
2337            dmaregs[DCR4XX_DMADA0] += destinc;
2338         } while (!ppc4xx_dma_decrement_count(dmachan));
2339         break;
2332         do
2333         {
2334            UINT8 data = m_program->read_byte(dmaregs[DCR4XX_DMADA0]);
2335            if (!m_ext_dma_write_cb[dmachan].isnull())
2336               (m_ext_dma_write_cb[dmachan])(*m_program, 1, data, 0xffffffff);
2337            dmaregs[DCR4XX_DMADA0] += destinc;
2338         } while (!ppc4xx_dma_decrement_count(dmachan));
2339         break;
23402340
23412341         /* word transfer */
23422342         case 2:
2343         do
2344         {
2345            UINT16 data = m_program->read_word(dmaregs[DCR4XX_DMADA0]);
2346            if (!m_ext_dma_write_cb[dmachan].isnull())
2347               (m_ext_dma_write_cb[dmachan])(*m_program, 2, data, 0xffffffff);
2348            dmaregs[DCR4XX_DMADA0] += destinc;
2349         } while (!ppc4xx_dma_decrement_count(dmachan));
2350         break;
2343         do
2344         {
2345            UINT16 data = m_program->read_word(dmaregs[DCR4XX_DMADA0]);
2346            if (!m_ext_dma_write_cb[dmachan].isnull())
2347               (m_ext_dma_write_cb[dmachan])(*m_program, 2, data, 0xffffffff);
2348            dmaregs[DCR4XX_DMADA0] += destinc;
2349         } while (!ppc4xx_dma_decrement_count(dmachan));
2350         break;
23512351
23522352         /* dword transfer */
23532353         case 4:
2354         do
2355         {
2356            UINT32 data = m_program->read_dword(dmaregs[DCR4XX_DMADA0]);
2357            if (!m_ext_dma_write_cb[dmachan].isnull())
2358               (m_ext_dma_write_cb[dmachan])(*m_program, 4, data, 0xffffffff);
2359            dmaregs[DCR4XX_DMADA0] += destinc;
2360         } while (!ppc4xx_dma_decrement_count(dmachan));
2361         break;
2354         do
2355         {
2356            UINT32 data = m_program->read_dword(dmaregs[DCR4XX_DMADA0]);
2357            if (!m_ext_dma_write_cb[dmachan].isnull())
2358               (m_ext_dma_write_cb[dmachan])(*m_program, 4, data, 0xffffffff);
2359            dmaregs[DCR4XX_DMADA0] += destinc;
2360         } while (!ppc4xx_dma_decrement_count(dmachan));
2361         break;
23622362      }
23632363   }
23642364}
r241462r241463
26742674      int operation = (m_spu.regs[SPU4XX_TX_COMMAND] >> 5) & 3;
26752675
26762676      /* if we have data to transmit, do it now */
2677      if (!(m_spu.regs[SPU4XX_LINE_STATUS] & 0x04))
2678      {
2679         /* if we have a transmit handler, send it that way */
2680         if (!m_spu.tx_cb.isnull())
2681            (m_spu.tx_cb)(*m_program, 0, m_spu.txbuf, 0xff);
2682 
2683         /* indicate that we have moved it to the shift register */
2684         m_spu.regs[SPU4XX_LINE_STATUS] |= 0x04;
2677      if (!(m_spu.regs[SPU4XX_LINE_STATUS] & 0x04))
2678      {
2679         /* if we have a transmit handler, send it that way */
2680         if (!m_spu.tx_cb.isnull())
2681            (m_spu.tx_cb)(*m_program, 0, m_spu.txbuf, 0xff);
2682
2683         /* indicate that we have moved it to the shift register */
2684         m_spu.regs[SPU4XX_LINE_STATUS] |= 0x04;
26852685         m_spu.regs[SPU4XX_LINE_STATUS] &= ~0x02;
26862686      }
26872687
r241462r241463
28202820
28212821/*-------------------------------------------------
28222822    ppc4xx_spu_set_tx_handler - PowerPC 4XX-
2823    specific TX handler configuration
2824-------------------------------------------------*/
2825 
2826void ppc4xx_device::ppc4xx_spu_set_tx_handler(write8_delegate callback)
2827{
2828   m_spu.tx_cb = callback;
2829}
2830 
2831 
2823    specific TX handler configuration
2824-------------------------------------------------*/
2825
2826void ppc4xx_device::ppc4xx_spu_set_tx_handler(write8_delegate callback)
2827{
2828   m_spu.tx_cb = callback;
2829}
2830
2831
28322832/*-------------------------------------------------
28332833    ppc4xx_spu_receive_byte - PowerPC 4XX-
28342834    specific serial byte receive
r241462r241463
28412841
28422842/*-------------------------------------------------
28432843    ppc4xx_set_dma_read_handler - PowerPC 4XX-
2844    specific external DMA read handler configuration
2845-------------------------------------------------*/
2846 
2847void ppc4xx_device::ppc4xx_set_dma_read_handler(int channel, read32_delegate callback, int rate)
2848{
2849   m_ext_dma_read_cb[channel] = callback;
2850   m_buffered_dma_rate[channel] = rate;
2851}
2852 
2844    specific external DMA read handler configuration
2845-------------------------------------------------*/
2846
2847void ppc4xx_device::ppc4xx_set_dma_read_handler(int channel, read32_delegate callback, int rate)
2848{
2849   m_ext_dma_read_cb[channel] = callback;
2850   m_buffered_dma_rate[channel] = rate;
2851}
2852
28532853/*-------------------------------------------------
28542854    ppc4xx_set_dma_write_handler - PowerPC 4XX-
2855    specific external DMA write handler configuration
2856-------------------------------------------------*/
2857 
2858void ppc4xx_device::ppc4xx_set_dma_write_handler(int channel, write32_delegate callback, int rate)
2859{
2860   m_ext_dma_write_cb[channel] = callback;
2861   m_buffered_dma_rate[channel] = rate;
2862}
2863 
2855    specific external DMA write handler configuration
2856-------------------------------------------------*/
2857
2858void ppc4xx_device::ppc4xx_set_dma_write_handler(int channel, write32_delegate callback, int rate)
2859{
2860   m_ext_dma_write_cb[channel] = callback;
2861   m_buffered_dma_rate[channel] = rate;
2862}
2863
28642864/*-------------------------------------------------
28652865    ppc4xx_set_dcr_read_handler
28662866-------------------------------------------------*/
trunk/src/mame/drivers/cobra.c
r241462r241463
630630   DECLARE_READ64_MEMBER(main_comram_r);
631631   DECLARE_WRITE64_MEMBER(main_comram_w);
632632   DECLARE_READ64_MEMBER(main_fifo_r);
633   DECLARE_WRITE64_MEMBER(main_fifo_w);
634   DECLARE_READ64_MEMBER(main_mpc106_r);
635   DECLARE_WRITE64_MEMBER(main_mpc106_w);
636   DECLARE_WRITE32_MEMBER(main_cpu_dc_store);
637   
638   DECLARE_READ32_MEMBER(sub_comram_r);
639   DECLARE_WRITE32_MEMBER(sub_comram_w);
640   DECLARE_READ32_MEMBER(sub_sound_r);
633   DECLARE_WRITE64_MEMBER(main_fifo_w);
634   DECLARE_READ64_MEMBER(main_mpc106_r);
635   DECLARE_WRITE64_MEMBER(main_mpc106_w);
636   DECLARE_WRITE32_MEMBER(main_cpu_dc_store);
637   
638   DECLARE_READ32_MEMBER(sub_comram_r);
639   DECLARE_WRITE32_MEMBER(sub_comram_w);
640   DECLARE_READ32_MEMBER(sub_sound_r);
641641   DECLARE_WRITE32_MEMBER(sub_sound_w);
642642   DECLARE_READ32_MEMBER(sub_unk7e_r);
643643   DECLARE_WRITE32_MEMBER(sub_debug_w);
r241462r241463
651651   DECLARE_WRITE16_MEMBER(sub_ata0_w);
652652   DECLARE_READ16_MEMBER(sub_ata1_r);
653653   DECLARE_WRITE16_MEMBER(sub_ata1_w);
654   DECLARE_READ32_MEMBER(sub_psac2_r);
655   DECLARE_WRITE32_MEMBER(sub_psac2_w);
656   DECLARE_WRITE32_MEMBER(sub_psac_palette_w);
657   DECLARE_WRITE32_MEMBER(sub_sound_dma_w);
658 
659   DECLARE_WRITE64_MEMBER(gfx_fifo0_w);
660   DECLARE_WRITE64_MEMBER(gfx_fifo1_w);
654   DECLARE_READ32_MEMBER(sub_psac2_r);
655   DECLARE_WRITE32_MEMBER(sub_psac2_w);
656   DECLARE_WRITE32_MEMBER(sub_psac_palette_w);
657   DECLARE_WRITE32_MEMBER(sub_sound_dma_w);
658
659   DECLARE_WRITE64_MEMBER(gfx_fifo0_w);
660   DECLARE_WRITE64_MEMBER(gfx_fifo1_w);
661661   DECLARE_WRITE64_MEMBER(gfx_fifo2_w);
662662   DECLARE_WRITE64_MEMBER(gfx_debug_state_w);
663663   DECLARE_READ64_MEMBER(gfx_unk1_r);
664   DECLARE_WRITE64_MEMBER(gfx_unk1_w);
665   DECLARE_READ64_MEMBER(gfx_fifo_r);
666   DECLARE_WRITE64_MEMBER(gfx_buf_w);
667   DECLARE_WRITE32_MEMBER(gfx_cpu_dc_store);
668   
669   DECLARE_WRITE8_MEMBER(sub_jvs_w);
670 
671   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
672 
664   DECLARE_WRITE64_MEMBER(gfx_unk1_w);
665   DECLARE_READ64_MEMBER(gfx_fifo_r);
666   DECLARE_WRITE64_MEMBER(gfx_buf_w);
667   DECLARE_WRITE32_MEMBER(gfx_cpu_dc_store);
668   
669   DECLARE_WRITE8_MEMBER(sub_jvs_w);
670
671   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
672
673673   cobra_renderer *m_renderer;
674674
675675   cobra_fifo *m_gfxfifo_in;
r241462r241463
16011601   UINT32 m2 = (UINT32)(mem_mask);
16021602
16031603   m_comram[page][(offset << 1) + 0] = (w1 & ~m1) | (d1 & m1);
1604   m_comram[page][(offset << 1) + 1] = (w2 & ~m2) | (d2 & m2);
1605}
1606 
1607WRITE32_MEMBER(cobra_state::main_cpu_dc_store)
1608{
1609   if ((offset & 0xf0000000) == 0xc0000000)
1610   {
1611      // force sync when writing to GFX board main ram
1612      m_maincpu->spin_until_time(attotime::from_usec(80));
1613   }
1614}
1615 
1604   m_comram[page][(offset << 1) + 1] = (w2 & ~m2) | (d2 & m2);
1605}
1606
1607WRITE32_MEMBER(cobra_state::main_cpu_dc_store)
1608{
1609   if ((offset & 0xf0000000) == 0xc0000000)
1610   {
1611      // force sync when writing to GFX board main ram
1612      m_maincpu->spin_until_time(attotime::from_usec(80));
1613   }
1614}
1615
16161616static ADDRESS_MAP_START( cobra_main_map, AS_PROGRAM, 64, cobra_state )
16171617   AM_RANGE(0x00000000, 0x003fffff) AM_RAM
16181618   AM_RANGE(0x07c00000, 0x07ffffff) AM_RAM
r241462r241463
18881888}
18891889
18901890WRITE32_MEMBER(cobra_state::sub_psac2_w)
1891{
1892}
1893 
1894WRITE32_MEMBER(cobra_state::sub_sound_dma_w)
1895{
1896   //printf("DMA write to unknown: size %d, data %08X\n", address, data);
1897 
1898   /*
1899   static FILE *out;
1891{
1892}
1893
1894WRITE32_MEMBER(cobra_state::sub_sound_dma_w)
1895{
1896   //printf("DMA write to unknown: size %d, data %08X\n", address, data);
1897
1898   /*
1899   static FILE *out;
19001900   if (out == NULL)
19011901       out = fopen("sound.bin", "wb");
19021902
19031903   fputc((data >> 24) & 0xff, out);
19041904   fputc((data >> 16) & 0xff, out);
19051905   fputc((data >> 8) & 0xff, out);
1906   fputc((data >> 0) & 0xff, out);
1907   */
1908 
1909   INT16 ldata = (INT16)(data >> 16);
1910   INT16 rdata = (INT16)(data);
1911 
1912   m_sound_dma_buffer_l[m_sound_dma_ptr] = ldata;
1913   m_sound_dma_buffer_r[m_sound_dma_ptr] = rdata;
1914   m_sound_dma_ptr++;
1915 
1916   if (m_sound_dma_ptr >= DMA_SOUND_BUFFER_SIZE)
1917   {
1918      m_sound_dma_ptr = 0;
1919 
1920      dmadac_transfer(&m_dmadac[0], 1, 0, 1, DMA_SOUND_BUFFER_SIZE, m_sound_dma_buffer_l);
1921      dmadac_transfer(&m_dmadac[1], 1, 0, 1, DMA_SOUND_BUFFER_SIZE, m_sound_dma_buffer_r);
1922   }
1923}
1924 
1925WRITE8_MEMBER(cobra_state::sub_jvs_w)
1926{
1927   cobra_jvs_host *jvs = machine().device<cobra_jvs_host>("cobra_jvs_host");
1928 
1929#if LOG_JVS
1930   printf("sub_jvs_w: %02X\n", data);
1906   fputc((data >> 0) & 0xff, out);
1907   */
1908
1909   INT16 ldata = (INT16)(data >> 16);
1910   INT16 rdata = (INT16)(data);
1911
1912   m_sound_dma_buffer_l[m_sound_dma_ptr] = ldata;
1913   m_sound_dma_buffer_r[m_sound_dma_ptr] = rdata;
1914   m_sound_dma_ptr++;
1915
1916   if (m_sound_dma_ptr >= DMA_SOUND_BUFFER_SIZE)
1917   {
1918      m_sound_dma_ptr = 0;
1919
1920      dmadac_transfer(&m_dmadac[0], 1, 0, 1, DMA_SOUND_BUFFER_SIZE, m_sound_dma_buffer_l);
1921      dmadac_transfer(&m_dmadac[1], 1, 0, 1, DMA_SOUND_BUFFER_SIZE, m_sound_dma_buffer_r);
1922   }
1923}
1924
1925WRITE8_MEMBER(cobra_state::sub_jvs_w)
1926{
1927   cobra_jvs_host *jvs = machine().device<cobra_jvs_host>("cobra_jvs_host");
1928
1929#if LOG_JVS
1930   printf("sub_jvs_w: %02X\n", data);
19311931#endif
19321932
19331933   const UINT8 *rec_data;
r241462r241463
19451945      }
19461946      printf("\n");
19471947#endif
1948 
1949      for (int i=0; i < rec_size; i++)
1950      {
1951         m_subcpu->ppc4xx_spu_receive_byte(rec_data[i]);
1952      }
1953   }
1954}
19551948
1949      for (int i=0; i < rec_size; i++)
1950      {
1951         m_subcpu->ppc4xx_spu_receive_byte(rec_data[i]);
1952      }
1953   }
1954}
1955
19561956static ADDRESS_MAP_START( cobra_sub_map, AS_PROGRAM, 32, cobra_state )
19571957   AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x80000000) AM_RAM                                           // Main RAM
19581958   AM_RANGE(0x70000000, 0x7003ffff) AM_MIRROR(0x80000000) AM_READWRITE(sub_comram_r, sub_comram_w)         // Double buffered shared RAM between Main and Sub
r241462r241463
29882988      // prc_read always expects a value...
29892989
29902990      m_gfxfifo_out->push(&space.device(), 0);
2991   }
2992}
2993 
2994WRITE32_MEMBER(cobra_state::gfx_cpu_dc_store)
2995{
2996   UINT32 addr = offset >> 24;
2997   if (addr == 0x10 || addr == 0x18 || addr == 0x1e)
2998   {
2999      UINT64 i = (UINT64)(m_gfx_fifo_cache_addr) << 32;
3000      cobra_fifo *fifo_in = m_gfxfifo_in;
3001 
3002      UINT32 a = (offset / 8) & 0xff;
3003 
3004      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+0] >> 32) | i);
3005      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+0] >>  0) | i);
3006      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+1] >> 32) | i);
3007      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+1] >>  0) | i);
3008      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+2] >> 32) | i);
3009      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+2] >>  0) | i);
3010      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+3] >> 32) | i);
3011      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+3] >>  0) | i);
3012 
3013      m_renderer->gfx_fifo_exec();
3014   }
3015   else
3016   {
3017      logerror("gfx: data cache store at %08X\n", offset);
3018   }
3019}
3020 
2991   }
2992}
2993
2994WRITE32_MEMBER(cobra_state::gfx_cpu_dc_store)
2995{
2996   UINT32 addr = offset >> 24;
2997   if (addr == 0x10 || addr == 0x18 || addr == 0x1e)
2998   {
2999      UINT64 i = (UINT64)(m_gfx_fifo_cache_addr) << 32;
3000      cobra_fifo *fifo_in = m_gfxfifo_in;
3001
3002      UINT32 a = (offset / 8) & 0xff;
3003
3004      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+0] >> 32) | i);
3005      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+0] >>  0) | i);
3006      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+1] >> 32) | i);
3007      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+1] >>  0) | i);
3008      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+2] >> 32) | i);
3009      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+2] >>  0) | i);
3010      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+3] >> 32) | i);
3011      fifo_in->push(&space.device(), (UINT32)(m_gfx_fifo_mem[a+3] >>  0) | i);
3012
3013      m_renderer->gfx_fifo_exec();
3014   }
3015   else
3016   {
3017      logerror("gfx: data cache store at %08X\n", offset);
3018   }
3019}
3020
30213021WRITE64_MEMBER(cobra_state::gfx_debug_state_w)
30223022{
30233023   if (ACCESSING_BITS_40_47)
r241462r241463
32583258                        2048,
32593259                        "S2MFIFO",
32603260                        S2MFIFO_VERBOSE != 0,
3261                        cobra_fifo::event_delegate(FUNC(cobra_state::s2mfifo_event_callback), this))
3262                        );
3263 
3264   m_maincpu->ppc_set_dcstore_callback(write32_delegate(FUNC(cobra_state::main_cpu_dc_store),this));
3265 
3266   m_gfxcpu->ppc_set_dcstore_callback(write32_delegate(FUNC(cobra_state::gfx_cpu_dc_store), this));
3267 
3268   m_subcpu->ppc4xx_set_dma_write_handler(0, write32_delegate(FUNC(cobra_state::sub_sound_dma_w), this), 44100);
3269   m_subcpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(cobra_state::sub_jvs_w), this));
3270 
3271 
3272   m_comram[0] = auto_alloc_array(machine(), UINT32, 0x40000/4);
3261                        cobra_fifo::event_delegate(FUNC(cobra_state::s2mfifo_event_callback), this))
3262                        );
3263
3264   m_maincpu->ppc_set_dcstore_callback(write32_delegate(FUNC(cobra_state::main_cpu_dc_store),this));
3265
3266   m_gfxcpu->ppc_set_dcstore_callback(write32_delegate(FUNC(cobra_state::gfx_cpu_dc_store), this));
3267
3268   m_subcpu->ppc4xx_set_dma_write_handler(0, write32_delegate(FUNC(cobra_state::sub_sound_dma_w), this), 44100);
3269   m_subcpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(cobra_state::sub_jvs_w), this));
3270
3271
3272   m_comram[0] = auto_alloc_array(machine(), UINT32, 0x40000/4);
32733273   m_comram[1] = auto_alloc_array(machine(), UINT32, 0x40000/4);
32743274
32753275   m_comram_page = 0;
trunk/src/mame/drivers/firebeat.c
r241462r241463
256256   void gcu_exec_display_list(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 address);
257257   UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip);
258258   UINT32 GCU_r(int chip, UINT32 offset, UINT32 mem_mask);
259   void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask);
260   void set_ibutton(UINT8 *data);
261   int ibutton_w(UINT8 data);
262   DECLARE_WRITE8_MEMBER(security_w);
263   void init_lights(write32_delegate out1, write32_delegate out2, write32_delegate out3);
264   void init_firebeat();
265   void init_keyboard();
259   void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask);
260   void set_ibutton(UINT8 *data);
261   int ibutton_w(UINT8 data);
262   DECLARE_WRITE8_MEMBER(security_w);
263   void init_lights(write32_delegate out1, write32_delegate out2, write32_delegate out3);
264   void init_firebeat();
265   void init_keyboard();
266266   DECLARE_WRITE_LINE_MEMBER(sound_irq_callback);
267267   DECLARE_WRITE_LINE_MEMBER(midi_uart_ch0_irq_callback);
268268   DECLARE_WRITE_LINE_MEMBER(midi_uart_ch1_irq_callback);
r241462r241463
19471947      }
19481948   }
19491949
1950   return r;
1951}
1952 
1953WRITE8_MEMBER(firebeat_state::security_w)
1954{
1955   int r = ibutton_w(data);
1956   if (r >= 0)
1957      m_maincpu->ppc4xx_spu_receive_byte(r);
1958}
1959 
1960/*****************************************************************************/
1950   return r;
1951}
19611952
1953WRITE8_MEMBER(firebeat_state::security_w)
1954{
1955   int r = ibutton_w(data);
1956   if (r >= 0)
1957      m_maincpu->ppc4xx_spu_receive_byte(r);
1958}
1959
1960/*****************************************************************************/
1961
19621962void firebeat_state::init_lights(write32_delegate out1, write32_delegate out2, write32_delegate out3)
19631963{
19641964   if(out1.isnull()) out1 = write32_delegate(FUNC(firebeat_state::lamp_output_w),this);
r241462r241463
19791979
19801980   m_extend_board_irq_enable = 0x3f;
19811981   m_extend_board_irq_active = 0x00;
1982 
1983   m_cur_cab_data = cab_data;
1984 
1985   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(firebeat_state::security_w), this));
1986 
1987   set_ibutton(rom);
1988 
1982
1983   m_cur_cab_data = cab_data;
1984
1985   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(firebeat_state::security_w), this));
1986
1987   set_ibutton(rom);
1988
19891989   init_lights(write32_delegate(), write32_delegate(), write32_delegate());
19901990}
19911991
trunk/src/mame/drivers/hornet.c
r241462r241463
402402   DECLARE_WRITE32_MEMBER(dsp_dataram1_w);
403403   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
404404   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
405   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
406   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
407   ADC12138_IPT_CONVERT_CB(adc12138_input_callback);
408   DECLARE_WRITE8_MEMBER(jamma_jvs_w);
409 
410   DECLARE_DRIVER_INIT(hornet);
411   DECLARE_DRIVER_INIT(hornet_2board);
405   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
406   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
407   ADC12138_IPT_CONVERT_CB(adc12138_input_callback);
408   DECLARE_WRITE8_MEMBER(jamma_jvs_w);
409
410   DECLARE_DRIVER_INIT(hornet);
411   DECLARE_DRIVER_INIT(hornet_2board);
412412   virtual void machine_start();
413413   virtual void machine_reset();
414414   DECLARE_MACHINE_RESET(hornet_2board);
r241462r241463
11361136   MCFG_EEPROM_SERIAL_93C46_ADD("lan_eeprom")
11371137MACHINE_CONFIG_END
11381138
1139 
1140/*****************************************************************************/
1141 
1142WRITE8_MEMBER(hornet_state::jamma_jvs_w)
1143{
1144   if (m_jvs_sdata_ptr == 0 && data != 0xe0)
1145      return;
1146   m_jvs_sdata[m_jvs_sdata_ptr] = data;
1147   m_jvs_sdata_ptr++;
1148 
1149   if (m_jvs_sdata_ptr >= 3 && m_jvs_sdata_ptr >= 3 + m_jvs_sdata[2])
1150      jamma_jvs_cmd_exec();
1151}
1152 
1153int hornet_state::jvs_encode_data(UINT8 *in, int length)
1139
1140/*****************************************************************************/
1141
1142WRITE8_MEMBER(hornet_state::jamma_jvs_w)
11541143{
1144   if (m_jvs_sdata_ptr == 0 && data != 0xe0)
1145      return;
1146   m_jvs_sdata[m_jvs_sdata_ptr] = data;
1147   m_jvs_sdata_ptr++;
1148
1149   if (m_jvs_sdata_ptr >= 3 && m_jvs_sdata_ptr >= 3 + m_jvs_sdata[2])
1150      jamma_jvs_cmd_exec();
1151}
1152
1153int hornet_state::jvs_encode_data(UINT8 *in, int length)
1154{
11551155   int inptr = 0;
11561156   int sum = 0;
11571157
r241462r241463
12801280
12811281DRIVER_INIT_MEMBER(hornet_state,hornet)
12821282{
1283   m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1284   m_led_reg0 = m_led_reg1 = 0x7f;
1285 
1286   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(hornet_state::jamma_jvs_w), this));
1287}
1288 
1289DRIVER_INIT_MEMBER(hornet_state,hornet_2board)
1283   m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1284   m_led_reg0 = m_led_reg1 = 0x7f;
1285
1286   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(hornet_state::jamma_jvs_w), this));
1287}
1288
1289DRIVER_INIT_MEMBER(hornet_state,hornet_2board)
12901290{
12911291   m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1292   m_konppc->set_cgboard_texture_bank(1, "bank6", memregion("user5")->base());
1293   m_led_reg0 = m_led_reg1 = 0x7f;
1294 
1295   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(hornet_state::jamma_jvs_w), this));
1296}
1297 
1298/*****************************************************************************/
1292   m_konppc->set_cgboard_texture_bank(1, "bank6", memregion("user5")->base());
1293   m_led_reg0 = m_led_reg1 = 0x7f;
12991294
1295   m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(hornet_state::jamma_jvs_w), this));
1296}
1297
1298/*****************************************************************************/
1299
13001300ROM_START(sscope)
13011301   ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
13021302   ROM_LOAD16_WORD_SWAP("830d01.27p", 0x200000, 0x200000, CRC(de9b3dfa) SHA1(660652a5f745cb04687481c3626d8a43cd169193) )


Previous 199869 Revisions Next


© 1997-2024 The MAME Team