Previous 199869 Revisions Next

r32358 Wednesday 24th September, 2014 at 19:52:39 UTC by Fabio Priuli
(MESS) added handling for a generic rom+ram cart (as needed
by x07 expansion cards) and converted x07 and vii to use generic
cartslot code. nw.
[src/emu/bus/generic]carts.c carts.h rom.c rom.h slot.c slot.h
[src/mess/drivers]vii.c x07.c
[src/mess/includes]x07.h

trunk/src/emu/bus/generic/carts.c
r32357r32358
1414SLOT_INTERFACE_START(generic_linear_slot)
1515   SLOT_INTERFACE_INTERNAL("rom", GENERIC_ROM_LINEAR)
1616SLOT_INTERFACE_END
17
18SLOT_INTERFACE_START(generic_romram_plain_slot)
19   SLOT_INTERFACE_INTERNAL("rom", GENERIC_ROMRAM_PLAIN)
20SLOT_INTERFACE_END
trunk/src/emu/bus/generic/rom.c
r32357r32358
88 generic_rom_plain  : returns 0xff when the system reads beyond the end of the ROM
99 generic_rom_linear : maps linearly the ROM in the accessed area (i.e., read offset is masked with (ROM size - 1) )
1010
11 generic_romram_plain  : allows support for carts always containing ROM + RAM (e.g. X07)
12
13 
1114 TODO:
1215   - possibly support linear mapping when non-power of 2 ROMs are mapped
1316 
r32357r32358
2326
2427const device_type GENERIC_ROM_PLAIN  = &device_creator<generic_rom_plain_device>;
2528const device_type GENERIC_ROM_LINEAR = &device_creator<generic_rom_linear_device>;
29const device_type GENERIC_ROMRAM_PLAIN = &device_creator<generic_romram_plain_device>;
2630
2731
2832generic_rom_device::generic_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
r32357r32358
3135{
3236}
3337
38generic_rom_plain_device::generic_rom_plain_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
39               : generic_rom_device(mconfig, type, name, tag, owner, clock, shortname, source)
40{
41}
42
3443generic_rom_plain_device::generic_rom_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3544               : generic_rom_device(mconfig, GENERIC_ROM_PLAIN, "Generic ROM (plain mapping)", tag, owner, clock, "generic_rom_plain", __FILE__)
3645{
r32357r32358
4150{
4251}
4352
53generic_romram_plain_device::generic_romram_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
54               : generic_rom_plain_device(mconfig, GENERIC_ROMRAM_PLAIN, "Generic ROM + RAM (plain mapping)", tag, owner, clock, "generic_romram_plain", __FILE__)
55{
56}
4457
58
4559/*-------------------------------------------------
4660 mapper specific handlers
4761 -------------------------------------------------*/
r32357r32358
90104   return ROM[offset % (m_rom_size/4)];
91105}
92106
107
108READ8_MEMBER(generic_romram_plain_device::read_ram)
109{
110   if (offset < m_ram.bytes())
111      return m_ram[offset];
112   else
113      return 0xff;
114}
115
116WRITE8_MEMBER(generic_romram_plain_device::write_ram)
117{
118   if (offset < m_ram.bytes())
119      m_ram[offset] = data;
120}
121
trunk/src/emu/bus/generic/carts.h
r32357r32358
1717
1818SLOT_INTERFACE_EXTERN( generic_plain_slot );
1919SLOT_INTERFACE_EXTERN( generic_linear_slot );
20SLOT_INTERFACE_EXTERN( generic_romram_plain_slot );
2021
2122#endif
trunk/src/emu/bus/generic/slot.c
r32357r32358
5959
6060void device_generic_cart_interface::ram_alloc(UINT32 size)
6161{
62   if (m_ram == NULL)
63   {
64      m_ram.resize(size);
65      device().save_item(NAME(m_ram));
66   }
62   m_ram.resize(size);
6763}
6864
6965
trunk/src/emu/bus/generic/rom.h
r32357r32358
2424{
2525public:
2626   // construction/destruction
27   generic_rom_plain_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
2728   generic_rom_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2829   
2930   // reading and writing
r32357r32358
3334};
3435
3536
37// ======================> generic_romram_plain_device
38
39class generic_romram_plain_device : public generic_rom_plain_device
40{
41public:
42   // construction/destruction
43   generic_romram_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
44   
45   // reading and writing
46   virtual DECLARE_READ8_MEMBER(read_ram);
47   virtual DECLARE_WRITE8_MEMBER(write_ram);
48};
49
50
3651// ======================> generic_rom_linear_device
3752
3853class generic_rom_linear_device : public generic_rom_device
r32357r32358
5267// device type definition
5368extern const device_type GENERIC_ROM_PLAIN;
5469extern const device_type GENERIC_ROM_LINEAR;
70extern const device_type GENERIC_ROMRAM_PLAIN;
5571
5672
57
5873#endif
trunk/src/emu/bus/generic/slot.h
r32357r32358
3232   UINT8* get_ram_base() { return m_ram; }
3333   UINT32 get_ram_size() { return m_ram.count(); }
3434
35   void save_ram()   { device().save_item(NAME(m_ram)); }
36
3537   // internal state
3638   UINT8  *m_rom;
3739   UINT32  m_rom_size;
r32357r32358
136138   UINT8* get_rom_base()  { if (m_cart) return m_cart->get_rom_base(); return NULL; }
137139   UINT8* get_ram_base() { if (m_cart) return m_cart->get_ram_base(); return NULL; }
138140   UINT32 get_rom_size() { if (m_cart) return m_cart->get_rom_size(); return 0; }
139   
141
142   void save_ram()   { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
143
140144protected:
141145
142146   const char *m_interface;
trunk/src/mess/drivers/x07.c
r32357r32358
10371037
10381038DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card )
10391039{
1040   address_space &space = m_maincpu->space( AS_PROGRAM );
1041   UINT16 ram_size = m_ram->size();
1042
1043   if (image.software_entry() == NULL)
1040   UINT32 size = m_card->common_get_size("rom");
1041   
1042   // check card type
1043   if (image.software_entry() != NULL)
10441044   {
1045      UINT8 *rom = machine().memory().region_alloc( "card", image.length(), 1, ENDIANNESS_LITTLE )->base();
1046      image.fread(rom, image.length());
1047
1048      space.install_ram(ram_size, ram_size + 0xfff);
1049      space.install_rom(0x6000, 0x7fff, rom);
1050   }
1051   else
1052   {
10531045      const char *card_type = image.get_feature("card_type");
1054
1055      if (!strcmp(card_type, "xp140"))
1046     
1047      if (strcmp(card_type, "xp140"))
10561048      {
1057         // 0x4000 - 0x4fff   4KB RAM
1058         // 0x6000 - 0x7fff   8KB ROM
1059         space.install_ram(ram_size, ram_size + 0xfff);
1060         space.install_rom(0x6000, 0x7fff, image.get_software_region("rom"));
1061      }
1062      else
1063      {
1049         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported card type");
10641050         return IMAGE_INIT_FAIL;
10651051      }
10661052   }
10671053
1054   m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG);
1055   m_card->common_load_rom(m_card->get_rom_base(), size, "rom");         
1056
1057   m_card->ram_alloc(0x1000);
1058
10681059   return IMAGE_INIT_PASS;
10691060}
10701061
r32357r32358
13681359
13691360void x07_state::machine_start()
13701361{
1362   UINT32 ram_size = m_ram->size();
13711363   m_rsta_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rsta_clear),this));
13721364   m_rstb_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rstb_clear),this));
13731365   m_beep_stop = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::beep_stop),this));
r32357r32358
13751367   m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this));
13761368
13771369   m_nvram1->set_base(&m_t6834_ram, 0x800);
1378   m_nvram2->set_base(m_ram->pointer(), m_ram->size());
1370   m_nvram2->set_base(m_ram->pointer(), ram_size);
13791371
13801372   /* Save State */
13811373   save_item(NAME(m_sleep));
r32357r32358
14181410   save_item(NAME(m_cursor.y));
14191411   save_item(NAME(m_cursor.on));
14201412
1421   /* install RAM */
1413   // install RAM
14221414   address_space &program = m_maincpu->space(AS_PROGRAM);
1423   program.install_ram(0x0000, m_ram->size() - 1, m_ram->pointer());
1415   program.install_ram(0x0000, ram_size - 1, m_ram->pointer());
1416
1417   // card
1418   if (m_card->exists())
1419   {
1420      // 0x4000 - 0x4fff   4KB RAM
1421      // 0x6000 - 0x7fff   8KB ROM
1422      program.install_read_handler(ram_size, ram_size + 0xfff, read8_delegate(FUNC(generic_slot_device::read_ram),(generic_slot_device*)m_card));
1423      program.install_write_handler(ram_size, ram_size + 0xfff, write8_delegate(FUNC(generic_slot_device::write_ram),(generic_slot_device*)m_card));
1424      program.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_card));
1425
1426      m_card->save_ram();
1427   }
14241428}
14251429
14261430void x07_state::machine_reset()
r32357r32358
15041508   MCFG_RAM_EXTRA_OPTIONS("8K,12K,20K,24k")
15051509
15061510   /* Memory Card */
1507   MCFG_CARTSLOT_ADD("card")
1508   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
1509   MCFG_CARTSLOT_NOT_MANDATORY
1510   MCFG_CARTSLOT_LOAD(x07_state,x07_card)
1511   MCFG_CARTSLOT_INTERFACE("x07_card")
1511   MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "x07_card")
1512   MCFG_GENERIC_EXTENSIONS("rom,bin")
1513   MCFG_GENERIC_LOAD(x07_state, x07_card)
15121514
15131515   /* cassette */
15141516   MCFG_CASSETTE_ADD( "cassette" )
trunk/src/mess/drivers/vii.c
r32357r32358
7070
7171#include "emu.h"
7272#include "cpu/unsp/unsp.h"
73#include "imagedev/cartslot.h"
7473#include "machine/i2cmem.h"
75#include "formats/imageutl.h"
7674
75#include "bus/generic/slot.h"
76#include "bus/generic/carts.h"
77
78
7779#define PAGE_ENABLE_MASK        0x0008
7880
7981#define PAGE_DEPTH_FLAG_MASK    0x3000
r32357r32358
9193   vii_state(const machine_config &mconfig, device_type type, const char *tag)
9294      : driver_device(mconfig, type, tag),
9395      m_maincpu(*this, "maincpu"),
96      m_cart(*this, "cartslot"),
9497      m_p_ram(*this, "p_ram"),
9598      m_p_rowscroll(*this, "p_rowscroll"),
9699      m_p_palette(*this, "p_palette"),
97100      m_p_spriteram(*this, "p_spriteram"),
98      m_p_cart(*this, "p_cart"),
99      m_region_cpu(*this, "maincpu"),
100      m_region_cart(*this, "cart"),
101      m_bios_rom(*this, "bios"),
101102      m_io_p1(*this, "P1")
102103   { }
103104
104105   required_device<cpu_device> m_maincpu;
105   DECLARE_READ16_MEMBER(vii_video_r);
106   DECLARE_WRITE16_MEMBER(vii_video_w);
107   DECLARE_READ16_MEMBER(vii_audio_r);
108   DECLARE_WRITE16_MEMBER(vii_audio_w);
109   DECLARE_READ16_MEMBER(vii_io_r);
110   DECLARE_WRITE16_MEMBER(vii_io_w);
111   DECLARE_WRITE16_MEMBER(vii_rowscroll_w);
112   DECLARE_WRITE16_MEMBER(vii_spriteram_w);
106   optional_device<generic_slot_device> m_cart;
107   DECLARE_READ16_MEMBER(video_r);
108   DECLARE_WRITE16_MEMBER(video_w);
109   DECLARE_READ16_MEMBER(audio_r);
110   DECLARE_WRITE16_MEMBER(audio_w);
111   DECLARE_READ16_MEMBER(io_r);
112   DECLARE_WRITE16_MEMBER(io_w);
113   DECLARE_WRITE16_MEMBER(rowscroll_w);
114   DECLARE_WRITE16_MEMBER(spriteram_w);
115   DECLARE_READ16_MEMBER(rom_r);
113116   required_shared_ptr<UINT16> m_p_ram;
114117   required_shared_ptr<UINT16> m_p_rowscroll;
115118   required_shared_ptr<UINT16> m_p_palette;
116119   required_shared_ptr<UINT16> m_p_spriteram;
117   required_shared_ptr<UINT16> m_p_cart;
118120
121   dynamic_array<UINT16> m_p_cart;
122
119123   UINT32 m_current_bank;
120124
121125   UINT16 m_video_regs[0x100];
122126   UINT32 m_centered_coordinates;
127   void test_centered(UINT8 *ROM);
123128
124129   struct
125130   {
r32357r32358
134139
135140   emu_timer *m_tmb1;
136141   emu_timer *m_tmb2;
137   void vii_do_dma(UINT32 len);
138   void vii_do_gpio(UINT32 offset);
139   void vii_switch_bank(UINT32 bank);
140   void vii_do_i2c();
142   void do_dma(UINT32 len);
143   void do_gpio(UINT32 offset);
144   void switch_bank(UINT32 bank);
145   void do_i2c();
141146   void spg_do_dma(UINT32 len);
142147   DECLARE_DRIVER_INIT(vsmile);
143148   DECLARE_DRIVER_INIT(walle);
r32357r32358
154159   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart);
155160
156161protected:
157   required_memory_region m_region_cpu;
158   optional_memory_region m_region_cart;
162   optional_memory_region m_bios_rom;
159163   required_ioport m_io_p1;
160164
161   void vii_blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile);
162   void vii_blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs);
163   void vii_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr);
164   void vii_blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth);
165   memory_region *m_cart_rom;
166
167   void blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile);
168   void blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs);
169   void blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr);
170   void blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth);
165171   inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4);
166172   inline UINT8 expand_rgb5_to_rgb8(UINT8 val);
167   inline UINT8 vii_mix_channel(UINT8 a, UINT8 b);
168   void vii_mix_pixel(UINT32 offset, UINT16 rgb);
169   void vii_set_pixel(UINT32 offset, UINT16 rgb);
173   inline UINT8 mix_channel(UINT8 a, UINT8 b);
174   void mix_pixel(UINT32 offset, UINT16 rgb);
175   void set_pixel(UINT32 offset, UINT16 rgb);
170176};
171177
172178enum
r32357r32358
217223}
218224
219225// Perform a lerp between a and b
220inline UINT8 vii_state::vii_mix_channel(UINT8 a, UINT8 b)
226inline UINT8 vii_state::mix_channel(UINT8 a, UINT8 b)
221227{
222228   UINT8 alpha = m_video_regs[0x1c] & 0x00ff;
223229   return ((64 - alpha) * a + alpha * b) / 64;
224230}
225231
226void vii_state::vii_mix_pixel(UINT32 offset, UINT16 rgb)
232void vii_state::mix_pixel(UINT32 offset, UINT16 rgb)
227233{
228   m_screenram[offset].r = vii_mix_channel(m_screenram[offset].r, expand_rgb5_to_rgb8(rgb >> 10));
229   m_screenram[offset].g = vii_mix_channel(m_screenram[offset].g, expand_rgb5_to_rgb8(rgb >> 5));
230   m_screenram[offset].b = vii_mix_channel(m_screenram[offset].b, expand_rgb5_to_rgb8(rgb));
234   m_screenram[offset].r = mix_channel(m_screenram[offset].r, expand_rgb5_to_rgb8(rgb >> 10));
235   m_screenram[offset].g = mix_channel(m_screenram[offset].g, expand_rgb5_to_rgb8(rgb >> 5));
236   m_screenram[offset].b = mix_channel(m_screenram[offset].b, expand_rgb5_to_rgb8(rgb));
231237}
232238
233void vii_state::vii_set_pixel(UINT32 offset, UINT16 rgb)
239void vii_state::set_pixel(UINT32 offset, UINT16 rgb)
234240{
235241   m_screenram[offset].r = expand_rgb5_to_rgb8(rgb >> 10);
236242   m_screenram[offset].g = expand_rgb5_to_rgb8(rgb >> 5);
237243   m_screenram[offset].b = expand_rgb5_to_rgb8(rgb);
238244}
239245
240void vii_state::vii_blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile)
246void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile)
241247{
242248   address_space &space = m_maincpu->space(AS_PROGRAM);
243249
r32357r32358
293299            {
294300               if (attr & 0x4000)
295301               {
296                  vii_mix_pixel(xx + 320*yy, rgb);
302                  mix_pixel(xx + 320*yy, rgb);
297303               }
298304               else
299305               {
300                  vii_set_pixel(xx + 320*yy, rgb);
306                  set_pixel(xx + 320*yy, rgb);
301307               }
302308            }
303309         }
r32357r32358
305311   }
306312}
307313
308void vii_state::vii_blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs)
314void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs)
309315{
310316   UINT32 x0, y0;
311317   UINT32 xscroll = regs[0];
r32357r32358
369375         yy = ((h*y0 - yscroll + 0x10) & 0xff) - 0x10;
370376         xx = (w*x0 - xscroll) & 0x1ff;
371377
372         vii_blit(bitmap, cliprect, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
378         blit(bitmap, cliprect, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
373379      }
374380   }
375381}
376382
377void vii_state::vii_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr)
383void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr)
378384{
379385   address_space &space = m_maincpu->space(AS_PROGRAM);
380386   UINT16 tile, attr;
r32357r32358
412418   x &= 0x01ff;
413419   y &= 0x01ff;
414420
415   vii_blit(bitmap, cliprect, x, y, attr, 0, bitmap_addr, tile);
421   blit(bitmap, cliprect, x, y, attr, 0, bitmap_addr, tile);
416422}
417423
418void vii_state::vii_blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth)
424void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth)
419425{
420426   UINT32 n;
421427
r32357r32358
428434   {
429435      //if(space.read_word((0x2c00 + 4*n) << 1))
430436      {
431         vii_blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n);
437         blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n);
432438      }
433439   }
434440}
r32357r32358
443449
444450   for(i = 0; i < 4; i++)
445451   {
446      vii_blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x20], m_video_regs + 0x10);
447      vii_blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x21], m_video_regs + 0x16);
448      vii_blit_sprites(bitmap, cliprect, i);
452      blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x20], m_video_regs + 0x10);
453      blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x21], m_video_regs + 0x16);
454      blit_sprites(bitmap, cliprect, i);
449455   }
450456
451457   for(y = 0; y < 240; y++)
r32357r32358
463469*    Machine Hardware    *
464470*************************/
465471
466void vii_state::vii_do_dma(UINT32 len)
472void vii_state::do_dma(UINT32 len)
467473{
468474   address_space &mem = m_maincpu->space(AS_PROGRAM);
469475   UINT32 src = m_video_regs[0x70];
r32357r32358
479485   m_video_regs[0x63] |= 4;
480486}
481487
482READ16_MEMBER( vii_state::vii_video_r )
488READ16_MEMBER( vii_state::video_r )
483489{
484490   switch(offset)
485491   {
486492      case 0x62: // Video IRQ Enable
487         verboselog(0, "vii_video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE);
493         verboselog(0, "video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE);
488494         return VII_VIDEO_IRQ_ENABLE;
489495
490496      case 0x63: // Video IRQ Status
491         verboselog(0, "vii_video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS);
497         verboselog(0, "video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS);
492498         return VII_VIDEO_IRQ_STATUS;
493499
494500      default:
495         verboselog(0, "vii_video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]);
501         verboselog(0, "video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]);
496502         break;
497503   }
498504   return m_video_regs[offset];
499505}
500506
501WRITE16_MEMBER( vii_state::vii_video_w )
507WRITE16_MEMBER( vii_state::video_w )
502508{
503509   switch(offset)
504510   {
r32357r32358
517523         COMBINE_DATA(&m_video_regs[offset]);
518524         break;
519525      case 0x62: // Video IRQ Enable
520         verboselog(0, "vii_video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask);
526         verboselog(0, "video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask);
521527         COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE);
522528         break;
523529
524530      case 0x63: // Video IRQ Acknowledge
525         verboselog(0, "vii_video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
531         verboselog(0, "video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
526532         VII_VIDEO_IRQ_STATUS &= ~data;
527533         if(!VII_VIDEO_IRQ_STATUS)
528534         {
r32357r32358
531537         break;
532538
533539      case 0x70: // Video DMA Source
534         verboselog(0, "vii_video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask);
540         verboselog(0, "video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask);
535541         COMBINE_DATA(&m_video_regs[offset]);
536542         break;
537543
538544      case 0x71: // Video DMA Dest
539         verboselog(0, "vii_video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask);
545         verboselog(0, "video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask);
540546         COMBINE_DATA(&m_video_regs[offset]);
541547         break;
542548
543549      case 0x72: // Video DMA Length
544         verboselog(0, "vii_video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask);
545         vii_do_dma(data);
550         verboselog(0, "video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask);
551         do_dma(data);
546552         break;
547553
548554      default:
549         verboselog(0, "vii_video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask);
555         verboselog(0, "video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask);
550556         COMBINE_DATA(&m_video_regs[offset]);
551557         break;
552558   }
553559}
554560
555READ16_MEMBER( vii_state::vii_audio_r )
561READ16_MEMBER( vii_state::audio_r )
556562{
557563   switch(offset)
558564   {
559565      default:
560         verboselog(4, "vii_audio_r: Unknown register %04x\n", 0x3000 + offset);
566         verboselog(4, "audio_r: Unknown register %04x\n", 0x3000 + offset);
561567         break;
562568   }
563569   return 0;
564570}
565571
566WRITE16_MEMBER( vii_state::vii_audio_w )
572WRITE16_MEMBER( vii_state::audio_w )
567573{
568574   switch(offset)
569575   {
570576      default:
571         verboselog(4, "vii_audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask);
577         verboselog(4, "audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask);
572578         break;
573579   }
574580}
575581
576void vii_state::vii_switch_bank(UINT32 bank)
582void vii_state::switch_bank(UINT32 bank)
577583{
578   UINT8 *cart = m_region_cart->base();
579
580   if(bank != m_current_bank)
584   if (bank != m_current_bank)
581585   {
582586      m_current_bank = bank;
583
584      memcpy(m_p_cart, cart + 0x400000 * bank * 2 + 0x4000*2, (0x400000 - 0x4000) * 2);
587      if (m_cart_rom)
588         memcpy(m_p_cart, m_cart_rom->base() + 0x400000 * bank * 2, 0x400000 * 2);
589      else
590         memcpy(m_p_cart, m_bios_rom->base() + 0x400000 * bank * 2, 0x400000 * 2);
585591   }
586592}
587593
588void vii_state::vii_do_gpio(UINT32 offset)
594void vii_state::do_gpio(UINT32 offset)
589595{
590596   UINT32 index  = (offset - 1) / 5;
591597   UINT16 buffer = m_io_regs[5*index + 2];
r32357r32358
604610      if(index == 1)
605611      {
606612         UINT32 bank = ((what & 0x80) >> 7) | ((what & 0x20) >> 4);
607         vii_switch_bank(bank);
613         switch_bank(bank);
608614      }
609615   }
610616   else if (m_spg243_mode == SPG243_BATMAN)
r32357r32358
626632      {
627633      }
628634   }
635   else if (m_spg243_mode == SPG243_VSMILE)
636   {
637      // TODO: find out how vsmile accesses these GPIO regs!
638   }
629639
630640   m_io_regs[5*index + 1] = what;
631641}
632642
633void vii_state::vii_do_i2c()
643void vii_state::do_i2c()
634644{
635645}
636646
r32357r32358
648658   m_io_regs[0x102] = 0;
649659}
650660
651READ16_MEMBER( vii_state::vii_io_r )
661READ16_MEMBER( vii_state::io_r )
652662{
653663   static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
654664   static const char gpioports[] = { 'A', 'B', 'C' };
r32357r32358
660670   switch(offset)
661671   {
662672      case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C
663         vii_do_gpio(offset);
664         verboselog(3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
673         do_gpio(offset);
674         verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
665675         val = m_io_regs[offset];
666676         break;
667677
668678      case 0x02: case 0x03: case 0x04: case 0x05:
669679      case 0x07: case 0x08: case 0x09: case 0x0a:
670680      case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs
671         verboselog(3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
681         verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
672682         break;
673683
674684      case 0x1c: // Random
675685         val = machine().rand() & 0x00ff;
676         verboselog(3, "vii_io_r: Random = %04x (%04x)\n", val, mem_mask);
686         verboselog(3, "io_r: Random = %04x (%04x)\n", val, mem_mask);
677687         break;
678688
679689      case 0x21: // IRQ Control
680         verboselog(3, "vii_io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask);
690         verboselog(3, "io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask);
681691         break;
682692
683693      case 0x22: // IRQ Status
684         verboselog(3, "vii_io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask);
694         verboselog(3, "io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask);
685695         break;
686696
687697      case 0x2c: case 0x2d: // Timers?
688698         val = machine().rand() & 0x0000ffff;
689         verboselog(3, "vii_io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask);
699         verboselog(3, "io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask);
690700         break;
691701
692702      case 0x2f: // Data Segment
693703         val = m_maincpu->state_int(UNSP_SR) >> 10;
694         verboselog(3, "vii_io_r: Data Segment = %04x (%04x)\n", val, mem_mask);
704         verboselog(3, "io_r: Data Segment = %04x (%04x)\n", val, mem_mask);
695705         break;
696706
697707      case 0x31: // Unknown, UART Status?
698         verboselog(3, "vii_io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask);
708         verboselog(3, "io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask);
699709         val = 3;
700710         break;
701711
702712      case 0x36: // UART RX Data
703713         val = m_controller_input[m_uart_rx_count];
704714         m_uart_rx_count = (m_uart_rx_count + 1) % 8;
705         verboselog(3, "vii_io_r: UART RX Data = %04x (%04x)\n", val, mem_mask);
715         verboselog(3, "io_r: UART RX Data = %04x (%04x)\n", val, mem_mask);
706716         break;
707717
708718      case 0x59: // I2C Status
709         verboselog(3, "vii_io_r: I2C Status = %04x (%04x)\n", val, mem_mask);
719         verboselog(3, "io_r: I2C Status = %04x (%04x)\n", val, mem_mask);
710720         break;
711721
712722      case 0x5e: // I2C Data In
713         verboselog(3, "vii_io_r: I2C Data In = %04x (%04x)\n", val, mem_mask);
723         verboselog(3, "io_r: I2C Data In = %04x (%04x)\n", val, mem_mask);
714724         break;
715725
716726      default:
717         verboselog(3, "vii_io_r: Unknown register %04x\n", 0x3d00 + offset);
727         verboselog(3, "io_r: Unknown register %04x\n", 0x3d00 + offset);
718728         break;
719729   }
720730
721731   return val;
722732}
723733
724WRITE16_MEMBER( vii_state::vii_io_w )
734WRITE16_MEMBER( vii_state::io_w )
725735{
726736   static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
727737   static const char gpioports[3] = { 'A', 'B', 'C' };
r32357r32358
733743   switch(offset)
734744   {
735745      case 0x00: // GPIO special function select
736         verboselog(3, "vii_io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask);
746         verboselog(3, "io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask);
737747         COMBINE_DATA(&m_io_regs[offset]);
738748         break;
739749
r32357r32358
744754      case 0x02: case 0x03: case 0x04: case 0x05: // Port A
745755      case 0x07: case 0x08: case 0x09: case 0x0a: // Port B
746756      case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C
747         verboselog(3, "vii_io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask);
757         verboselog(3, "io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask);
748758         COMBINE_DATA(&m_io_regs[offset]);
749         vii_do_gpio(offset);
759         do_gpio(offset);
750760         break;
751761
752762      case 0x10:      // timebase control
r32357r32358
763773         COMBINE_DATA(&m_io_regs[offset]);
764774         break;
765775      case 0x21: // IRQ Enable
766         verboselog(3, "vii_io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask);
776         verboselog(3, "io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask);
767777         COMBINE_DATA(&VII_CTLR_IRQ_ENABLE);
768778         if(!VII_CTLR_IRQ_ENABLE)
769779         {
r32357r32358
772782         break;
773783
774784      case 0x22: // IRQ Acknowledge
775         verboselog(3, "vii_io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
785         verboselog(3, "io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
776786         m_io_regs[0x22] &= ~data;
777787         if(!m_io_regs[0x22])
778788         {
r32357r32358
783793      case 0x2f: // Data Segment
784794         temp = m_maincpu->state_int(UNSP_SR);
785795         m_maincpu->set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10));
786         verboselog(3, "vii_io_w: Data Segment = %04x (%04x)\n", data, mem_mask);
796         verboselog(3, "io_w: Data Segment = %04x (%04x)\n", data, mem_mask);
787797         break;
788798
789799      case 0x31: // Unknown UART
790         verboselog(3, "vii_io_w: Unknown UART = %04x (%04x)\n", data, mem_mask);
800         verboselog(3, "io_w: Unknown UART = %04x (%04x)\n", data, mem_mask);
791801         COMBINE_DATA(&m_io_regs[offset]);
792802         break;
793803
794804      case 0x32: // UART Reset
795         verboselog(3, "vii_io_r: UART Reset\n");
805         verboselog(3, "io_w: UART Reset\n");
796806         break;
797807
798808      case 0x33: // UART Baud Rate
799         verboselog(3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data));
809         verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data));
800810         COMBINE_DATA(&m_io_regs[offset]);
801811         break;
802812
803813      case 0x35: // UART TX Data
804         verboselog(3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33]));
814         verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33]));
805815         COMBINE_DATA(&m_io_regs[offset]);
806816         break;
807817
808818      case 0x5a: // I2C Access Mode
809         verboselog(3, "vii_io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask);
819         verboselog(3, "io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask);
810820         COMBINE_DATA(&m_io_regs[offset]);
811821         break;
812822
813823      case 0x5b: // I2C Device Address
814         verboselog(3, "vii_io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask);
824         verboselog(3, "io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask);
815825         COMBINE_DATA(&m_io_regs[offset]);
816826         break;
817827
818828      case 0x5c: // I2C Sub-Address
819         verboselog(3, "vii_io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask);
829         verboselog(3, "io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask);
820830         COMBINE_DATA(&m_io_regs[offset]);
821831         break;
822832
823833      case 0x5d: // I2C Data Out
824         verboselog(3, "vii_io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask);
834         verboselog(3, "io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask);
825835         COMBINE_DATA(&m_io_regs[offset]);
826836         break;
827837
828838      case 0x5e: // I2C Data In
829         verboselog(3, "vii_io_w: I2C Data In = %04x (%04x)\n", data, mem_mask);
839         verboselog(3, "io_w: I2C Data In = %04x (%04x)\n", data, mem_mask);
830840         COMBINE_DATA(&m_io_regs[offset]);
831841         break;
832842
833843      case 0x5f: // I2C Controller Mode
834         verboselog(3, "vii_io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask);
844         verboselog(3, "io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask);
835845         COMBINE_DATA(&m_io_regs[offset]);
836846         break;
837847
838848      case 0x58: // I2C Command
839         verboselog(3, "vii_io_w: I2C Command = %04x (%04x)\n", data, mem_mask);
849         verboselog(3, "io_w: I2C Command = %04x (%04x)\n", data, mem_mask);
840850         COMBINE_DATA(&m_io_regs[offset]);
841         vii_do_i2c();
851         do_i2c();
842852         break;
843853
844854      case 0x59: // I2C Status / IRQ Acknowledge(?)
845         verboselog(3, "vii_io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask);
855         verboselog(3, "io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask);
846856         m_io_regs[offset] &= ~data;
847857         break;
848858
r32357r32358
857867         break;
858868
859869      default:
860         verboselog(3, "vii_io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask);
870         verboselog(3, "io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask);
861871         COMBINE_DATA(&m_io_regs[offset]);
862872         break;
863873   }
864874}
865875
866876/*
867WRITE16_MEMBER( vii_state::vii_rowscroll_w )
877WRITE16_MEMBER( vii_state::rowscroll_w )
868878{
869879    switch(offset)
870880    {
871881        default:
872            verboselog(0, "vii_rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask);
882            verboselog(0, "rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask);
873883            break;
874884    }
875885}
876886
877WRITE16_MEMBER( vii_state::vii_spriteram_w )
887WRITE16_MEMBER( vii_state::spriteram_w )
878888{
879889    switch(offset)
880890    {
881891        default:
882            verboselog(0, "vii_spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask);
892            verboselog(0, "spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask);
883893            break;
884894    }
885895}
886896*/
887897
898READ16_MEMBER( vii_state::rom_r )
899{
900   return m_p_cart[offset + 0x4000];
901}
902
888903static ADDRESS_MAP_START( vii_mem, AS_PROGRAM, 16, vii_state )
889904   AM_RANGE( 0x000000, 0x004fff ) AM_RAM AM_SHARE("p_ram")
890   AM_RANGE( 0x005000, 0x0051ff ) AM_READWRITE(vii_video_r, vii_video_w)
905   AM_RANGE( 0x005000, 0x0051ff ) AM_READWRITE(video_r, video_w)
891906   AM_RANGE( 0x005200, 0x0055ff ) AM_RAM AM_SHARE("p_rowscroll")
892907   AM_RANGE( 0x005600, 0x0057ff ) AM_RAM AM_SHARE("p_palette")
893908   AM_RANGE( 0x005800, 0x005fff ) AM_RAM AM_SHARE("p_spriteram")
894   AM_RANGE( 0x006000, 0x006fff ) AM_READWRITE(vii_audio_r, vii_audio_w)
895   AM_RANGE( 0x007000, 0x007fff ) AM_READWRITE(vii_io_r,    vii_io_w)
896   AM_RANGE( 0x008000, 0x7fffff ) AM_ROM AM_SHARE("p_cart")
909   AM_RANGE( 0x006000, 0x006fff ) AM_READWRITE(audio_r, audio_w)
910   AM_RANGE( 0x007000, 0x007fff ) AM_READWRITE(io_r,    io_w)
911   AM_RANGE( 0x008000, 0x7fffff ) AM_READ(rom_r)
897912ADDRESS_MAP_END
898913
899914static INPUT_PORTS_START( vii )
r32357r32358
943958INPUT_PORTS_END
944959
945960
946DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart )
961void vii_state::test_centered(UINT8 *ROM)
947962{
948   UINT8 *cart = m_region_cart->base();
949   if (image.software_entry() == NULL)
963   if (ROM[0x3cd808] == 0x99 &&
964       ROM[0x3cd809] == 0x99 &&
965       ROM[0x3cd80a] == 0x83 &&
966       ROM[0x3cd80b] == 0x5e &&
967       ROM[0x3cd80c] == 0x52 &&
968       ROM[0x3cd80d] == 0x6b &&
969       ROM[0x3cd80e] == 0x78 &&
970       ROM[0x3cd80f] == 0x7f)
950971   {
951      int size = image.length();
952
953      if( image.fread(cart, size ) != size )
954      {
955         image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" );
956         return IMAGE_INIT_FAIL;
957      }
958   } else {
959      int filesize = image.get_software_region_length("rom");
960      memcpy(cart, image.get_software_region("rom"), filesize);
972      m_centered_coordinates = 0;
961973   }
974}
962975
963   memcpy(m_p_cart, cart + 0x4000*2, (0x400000 - 0x4000) * 2);
976DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart )
977{
978   UINT32 size = m_cart->common_get_size("rom");
964979
965   if( cart[0x3cd808] == 0x99 &&
966      cart[0x3cd809] == 0x99 &&
967      cart[0x3cd80a] == 0x83 &&
968      cart[0x3cd80b] == 0x5e &&
969      cart[0x3cd80c] == 0x52 &&
970      cart[0x3cd80d] == 0x6b &&
971      cart[0x3cd80e] == 0x78 &&
972      cart[0x3cd80f] == 0x7f )
980   if (size < 0x800000)
973981   {
974      m_centered_coordinates = 0;
982      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
983      return IMAGE_INIT_FAIL;
975984   }
985   
986   m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
987   m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");         
988   
989   test_centered(m_cart->get_rom_base());
990
976991   return IMAGE_INIT_PASS;
977992}
978993
979994DEVICE_IMAGE_LOAD_MEMBER( vii_state, vsmile_cart )
980995{
981   UINT8 *CART = m_region_cart->base();
982   UINT16 *ROM = (UINT16 *) m_region_cpu->base();
983   if (image.software_entry() == NULL)
984   {
985      int size = image.length();
986      image.fread(CART, size);
987   }
988   else
989   {
990      int size = image.get_software_region_length("rom");
991      memcpy(CART, image.get_software_region("rom"), size);
992   }
993
994   // for whatever reason if we copy more than this, the CPU
995   // is not happy and VSmile won't show anything... bankswitch?
996   for (int i = 0; i < 0x800000; i += 2)
997      ROM[i / 2] = pick_integer_le(CART, i, 2);
998
996   UINT32 size = m_cart->common_get_size("rom");
997   
998   m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
999   m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");         
1000   
9991001   return IMAGE_INIT_PASS;
10001002}
10011003
r32357r32358
10211023   m_controller_input[6] = 0xff;
10221024   m_controller_input[7] = 0;
10231025
1024   if ( m_region_cart && m_spg243_mode == SPG243_VII)
1026   m_p_cart.resize(0x400000);
1027
1028   if (m_cart && m_cart->exists())
10251029   {
1026      UINT8 *rom = m_region_cart->base();
1027      memcpy(m_p_cart, rom + 0x4000*2, (0x400000 - 0x4000) * 2);
1030      astring region_tag;
1031      m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
1032      memcpy(m_p_cart, m_cart_rom->base(), 0x400000 * 2);
10281033   }
1029
1034   else if (m_spg243_mode == SPG243_VII)   // Vii bios is banked
1035      memcpy(m_p_cart, m_bios_rom->base(), 0x400000 * 2);
1036   else
1037      memcpy(m_p_cart, memregion("maincpu")->base(), 0x400000 * 2);
1038   
10301039   m_video_regs[0x36] = 0xffff;
10311040   m_video_regs[0x37] = 0xffff;
10321041
r32357r32358
11221131   MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii)
11231132   MCFG_PALETTE_ADD("palette", 32768)
11241133
1125   MCFG_CARTSLOT_ADD( "cart" )
1126   MCFG_CARTSLOT_EXTENSION_LIST( "bin" )
1127   MCFG_CARTSLOT_LOAD( vii_state, vii_cart )
1128   MCFG_CARTSLOT_INTERFACE("vii_cart")
1134   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vii_cart")
1135   MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH)
1136   MCFG_GENERIC_LOAD(vii_state, vii_cart)
11291137
11301138   MCFG_SOFTWARE_LIST_ADD("vii_cart","vii")
11311139MACHINE_CONFIG_END
r32357r32358
11441152   MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii)
11451153   MCFG_PALETTE_ADD("palette", 32768)
11461154
1147   MCFG_CARTSLOT_ADD( "cart" )
1148   MCFG_CARTSLOT_EXTENSION_LIST( "bin" )
1149   MCFG_CARTSLOT_LOAD( vii_state, vsmile_cart )
1150   MCFG_CARTSLOT_INTERFACE("vsmile_cart")
1155   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vsmile_cart")
1156   MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH)
1157   MCFG_GENERIC_LOAD(vii_state, vsmile_cart)
11511158
11521159   MCFG_SOFTWARE_LIST_ADD("cart_list","vsmile_cart")
11531160MACHINE_CONFIG_END
r32357r32358
11841191
11851192DRIVER_INIT_MEMBER(vii_state,vsmile)
11861193{
1187   m_spg243_mode = SPG243_BATMAN;//SPG243_VSMILE;
1194   m_spg243_mode = SPG243_VSMILE;
11881195   m_centered_coordinates = 1;
11891196}
11901197
r32357r32358
11971204ROM_START( vii )
11981205   ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF )      /* dummy region for u'nSP */
11991206
1200   ROM_REGION( 0x2000000, "cart", ROMREGION_ERASE00 )
1207   ROM_REGION( 0x2000000, "bios", 0 )
12011208   ROM_LOAD( "vii.bin", 0x0000, 0x2000000, CRC(04627639) SHA1(f883a92d31b53c9a5b0cdb112d07cd793c95fc43))
1202   ROM_CART_LOAD("cart", 0x0000, 0x2000000, ROM_MIRROR)
12031209ROM_END
12041210
12051211ROM_START( batmantv )
r32357r32358
12101216ROM_START( vsmile )
12111217   ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF )      /* dummy region for u'nSP */
12121218   ROM_LOAD16_WORD_SWAP( "bios german.bin", 0x000000, 0x200000, CRC(205c5296) SHA1(7fbcf761b5885c8b1524607aabaf364b4559c8cc) )
1213
1214   ROM_REGION( 0x2000000, "cart", ROMREGION_ERASE00 )
12151219ROM_END
12161220
12171221ROM_START( walle )
trunk/src/mess/includes/x07.h
r32357r32358
1212#include "machine/nvram.h"
1313#include "machine/ram.h"
1414#include "sound/wave.h"
15#include "imagedev/cartslot.h"
1615#include "imagedev/cassette.h"
1716#include "imagedev/printer.h"
1817#include "formats/x07_cas.h"
18#include "bus/generic/slot.h"
19#include "bus/generic/carts.h"
1920#include "rendlay.h"
2021
2122//default value for user defined keys, taken for official documentation
r32357r32358
168169         m_nvram1(*this, "nvram1"),
169170         m_nvram2(*this, "nvram2"),
170171         m_cassette(*this, "cassette"),
172         m_card(*this, "cardslot"),
171173         m_warm_start(1)
172174   { }
173175
r32357r32358
178180   required_device<nvram_device> m_nvram1;
179181   required_device<nvram_device> m_nvram2;
180182   required_device<cassette_image_device> m_cassette;
183   required_device<generic_slot_device> m_card;
181184
182185   void machine_start();
183186   void machine_reset();

Previous 199869 Revisions Next


© 1997-2024 The MAME Team