Previous 199869 Revisions Next

r29213 Thursday 3rd April, 2014 at 08:18:46 UTC by Miodrag Milanović
move handlers to members in dsp56k (nw)
[src/emu/cpu/dsp56k]dsp56k.c dsp56k.h dsp56mem.c dsp56mem.h

trunk/src/emu/cpu/dsp56k/dsp56mem.c
r29212r29213
482482   external_p_wait_states_set(cpustate, 0x1f);
483483}
484484
485READ16_HANDLER( program_r )
485
486} // namespace DSP56K
487
488
489READ16_MEMBER( dsp56k_device::program_r )
486490{
487   dsp56k_core* cpustate = get_safe_token(&space.device());
491   dsp56k_core* cpustate = get_safe_token(this);
488492   return cpustate->program_ram[offset];
489493}
490494
491WRITE16_HANDLER( program_w )
495WRITE16_MEMBER( dsp56k_device::program_w )
492496{
493   dsp56k_core* cpustate = get_safe_token(&space.device());
497   dsp56k_core* cpustate = get_safe_token(this);
494498   cpustate->program_ram[offset] = data;
495499}
496500
497501/* Work */
498READ16_HANDLER( peripheral_register_r )
502READ16_MEMBER( dsp56k_device::peripheral_register_r )
499503{
500   dsp56k_core* cpustate = get_safe_token(&space.device());
504   dsp56k_core* cpustate = get_safe_token(this);
501505   // (printf) logerror("Peripheral read 0x%04x\n", O2A(offset));
502506
503507   switch (O2A(offset))
r29212r29213
630634   return cpustate->peripheral_ram[offset];
631635}
632636
633WRITE16_HANDLER( peripheral_register_w )
637WRITE16_MEMBER( dsp56k_device::peripheral_register_w )
634638{
635   dsp56k_core* cpustate = get_safe_token(&space.device());
639   dsp56k_core* cpustate = get_safe_token(this);
636640
637641   // Its primary behavior is RAM
638642   // COMBINE_DATA(&cpustate->peripheral_ram[offset]);
r29212r29213
785789   }
786790}
787791
788} // namespace DSP56K
789
790792/* These two functions are exposed to the outside world */
791793/* They represent the host side of the dsp56k's host interface */
792794void dsp56k_host_interface_write(device_t* device, UINT8 offset, UINT8 data)
trunk/src/emu/cpu/dsp56k/dsp56mem.h
r29212r29213
234234/* Port C Dtaa Register (PCD) */
235235void PCD_set(dsp56k_core* cpustate, UINT16 value);
236236
237DECLARE_READ16_HANDLER( peripheral_register_r );
238DECLARE_WRITE16_HANDLER( peripheral_register_w );
239DECLARE_READ16_HANDLER( program_r );
240DECLARE_WRITE16_HANDLER( program_w );
241
242237} // namespace DSP56K
243238
244239#endif
trunk/src/emu/cpu/dsp56k/dsp56k.c
r29212r29213
368368/****************************************************************************
369369 *  Internal Memory Maps
370370 ****************************************************************************/
371static ADDRESS_MAP_START( dsp56156_program_map, AS_PROGRAM, 16, legacy_cpu_device )
372   AM_RANGE(0x0000,0x07ff) AM_READWRITE_LEGACY(DSP56K::program_r, DSP56K::program_w)   /* 1-5 */
371static ADDRESS_MAP_START( dsp56156_program_map, AS_PROGRAM, 16, dsp56k_device )
372   AM_RANGE(0x0000,0x07ff) AM_READWRITE(program_r, program_w)   /* 1-5 */
373373//  AM_RANGE(0x2f00,0x2fff) AM_ROM                              /* 1-5 PROM reserved memory.  Is this the right spot for it? */
374374ADDRESS_MAP_END
375375
376static ADDRESS_MAP_START( dsp56156_x_data_map, AS_DATA, 16, legacy_cpu_device )
376static ADDRESS_MAP_START( dsp56156_x_data_map, AS_DATA, 16, dsp56k_device )
377377   AM_RANGE(0x0000,0x07ff) AM_RAM                              /* 1-5 */
378   AM_RANGE(0xffc0,0xffff) AM_READWRITE_LEGACY(DSP56K::peripheral_register_r, DSP56K::peripheral_register_w)   /* 1-5 On-chip peripheral registers memory mapped in data space */
378   AM_RANGE(0xffc0,0xffff) AM_READWRITE(peripheral_register_r, peripheral_register_w)   /* 1-5 On-chip peripheral registers memory mapped in data space */
379379ADDRESS_MAP_END
380380
381381
trunk/src/emu/cpu/dsp56k/dsp56k.h
r29212r29213
2323#define DSP56K_IRQ_RESET 3  /* Is this needed? */
2424
2525// Needed for MAME
26DECLARE_LEGACY_CPU_DEVICE(DSP56156, dsp56k);
26CPU_GET_INFO( dsp56k );
2727
28class dsp56k_device : public legacy_cpu_device
29{
30public:
31   dsp56k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
2832
33   DECLARE_READ16_MEMBER( program_r );
34   DECLARE_WRITE16_MEMBER( program_w );
35   DECLARE_READ16_MEMBER( peripheral_register_r );
36   DECLARE_WRITE16_MEMBER( peripheral_register_w );
37};
38
39extern const device_type DSP56156;
40
41
2942/***************************************************************************
3043    STRUCTURES & TYPEDEFS
3144***************************************************************************/

Previous 199869 Revisions Next


© 1997-2024 The MAME Team