Previous 199869 Revisions Next

r31176 Thursday 3rd July, 2014 at 19:04:50 UTC by hap
go back to a fake memmap for now
[src/emu/cpu/tms7000]tms7000.c tms7000.h
[src/mess/drivers]exelv.c

trunk/src/emu/cpu/tms7000/tms7000.h
r31175r31176
2424
2525#include "emu.h"
2626
27
2728enum { TMS7000_PC=1, TMS7000_SP, TMS7000_ST, TMS7000_IDLE, TMS7000_T1_CL, TMS7000_T1_PS, TMS7000_T1_DEC };
2829
2930enum
r31175r31176
3435   TMS7000_IRQNONE = 255
3536};
3637
38enum
39{
40   TMS7000_PORTA = 0, /* read-only */
41   TMS7000_PORTB,     /* write-only */
42   TMS7000_PORTC,
43   TMS7000_PORTD
44};
3745
38/***************************************************************************
39    DEVICE CONFIGURATION MACROS
40***************************************************************************/
4146
42// I/O callbacks
43
44// (port A is read-only)
45#define MCFG_TMS7000_PORTA_READ_CB(_devcb) \
46   devcb = &tms7000_device::set_inportsa_cb(*device, DEVCB_##_devcb);
47
48#define MCFG_TMS7000_PORTC_READ_CB(_devcb) \
49   devcb = &tms7000_device::set_inportsc_cb(*device, DEVCB_##_devcb);
50
51#define MCFG_TMS7000_PORTD_READ_CB(_devcb) \
52   devcb = &tms7000_device::set_inportsd_cb(*device, DEVCB_##_devcb);
53
54// (port B is write-only)
55#define MCFG_TMS7000_PORTB_WRITE_CB(_devcb) \
56   devcb = &tms7000_device::set_outportsb_cb(*device, DEVCB_##_devcb);
57
58#define MCFG_TMS7000_PORTC_WRITE_CB(_devcb) \
59   devcb = &tms7000_device::set_outportsc_cb(*device, DEVCB_##_devcb);
60
61#define MCFG_TMS7000_PORTD_WRITE_CB(_devcb) \
62   devcb = &tms7000_device::set_outportsd_cb(*device, DEVCB_##_devcb);
63
64
65/***************************************************************************
66    TYPE DEFINITIONS
67***************************************************************************/
68
6947class tms7000_device : public cpu_device
7048{
7149public:
r31175r31176
7755   tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7856   tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, const opcode_func *opcode, const char *shortname, const char *source);
7957
80   // static configuration helpers
81   template<class _Object> static devcb_base & set_inportsa_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_inportsa.set_callback(object); }
82   template<class _Object> static devcb_base & set_inportsc_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_inportsc.set_callback(object); }
83   template<class _Object> static devcb_base & set_inportsd_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_inportsd.set_callback(object); }
84
85   template<class _Object> static devcb_base & set_outportsb_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_outportsb.set_callback(object); }
86   template<class _Object> static devcb_base & set_outportsc_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_outportsc.set_callback(object); }
87   template<class _Object> static devcb_base & set_outportsd_cb(device_t &device, _Object object) { return downcast<tms7000_device &>(device).m_outportsd.set_callback(object); }
88
8958   DECLARE_WRITE8_MEMBER( tms70x0_pf_w );
9059   DECLARE_READ8_MEMBER( tms70x0_pf_r );
9160
r31175r31176
10271   virtual void execute_set_input(int inputnum, int state);
10372
10473   // device_memory_interface overrides
105   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
74   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); }
10675
10776   // device_state_interface overrides
10877   void state_string_export(const device_state_entry &entry, astring &string);
r31175r31176
11483
11584private:
11685   address_space_config m_program_config;
86   address_space_config m_io_config;
11787
11888   const opcode_func *m_opcode;
11989
r31175r31176
136106
137107   address_space *m_program;
138108   direct_read_data *m_direct;
109   address_space *m_io;
139110
140   // callbacks
141   devcb_read8 m_inportsa;
142   devcb_read8 m_inportsc;
143   devcb_read8 m_inportsd;
144
145   devcb_write8 m_outportsb;
146   devcb_write8 m_outportsc;
147   devcb_write8 m_outportsd;
148   
149   /////////////////////////////////////////////////////////
150
151111   inline UINT16 RM16( UINT32 mAddr );
152112   inline UINT16 RRF16( UINT32 mAddr );
153113   inline void WRF16( UINT32 mAddr, PAIR p );
trunk/src/emu/cpu/tms7000/tms7000.c
r31175r31176
5555const device_type TMS70C20 = &device_creator<tms70c20_device>;
5656const device_type TMS70C40 = &device_creator<tms70c40_device>;
5757
58static ADDRESS_MAP_START(tms7000_io, AS_IO, 8, tms7000_device)
59   ADDRESS_MAP_UNMAP_HIGH
60   AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_WRITENOP
61   AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_READNOP
62ADDRESS_MAP_END
63
5864static ADDRESS_MAP_START(tms7000_mem, AS_PROGRAM, 8, tms7000_device )
5965   AM_RANGE(0x0000, 0x007f) AM_RAM // 128 bytes internal RAM
6066   AM_RANGE(0x0100, 0x010f) AM_READWRITE(tms70x0_pf_r, tms70x0_pf_w)             /* tms7000 internal I/O ports */
r31175r31176
7278
7379
7480tms7000_device::tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
75   : cpu_device(mconfig, TMS7000, "TMS7000", tag, owner, clock, "tms7000", __FILE__),
76   m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, ADDRESS_MAP_NAME(tms7000_mem)),
77   m_opcode(s_opfn),
78   m_inportsa(*this),
79   m_inportsc(*this),
80   m_inportsd(*this),
81   m_outportsb(*this),
82   m_outportsc(*this),
83   m_outportsd(*this)
81   : cpu_device(mconfig, TMS7000, "TMS7000", tag, owner, clock, "tms7000", __FILE__)
82   , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, ADDRESS_MAP_NAME(tms7000_mem))
83   , m_io_config("io", ENDIANNESS_BIG, 8, 8, 0, ADDRESS_MAP_NAME(tms7000_io))
84   , m_opcode(s_opfn)
8485{
8586}
8687
8788tms7000_device::tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, const opcode_func *opcode, const char *shortname, const char *source)
88   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
89   m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal),
90   m_opcode(opcode),
91   m_inportsa(*this),
92   m_inportsc(*this),
93   m_inportsd(*this),
94   m_outportsb(*this),
95   m_outportsc(*this),
96   m_outportsd(*this)
89   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
90   , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal)
91   , m_io_config("io", ENDIANNESS_BIG, 8, 8, 0, ADDRESS_MAP_NAME(tms7000_io))
92   , m_opcode(opcode)
9793{
9894}
9995
r31175r31176
195191{
196192   m_program = &space(AS_PROGRAM);
197193   m_direct = &m_program->direct();
194   m_io = &space(AS_IO);
198195
199   // resolve callbacks
200   m_inportsa.resolve_safe(0xff);
201   m_inportsc.resolve_safe(0xff);
202   m_inportsd.resolve_safe(0xff);
203
204   m_outportsb.resolve_safe();
205   m_outportsc.resolve_safe();
206   m_outportsd.resolve_safe();
207
208196   memset(m_pf, 0, 0x100);
209197   m_cycles_per_INT2 = 0;
210198   m_t1_capture_latch = 0;
r31175r31176
492480         break;
493481
494482      case 0x06: /* Port B write */
495         m_outportsb(data);
483         m_io->write_byte( TMS7000_PORTB, data );
496484         m_pf[ 0x06 ] = data;
497485         break;
498486
499487      case 0x08: /* Port C write */
500488         temp1 = data & m_pf[ 0x09 ];    /* Mask off input bits */
501         m_outportsc(temp1);
489         m_io->write_byte( TMS7000_PORTC, temp1 );
502490         m_pf[ 0x08 ] = temp1;
503491         break;
504492
505493      case 0x0a: /* Port D write */
506494         temp1 = data & m_pf[ 0x0b ];    /* Mask off input bits */
507         m_outportsd(temp1);
495         m_io->write_byte( TMS7000_PORTD, temp1 );
508496         m_pf[ 0x0a ] = temp1;
509497         break;
510498
r31175r31176
539527         break;
540528
541529      case 0x04: /* Port A read */
542         result = m_inportsa();
530         result = m_io->read_byte( TMS7000_PORTA );
543531         break;
544532
545533
r31175r31176
550538
551539      case 0x08: /* Port C read */
552540         temp1 = m_pf[ 0x08 ] & m_pf[ 0x09 ];    /* Get previous output bits */
553         temp2 = m_inportsc();           /* Read port */
541         temp2 = m_io->read_byte( TMS7000_PORTC );           /* Read port */
554542         temp3 = temp2 & (~m_pf[ 0x09 ]);                /* Mask off output bits */
555543         result = temp1 | temp3;                             /* OR together */
556544         break;
557545
558546      case 0x0a: /* Port D read */
559547         temp1 = m_pf[ 0x0a ] & m_pf[ 0x0b ];    /* Get previous output bits */
560         temp2 = m_inportsd();           /* Read port */
548         temp2 = m_io->read_byte( TMS7000_PORTD );           /* Read port */
561549         temp3 = temp2 & (~m_pf[ 0x0b ]);                /* Mask off output bits */
562550         result = temp1 | temp3;                             /* OR together */
563551         break;
trunk/src/mess/drivers/exelv.c
r31175r31176
429429   AM_RANGE(0xc800, 0xf7ff) AM_NOP
430430ADDRESS_MAP_END
431431
432static ADDRESS_MAP_START(tms7020_port, AS_IO, 8, exelv_state)
433   AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7020_porta_r)
434   AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7020_portb_w)
435ADDRESS_MAP_END
432436
437
433438static ADDRESS_MAP_START(tms7041_map, AS_PROGRAM, 8, exelv_state)
434439   AM_RANGE(0x0080, 0x00ff) AM_RAM
435440ADDRESS_MAP_END
436441
442static ADDRESS_MAP_START(tms7041_port, AS_IO, 8, exelv_state)
443   AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7041_porta_r)
444   AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7041_portb_w)
445   AM_RANGE(TMS7000_PORTC, TMS7000_PORTC) AM_READWRITE(tms7041_portc_r, tms7041_portc_w)
446   AM_RANGE(TMS7000_PORTD, TMS7000_PORTD) AM_READWRITE(tms7041_portd_r, tms7041_portd_w)
447ADDRESS_MAP_END
437448
449
438450static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, exelv_state)
439451   AM_RANGE(0x0080, 0x00ff) AM_NOP
440452    AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r)
r31175r31176
500512   /* basic machine hardware */
501513   MCFG_CPU_ADD("maincpu", TMS7020_EXL, XTAL_4_9152MHz)
502514   MCFG_CPU_PROGRAM_MAP(tms7020_mem)
503   MCFG_TMS7000_PORTA_READ_CB(READ8(exelv_state, tms7020_porta_r))
504   MCFG_TMS7000_PORTB_WRITE_CB(WRITE8(exelv_state, tms7020_portb_w))
515   MCFG_CPU_IO_MAP(tms7020_port)
505516   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
506517
507518   MCFG_CPU_ADD("tms7041", TMS7040, XTAL_4_9152MHz) // should be TMS7041
508519   MCFG_CPU_PROGRAM_MAP(tms7041_map)
509   MCFG_TMS7000_PORTA_READ_CB(READ8(exelv_state, tms7041_porta_r))
510   MCFG_TMS7000_PORTB_WRITE_CB(WRITE8(exelv_state, tms7041_portb_w))
511   MCFG_TMS7000_PORTC_READ_CB(READ8(exelv_state, tms7041_portc_r))
512   MCFG_TMS7000_PORTC_WRITE_CB(WRITE8(exelv_state, tms7041_portc_w))
513   MCFG_TMS7000_PORTD_READ_CB(READ8(exelv_state, tms7041_portd_r))
514   MCFG_TMS7000_PORTD_WRITE_CB(WRITE8(exelv_state, tms7041_portd_w))
520   MCFG_CPU_IO_MAP(tms7041_port)
515521
516522   MCFG_QUANTUM_PERFECT_CPU("maincpu")
517523
r31175r31176
558564   /* basic machine hardware */
559565   MCFG_CPU_ADD("maincpu", TMS7040, XTAL_4_9152MHz)
560566   MCFG_CPU_PROGRAM_MAP(tms7040_mem)
561   MCFG_TMS7000_PORTA_READ_CB(READ8(exelv_state, tms7020_porta_r))
562   MCFG_TMS7000_PORTB_WRITE_CB(WRITE8(exelv_state, tms7020_portb_w))
567   MCFG_CPU_IO_MAP(tms7020_port)
563568   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
564569
565570   MCFG_CPU_ADD("tms7042", TMS7040, XTAL_4_9152MHz) // should be TMS7042
566571   MCFG_CPU_PROGRAM_MAP(tms7042_map)
567   MCFG_TMS7000_PORTA_READ_CB(READ8(exelv_state, tms7041_porta_r))
568   MCFG_TMS7000_PORTB_WRITE_CB(WRITE8(exelv_state, tms7041_portb_w))
569   MCFG_TMS7000_PORTC_READ_CB(READ8(exelv_state, tms7041_portc_r))
570   MCFG_TMS7000_PORTC_WRITE_CB(WRITE8(exelv_state, tms7041_portc_w))
571   MCFG_TMS7000_PORTD_READ_CB(READ8(exelv_state, tms7041_portd_r))
572   MCFG_TMS7000_PORTD_WRITE_CB(WRITE8(exelv_state, tms7041_portd_w))
572   MCFG_CPU_IO_MAP(tms7041_port)
573573
574574   MCFG_QUANTUM_PERFECT_CPU("maincpu")
575575

Previous 199869 Revisions Next


© 1997-2024 The MAME Team