Previous 199869 Revisions Next

r21721 Friday 8th March, 2013 at 19:35:45 UTC by Wilbert Pol
(MESS) ngp.c: Made the drivers a bit more user friendly. (nw)
[src/emu/cpu/tlcs900]tlcs900.c
[src/mess/drivers]ngp.c

trunk/src/emu/cpu/tlcs900/tlcs900.c
r21720r21721
11481148
11491149   switch ( state )
11501150   {
1151   case CPUINFO_INT_PC:
1152   case CPUINFO_INT_REGISTER + TLCS900_PC:
1153      cpustate->pc.d = info->i; break;
1154
11511155   case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:
11521156   case CPUINFO_INT_INPUT_STATE + TLCS900_NMI:
11531157   case CPUINFO_INT_INPUT_STATE + TLCS900_INTWD:
trunk/src/mess/drivers/ngp.c
r21720r21721
118118};
119119
120120
121class ngp_state : public driver_device
121class ngp_state : public driver_device, public device_nvram_interface
122122{
123123public:
124124   ngp_state(const machine_config &mconfig, device_type type, const char *tag)
125125      : driver_device(mconfig, type, tag)
126      , device_nvram_interface(mconfig, *this)
126127      , m_tlcs900( *this, "maincpu" )
127128      , m_z80( *this, "soundcpu" )
128129      , m_t6w28( *this, "t6w28" )
129130      , m_dac_l( *this, "dac_l" )
130131      , m_dac_r( *this, "dac_r" )
132      , m_mainram( *this, "mainram" )
131133   {
132134      m_flash_chip[0].present = 0;
133135      m_flash_chip[0].state = F_READ;
r21720r21721
136138      m_flash_chip[1].present = 0;
137139      m_flash_chip[1].state = F_READ;
138140      m_flash_chip[1].data = NULL;
141
142      m_nvram_loaded = false;
139143   }
140144
141145   virtual void machine_start();
r21720r21721
160164   required_device<t6w28_device> m_t6w28;
161165   required_device<dac_device> m_dac_l;
162166   required_device<dac_device> m_dac_r;
167   required_shared_ptr<UINT8> m_mainram;
163168   device_t *m_k1ge;
164169
165170   DECLARE_READ8_MEMBER( ngp_io_r );
r21720r21721
184189
185190   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( ngp_cart);
186191   DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( ngp_cart );
192
193protected:
194   bool m_nvram_loaded;
195
196   virtual void nvram_default();
197   virtual void nvram_read(emu_file &file);
198   virtual void nvram_write(emu_file &file);
187199};
188200
189201
r21720r21721
521533
522534static ADDRESS_MAP_START( ngp_mem, AS_PROGRAM, 8, ngp_state )
523535   AM_RANGE( 0x000080, 0x0000bf )  AM_READWRITE(ngp_io_r, ngp_io_w)                            /* ngp/c specific i/o */
524   AM_RANGE( 0x004000, 0x006fff )  AM_RAM                                                      /* work ram */
536   AM_RANGE( 0x004000, 0x006fff )  AM_RAM AM_SHARE("mainram")                                  /* work ram */
525537   AM_RANGE( 0x007000, 0x007fff )  AM_RAM AM_SHARE("share1")                                   /* shared with sound cpu */
526   AM_RANGE( 0x008000, 0x0087ff )  AM_DEVREADWRITE_LEGACY("k1ge", k1ge_r, k1ge_w)                      /* video registers */
538   AM_RANGE( 0x008000, 0x0087ff )  AM_DEVREADWRITE_LEGACY("k1ge", k1ge_r, k1ge_w)              /* video registers */
527539   AM_RANGE( 0x008800, 0x00bfff )  AM_RAM AM_REGION("vram", 0x800 )                            /* Video RAM area */
528540   AM_RANGE( 0x200000, 0x3fffff )  AM_ROM AM_WRITE(flash0_w) AM_REGION("cart", 0)              /* cart area #1 */
529541   AM_RANGE( 0x800000, 0x9fffff )  AM_ROM AM_WRITE(flash1_w) AM_REGION("cart", 0x200000)       /* cart area #2 */
r21720r21721
669681
670682   m_z80->suspend(SUSPEND_REASON_HALT, 1 );
671683   m_z80->set_input_line(0, CLEAR_LINE );
684
685   if ( m_nvram_loaded )
686   {
687      m_tlcs900->set_state_int(TLCS900_PC, 0xFF1800);
688   }
672689}
673690
674691
r21720r21721
747764}
748765
749766
767void ngp_state::nvram_default()
768{
769}
770
771
772void ngp_state::nvram_read(emu_file &file)
773{
774   file.read(m_mainram, 0x3000);
775   m_nvram_loaded = true;
776}
777
778
779void ngp_state::nvram_write(emu_file &file)
780{
781   file.write(m_mainram, 0x3000);
782}
783
784
750785static const k1ge_interface ngp_k1ge_interface =
751786{
752787   "screen",

Previous 199869 Revisions Next


© 1997-2024 The MAME Team