Previous 199869 Revisions Next

r32085 Friday 12th September, 2014 at 19:04:02 UTC by Fabio Priuli
(MESS) a7800: reworked header handling (used when
loading from fullpath) and attempted to implement flexibly
and transparently support for several possible homebrew
boards with a POKEY hooked up as Beef Drop. nw.
[src/emu/bus/a7800]a78_carts.h a78_slot.c a78_slot.h cpuwiz.c cpuwiz.h rom.c rom.h
[src/mess/drivers]a7800.c

trunk/src/emu/bus/a7800/rom.c
r32084r32085
3030const device_type A78_ROM_SG_POKEY = &device_creator<a78_rom_sg_pokey_device>;
3131const device_type A78_ROM_SG_RAM = &device_creator<a78_rom_sg_ram_device>;
3232const device_type A78_ROM_SG9 = &device_creator<a78_rom_sg9_device>;
33const device_type A78_ROM_SG9_POKEY = &device_creator<a78_rom_sg9_pokey_device>;
3433const device_type A78_ROM_ABSOLUTE = &device_creator<a78_rom_abs_device>;
3534const device_type A78_ROM_ACTIVISION = &device_creator<a78_rom_act_device>;
3635
3736
37const device_type A78_ROM_P450 = &device_creator<a78_rom_p450_device>;
38const device_type A78_ROM_P450_POKEY = &device_creator<a78_rom_p450_pokey_device>;
39const device_type A78_ROM_P450_SG_RAM = &device_creator<a78_rom_p450_sg_ram_device>;
40const device_type A78_ROM_P450_SG9 = &device_creator<a78_rom_p450_sg9_device>;
41
42
3843a78_rom_device::a78_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)
3944               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
4045                  device_a78_cart_interface( mconfig, *this )
r32084r32085
4752{
4853}
4954
55a78_rom_pokey_device::a78_rom_pokey_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)
56               : a78_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
57                  m_pokey(*this, "pokey")
58{
59}
60
5061a78_rom_pokey_device::a78_rom_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5162               : a78_rom_device(mconfig, A78_ROM_POKEY, "Atari 7800 ROM Carts w/no Bankswitch + POKEY", tag, owner, clock, "a78_rom_pok", __FILE__),
5263                  m_pokey(*this, "pokey")
r32084r32085
7182}
7283
7384
85a78_rom_sg_ram_device::a78_rom_sg_ram_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)
86               : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source)
87{
88}
89
7490a78_rom_sg_ram_device::a78_rom_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
7591               : a78_rom_sg_device(mconfig, A78_ROM_SG_RAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + RAM", tag, owner, clock, "a78_rom_sgr", __FILE__)
7692{
r32084r32085
88104}
89105
90106
91a78_rom_sg9_pokey_device::a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
92               : a78_rom_sg9_device(mconfig, A78_ROM_SG9_POKEY, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY", tag, owner, clock, "a78_rom_sg9p", __FILE__),
93                  m_pokey(*this, "pokey")
94{
95}
96
97
98107a78_rom_abs_device::a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
99108               : a78_rom_device(mconfig, A78_ROM_ABSOLUTE, "Atari 7800 ROM Carts w/Absolute Bankswitch", tag, owner, clock, "a78_rom_abs", __FILE__)
100109{
r32084r32085
108117
109118
110119
120a78_rom_p450_device::a78_rom_p450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
121               : a78_rom_device(mconfig, A78_ROM_P450, "Atari 7800 ROM Carts w/POKEY @ 0x0450", tag, owner, clock, "a78_p450_t0", __FILE__),
122                  m_pokey450(*this, "pokey450")
123{
124}
125
126a78_rom_p450_pokey_device::a78_rom_p450_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
127               : a78_rom_pokey_device(mconfig, A78_ROM_P450_POKEY, "Atari 7800 ROM Carts w/no Bankswitch + POKEY + POKEY @ 0x0450", tag, owner, clock, "a78_p450_t1", __FILE__),
128                  m_pokey450(*this, "pokey450")
129{
130}
131
132a78_rom_p450_sg_ram_device::a78_rom_p450_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
133               : a78_rom_sg_ram_device(mconfig, A78_ROM_P450_SG_RAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + RAM + POKEY @ 0x0450", tag, owner, clock, "a78_p450_t6", __FILE__),
134                  m_pokey450(*this, "pokey450")
135{
136}
137
138a78_rom_p450_sg9_device::a78_rom_p450_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
139               : a78_rom_sg9_device(mconfig, A78_ROM_P450_SG9, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY @ 0x0450", tag, owner, clock, "a78_p450_ta", __FILE__),
140                  m_pokey450(*this, "pokey450")
141{
142}
143
144
145
111146void a78_rom_device::device_start()
112147{
113148}
r32084r32085
154189   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
155190MACHINE_CONFIG_END
156191
192static MACHINE_CONFIG_FRAGMENT( a78_pokey450 )
193   MCFG_SPEAKER_STANDARD_MONO("pokey_450")
157194
195   MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8)
196   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "pokey_450", 1.00)
197MACHINE_CONFIG_END
198
199static MACHINE_CONFIG_FRAGMENT( a78_2pokeys )
200   MCFG_SPEAKER_STANDARD_MONO("addon")
201
202   MCFG_SOUND_ADD("pokey", POKEY, XTAL_14_31818MHz/8)
203   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
204
205   MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8)
206   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
207MACHINE_CONFIG_END
208
209
158210/*-------------------------------------------------
159211 mapper specific handlers
160212 -------------------------------------------------*/
r32084r32085
311363 9 x 16K banks mappable in 0x8000-0xbfff
312364 bank 7 is always mapped in 0xc000-0xffff
313365 
314 GAMES: Alien Brigade & Crossbow
366 GAMES: Alien Brigade & Crossbow + some homebrew
367 like Donkey Kong XM demo, Bentley Bear's Crystal
368 Quest
315369 
316370 -------------------------------------------------*/
317371
r32084r32085
333387
334388/*-------------------------------------------------
335389 
336 Carts with SuperGame bankswitch 9banks + POKEY:
337 This was not used in any commercial game released
338 during A7800 lifespan, but it is used by Donkey
339 Kong XM demo and by Bentley Bear's Crystal Quest
340 for use with XM expansion module or XBoarD expansion
341 
342 GAMES: Donkey Kong XM demo, Bentley Bear's Crystal
343 Quest
344 
345 -------------------------------------------------*/
346
347WRITE8_MEMBER(a78_rom_sg9_pokey_device::write_40xx)
348{
349   if (offset < 0x4000)
350      m_pokey->write(space, offset & 0x0f, data);
351   else if (offset < 0x8000)
352      m_bank = (data & m_bank_mask) + 1;
353}
354
355machine_config_constructor a78_rom_sg9_pokey_device::device_mconfig_additions() const
356{
357   return MACHINE_CONFIG_NAME( a78_pokey );
358}
359
360/*-------------------------------------------------
361 
362390 Carts with Absolute bankswitch:
363391 64K games. Lower 32K are 2 banks of 16K to be mapped
364392 in 0x4000-0x7fff, depending on the value written
r32084r32085
442470   if (offset >= 0xbf80 && offset <= 0xbf87)
443471      m_bank = offset & 7;
444472}
473
474
475// Machine configs for PCB variants with a POKEY at $0450
476
477machine_config_constructor a78_rom_p450_device::device_mconfig_additions() const
478{
479   return MACHINE_CONFIG_NAME( a78_pokey450 );
480}
481
482machine_config_constructor a78_rom_p450_pokey_device::device_mconfig_additions() const
483{
484   return MACHINE_CONFIG_NAME( a78_2pokeys );
485}
486
487machine_config_constructor a78_rom_p450_sg_ram_device::device_mconfig_additions() const
488{
489   return MACHINE_CONFIG_NAME( a78_pokey450 );
490}
491
492machine_config_constructor a78_rom_p450_sg9_device::device_mconfig_additions() const
493{
494   return MACHINE_CONFIG_NAME( a78_pokey450 );
495}
496
trunk/src/emu/bus/a7800/a78_carts.h
r32084r32085
1515   SLOT_INTERFACE_INTERNAL("a78_sg_pokey", A78_ROM_SG_POKEY)
1616   SLOT_INTERFACE_INTERNAL("a78_sg_ram",   A78_ROM_SG_RAM)
1717   SLOT_INTERFACE_INTERNAL("a78_sg9",      A78_ROM_SG9)
18   SLOT_INTERFACE_INTERNAL("a78_sg9_pokey",A78_ROM_SG9_POKEY)    // carts compatible with the expansions below (basically a 9Banks+POKEY)
1918   SLOT_INTERFACE_INTERNAL("a78_abs",      A78_ROM_ABSOLUTE)
2019   SLOT_INTERFACE_INTERNAL("a78_act",      A78_ROM_ACTIVISION)
2120   SLOT_INTERFACE_INTERNAL("a78_hsc",      A78_HISCORE)
r32084r32085
2322   SLOT_INTERFACE_INTERNAL("a78_xm",       A78_XM)       // the actual XM expansion (as passthru)
2423   SLOT_INTERFACE_INTERNAL("a78_megacart", A78_ROM_MEGACART)   
2524   SLOT_INTERFACE_INTERNAL("a78_versa",    A78_ROM_VERSABOARD)   
26   SLOT_INTERFACE_INTERNAL("a78_versap",   A78_ROM_VERSAPOKEY)   // For debugging purposes
25   // cart variants with a POKEY at 0x0450 (typically a VersaBoard variant, or an homebrew pcb)
26   SLOT_INTERFACE_INTERNAL("a78_p450_t0",  A78_ROM_P450)
27   SLOT_INTERFACE_INTERNAL("a78_p450_t1",  A78_ROM_P450_POKEY)
28   SLOT_INTERFACE_INTERNAL("a78_p450_t6",  A78_ROM_P450_SG_RAM)
29   SLOT_INTERFACE_INTERNAL("a78_p450_ta",  A78_ROM_P450_SG9)
30   SLOT_INTERFACE_INTERNAL("a78_p450_vb",  A78_ROM_P450_VB)
2731SLOT_INTERFACE_END
2832
2933
trunk/src/emu/bus/a7800/a78_slot.c
r32084r32085
157157 call load
158158 -------------------------------------------------*/
159159
160int a78_cart_slot_device::validate_header(int head, bool log)
161{
162   switch (head & 0x3d)
163   {
164      case 0x05:
165         if (log)
166         {
167            printf("POKEY + RAM at $4000 (Header 0x05)\n");
168            printf("Disabling POKEY\n");
169         }
170         head &= ~0x01;
171         break;
172      case 0x09:
173         if (log)
174         {
175            printf("POKEY + Bank 0 of 144K ROM  at $4000 (Header 0x09)\n");
176            printf("Disabling POKEY\n");
177         }
178         head &= ~0x01;
179         break;
180      case 0x11:
181         if (log)
182         {
183            printf("POKEY + Bank 6 ROM at $4000 (Header 0x11)\n");
184            printf("Disabling POKEY\n");
185         }
186         head &= ~0x01;
187         break;
188      case 0x21:
189         if (log)
190         {
191            printf("POKEY + banked RAM at $4000 (Header 0x21)\n");
192            printf("Disabling POKEY\n");
193         }
194         head &= ~0x01;
195         break;
196      case 0x0c:
197         if (log)
198         {
199            printf("RAM + Bank 0 of 144K ROM at $4000 (Header 0x0c)\n");
200            printf("Disabling RAM\n");
201         }
202         head &= ~0x04;
203         break;
204      case 0x14:
205         if (log)
206         {
207            printf("RAM + Bank 6 ROM at $4000 (Header 0x14)\n");
208            printf("Disabling RAM\n");
209         }
210         head &= ~0x04;
211         break;
212      case 0x24:
213         if (log)
214         {
215            printf("RAM + Banked RAM at $4000 (Header 0x24)\n");
216            printf("Disabling RAM\n");
217         }
218         head &= ~0x04;
219         break;
220      case 0x18:
221         if (log)
222         {
223            printf("Bank 0 of 144K ROM + Bank 6 ROM at $4000 (Header 0x18)\n");
224            printf("Disabling Bank 0 ROM\n");
225         }
226         head &= ~0x08;
227         break;
228      case 0x28:
229         if (log)
230         {
231            printf("Bank 0 of 144K ROM + Banked RAM at $4000 (Header 0x28)\n");
232            printf("Disabling Bank 0 ROM\n");
233         }
234         head &= ~0x08;
235         break;
236      case 0x30:
237         if (log)
238         {
239            printf("Bank 6 ROM + banked RAM at $4000 (Header 0x30)\n");
240            printf("Disabling Bank 6 ROM\n");
241         }
242         head &= ~0x10;
243         break;
244   }
245
246   if ((head & 0x3c) && !(head & 0x02))
247   {
248      if (log)
249      {
250         printf("SuperCart bankswitch detected at $4000, with no SuperCart bit (Header 0x%X)\n", head);
251         printf("Enablig SuperCart bankswitch\n");
252      }
253      head |= 0x02;
254   }
255
256   if ((head & 0xff00) == 0x100 && (head & 0xff))
257   {
258      if (log)
259      {
260         printf("Bankswitch detected for an Activision cart (Header 0x%X)\n", head);
261         printf("Disabling bankswitch\n");
262      }
263      head &= 0xff00;
264   }
265
266   if ((head & 0xff00) == 0x200 && (head & 0xff))
267   {
268      if (log)
269      {
270         printf("Bankswitch detected for an Absolute cart (Header 0x%X)\n", head);
271         printf("Disabling bankswitch\n");
272      }
273      head &= 0xff00;
274   }
275   
276   if ((head & 0xff00) > 0x300)
277   {
278      if (log)
279      {
280         printf("Unsupported mapper, please contact MESSdevs (Header 0x%X)\n", head);
281         printf("Disabling special bits\n");
282      }
283      head &= 0x00ff;
284   }
285   
286   return head;
287}
288
289
160290//-------------------------------------------------
161291//  A78 PCBs
162292//-------------------------------------------------
r32084r32085
167297   const char              *slot_option;
168298};
169299
300#define A78_POKEY0450 0x20
301
170302// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
171303static const a78_slot slot_list[] =
172304{
r32084r32085
176308   { A78_TYPE3,      "a78_sg_pokey" },
177309   { A78_TYPE6,      "a78_sg_ram" },
178310   { A78_TYPEA,      "a78_sg9" },
179   { A78_TYPEB,      "a78_sg9_pokey" },
180311   { A78_ABSOLUTE,   "a78_abs" },
181312   { A78_ACTIVISION, "a78_act" },
182313   { A78_HSC,        "a78_hsc" },
r32084r32085
184315   { A78_XM_BOARD,   "a78_xm" },
185316   { A78_MEGACART,   "a78_megacart" },
186317   { A78_VERSABOARD, "a78_versa" },
187   { A78_VERSAPOKEY, "a78_versap" },
318   { A78_TYPE0_POK450, "a78_p450_t0" },
319   { A78_TYPE1_POK450, "a78_p450_t1" },
320   { A78_TYPE6_POK450, "a78_p450_t6" },
321   { A78_TYPEA_POK450, "a78_p450_ta" },
322   { A78_VERSA_POK450, "a78_p450_vb" },
188323   { A78_NOCART,     "empty" },   // the code should never get here, of course...
189324};
190325
r32084r32085
195330      if (!core_stricmp(slot_list[i].slot_option, slot))
196331         return slot_list[i].pcb_id;
197332   }
198
333   
199334   return 0;
200335}
201336
r32084r32085
206341      if (slot_list[i].pcb_id == type)
207342         return slot_list[i].slot_option;
208343   }
209
344   
210345   return "a78_rom";
211346}
212347
r32084r32085
234369      else
235370      {
236371         // Load and check the header
372         int mapper;
237373         char head[128];     
238374         fread(head, 128);
239375         
r32084r32085
247383            len = length() - 128;
248384         }
249385         
250         switch ((head[53] << 8) | head[54])
386         // let's try to auto-fix some common errors in the header
387         mapper = validate_header((head[53] << 8) | head[54], TRUE);
388
389         switch (mapper & 0xfe)
251390         {
252391            case 0x0000:
253               m_type = A78_TYPE0;
392               m_type = BIT(mapper, 0) ? A78_TYPE1 : A78_TYPE0;
254393               break;
255            case 0x0001:
256               m_type = A78_TYPE1;
257               break;
258394            case 0x0002:
259               m_type = A78_TYPE2;
395               m_type = BIT(mapper, 0) ? A78_TYPE3 : A78_TYPE2;
260396               break;
261            case 0x0003:
262               m_type = A78_TYPE3;
263               break;
264397            case 0x0006:
265398               m_type = A78_TYPE6;
266399               break;
267400            case 0x000a:
268401               m_type = A78_TYPEA;
269402               break;
270            case 0x000b:
271               m_type = A78_TYPEB;
272               break;
273            case 0x0020:
403            case 0x0022:
404            case 0x0026:
274405               if (len > 0x40000)
275406                  m_type = A78_MEGACART;
276407               else
277408                  m_type = A78_VERSABOARD;
278409               break;
279            case 0x0021:
280               m_type = A78_VERSAPOKEY;
281               break;
282            case 0x0100:
283               m_type = A78_ACTIVISION;
284               break;
285            case 0x0200:
286               m_type = A78_ABSOLUTE;
287               break;
288410         }
411
412         // check special bits, which override the previous
413         if ((mapper & 0xff00) == 0x0100)
414            m_type = A78_ACTIVISION;
415         else if ((mapper & 0xff00) == 0x0200)
416            m_type = A78_ABSOLUTE;
417         else if ((mapper & 0xff00) == 0x0300)
418         {
419            // the cart has a POKEY at $0450 (typically a VersaBoard variant)!
420            if (m_type != A78_TYPE2)
421            {
422               m_type &= ~0x02;
423               m_type += A78_POKEY0450;
424            }
425         }
426
289427         logerror("Cart type: %x\n", m_type);
290428         
291429         internal_header_logging((UINT8 *)head, length());
r32084r32085
299437     
300438      if (m_type == A78_TYPE6)
301439         m_cart->ram_alloc(0x4000);
302      if (m_type == A78_MEGACART || m_type == A78_VERSABOARD || m_type == A78_VERSAPOKEY)
440      if (m_type == A78_MEGACART || (m_type >= A78_VERSABOARD && m_type <= A78_VERSA_POK450))
303441         m_cart->ram_alloc(0x8000);
304442      if (m_type == A78_XB_BOARD || m_type == A78_XM_BOARD)
305443         m_cart->ram_alloc(0x20000);
r32084r32085
374512   {
375513      const char *slot_string = "a78_rom";
376514      dynamic_buffer head(128);
377      int type = A78_TYPE0;
515      int type = A78_TYPE0, mapper;
378516     
379517      // Load and check the header
380518      core_fread(m_file, head, 128);     
381      switch ((head[53] << 8) | head[54])
519
520      // let's try to auto-fix some common errors in the header
521      mapper = validate_header((head[53] << 8) | head[54], FALSE);
522     
523      switch (mapper & 0xfe)
382524      {
383525         case 0x0000:
384            type = A78_TYPE0;
526            type = BIT(mapper, 0) ? A78_TYPE1 : A78_TYPE0;
385527            break;
386         case 0x0001:
387            type = A78_TYPE1;
388            break;
389528         case 0x0002:
390            type = A78_TYPE2;
529            type = BIT(mapper, 0) ? A78_TYPE3 : A78_TYPE2;
391530            break;
392         case 0x0003:
393            type = A78_TYPE3;
394            break;
395531         case 0x0006:
396532            type = A78_TYPE6;
397533            break;
398534         case 0x000a:
399535            type = A78_TYPEA;
400536            break;
401         case 0x000b:
402            type = A78_TYPEB;
403            break;
404         case 0x0020:
537         case 0x0022:
538         case 0x0026:
405539            if (core_fsize(m_file) > 0x40000)
406540               type = A78_MEGACART;
407541            else
408542               type = A78_VERSABOARD;
409543            break;
410         case 0x0021:
411            type = A78_VERSAPOKEY;
412            break;
413         case 0x0100:
414            type = A78_ACTIVISION;
415            break;
416         case 0x0200:
417            type = A78_ABSOLUTE;
418            break;
419544      }
545     
546      // check special bits, which override the previous
547      if ((mapper & 0xff00) == 0x0100)
548         type = A78_ACTIVISION;
549      else if ((mapper & 0xff00) == 0x0200)
550         type = A78_ABSOLUTE;
551      else if ((mapper & 0xff00) == 0x0300)
552      {
553         // the cart has a POKEY at $0450 (typically a VersaBoard variant)!
554         if (type != A78_TYPE2)
555         {
556            type &= ~0x02;
557            type += A78_POKEY0450;
558         }
559      }
560
420561      logerror("Cart type: %x\n", type);
421562      slot_string = a78_get_slot(type);
422563     
r32084r32085
497638
498639/*-------------------------------------------------
499640 A78 header logging
641 
642 A78 HEADER FORMAT
643 
644 Bytes  | Content           | Length
645 ========================================
646 0      | Header version    |  1 byte
647 -------|-------------------|------------
648 1..16  | "ATARI7800     "  | 16 bytes
649 -------|-------------------|------------
650 17..48 | Cart title        | 32 bytes
651 -------|-------------------|------------
652 49..52 | Data length       |  4 bytes
653 -------|-------------------|------------
654 53..54 | Cart type [*]     |  2 bytes
655 -------|-------------------|------------
656 55     | Controller 1 type |  1 byte
657      |                   |
658        | 0 = None          |
659        | 1 = Joystick      |
660        | 2 = Light Gun     |
661 -------|-------------------|------------
662 56     | Controller 2 type |  1 byte
663        |                   |
664        | As above          |
665 -------|-------------------|------------
666 57     | TV System         |  1 byte
667        |                   |
668      | 0 = NTSC/1 = PAL  |
669 -------|-------------------|------------
670 58     | Save data         |  1 byte
671        |                   |  (only v2)
672        | 0 = None / Unk    |
673        | 1 = High Score    |
674        | 2 = Savekey       |
675 -------|-------------------|-----------
676 63     | Expansion module  |  1 byte
677        |                   |
678        | 0 = No expansion  |
679        |     module        |
680        | 1 = Expansion     |
681        |     required      |
682 -------|-------------------|-----------
683 
684 
685 [*] Cart type:
686
687 bit 0-7 - Hardware "flags"
688 bit 0 [0x01] - POKEY at $4000
689 bit 1 [0x02] - SuperCart bank switched
690 bit 2 [0x04] - SuperCart RAM at $4000
691 bit 3 [0x08] - bank 0 of 144K ROM at $4000
692 bit 4 [0x10] - bank 6 at $4000
693 bit 5 [0x20] - banked RAM at $4000
694 
695 bit 8-15 - Special values
696 0 = Normal cart
697 1 = Absolute (F18 Hornet)
698 2 = Activision (Double Dragon & Rampage)
699 3 = POKEY at $0450
700 
500701 -------------------------------------------------*/
501702
502703void a78_cart_slot_device::internal_header_logging(UINT8 *header, UINT32 len)
trunk/src/emu/bus/a7800/cpuwiz.c
r32084r32085
3333//-------------------------------------------------
3434
3535const device_type A78_ROM_VERSABOARD = &device_creator<a78_versaboard_device>;
36const device_type A78_ROM_VERSAPOKEY = &device_creator<a78_versapokey_device>;
3736const device_type A78_ROM_MEGACART = &device_creator<a78_megacart_device>;
3837
38const device_type A78_ROM_P450_VB = &device_creator<a78_rom_p450_vb_device>;
3939
40
4041a78_versaboard_device::a78_versaboard_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)
4142               : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source)
4243{
r32084r32085
4748{
4849}
4950
50a78_versapokey_device::a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
51               : a78_versaboard_device(mconfig, A78_ROM_VERSAPOKEY, "Atari 7800 VersaBoard + POKEY @ 0x0450 Cart", tag, owner, clock, "a78_versapokey", __FILE__),
52                  m_pokey(*this, "pokey")
53{
54}
5551
5652a78_megacart_device::a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5753               : a78_versaboard_device(mconfig, A78_ROM_MEGACART, "Atari 7800 MegaCart+", tag, owner, clock, "a78_megacart", __FILE__)
r32084r32085
5955}
6056
6157
58a78_rom_p450_vb_device::a78_rom_p450_vb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
59               : a78_versaboard_device(mconfig, A78_ROM_P450_VB, "Atari 7800 VersaBoard + POKEY @ 0x0450 Cart", tag, owner, clock, "a78_versapokey", __FILE__),
60                  m_pokey450(*this, "pokey450")
61{
62}
63
64
6265void a78_versaboard_device::device_start()
6366{
6467   save_item(NAME(m_bank));
r32084r32085
97100}
98101
99102
100// VersaBoard + POKEY @ 0x0450
101
102static MACHINE_CONFIG_FRAGMENT( a78_pokey )
103   MCFG_SPEAKER_STANDARD_MONO("addon")
104
105   MCFG_SOUND_ADD("pokey", POKEY, XTAL_14_31818MHz/8)
106   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
107MACHINE_CONFIG_END
108
109machine_config_constructor a78_versapokey_device::device_mconfig_additions() const
110{
111   return MACHINE_CONFIG_NAME( a78_pokey );
112}
113
114READ8_MEMBER(a78_versapokey_device::read_04xx)
115{
116   if (offset >= 0x50 && offset < 0x60)
117      return m_pokey->read(space, offset & 0x0f);
118   else
119      return 0xff;
120}
121
122WRITE8_MEMBER(a78_versapokey_device::write_04xx)
123{
124   if (offset >= 0x50 && offset < 0x60)
125      m_pokey->write(space, offset & 0x0f, data);
126}
127
128READ8_MEMBER(a78_versapokey_device::read_40xx)
129{
130   if (offset < 0x4000)
131      return m_rom[(offset & 0x3fff)];
132   else if (offset < 0x8000)
133      return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
134   else
135      return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)];   // last bank
136}
137
138WRITE8_MEMBER(a78_versapokey_device::write_40xx)
139{
140   if (offset >= 0x4000 && offset < 0x8000)
141      m_bank = (data & m_bank_mask) + 1;
142}
143
144
145103// MegaCart+
146104
147105WRITE8_MEMBER(a78_megacart_device::write_40xx)
r32084r32085
156114   }
157115}
158116
117
118// VersaBoard + POKEY @ 0x0450
119
120static MACHINE_CONFIG_FRAGMENT( a78_pokeyvb )
121   MCFG_SPEAKER_STANDARD_MONO("addon")
122
123   MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8)
124   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
125MACHINE_CONFIG_END
126
127machine_config_constructor a78_rom_p450_vb_device::device_mconfig_additions() const
128{
129   return MACHINE_CONFIG_NAME( a78_pokeyvb );
130}
131
132
trunk/src/emu/bus/a7800/rom.h
r32084r32085
3030{
3131public:
3232   // construction/destruction
33   a78_rom_pokey_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);
3334   a78_rom_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3435   
3536   // device-level overrides
r32084r32085
9293{
9394public:
9495   // construction/destruction
96   a78_rom_sg_ram_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);
9597   a78_rom_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9698   
9799   // reading and writing
r32084r32085
115117};
116118
117119
118// ======================> a78_rom_sg9_pokey_device
120// ======================> a78_rom_abs_device
119121
120class a78_rom_sg9_pokey_device : public a78_rom_sg9_device
122class a78_rom_abs_device : public a78_rom_device
121123{
122124public:
123125   // construction/destruction
124   a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
126   a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
125127   
126128   // device-level overrides
127   virtual machine_config_constructor device_mconfig_additions() const;
129   virtual void device_start();
130   virtual void device_reset();
128131   
129132   // reading and writing
133   virtual DECLARE_READ8_MEMBER(read_40xx);
130134   virtual DECLARE_WRITE8_MEMBER(write_40xx);
131135   
132136protected:
133   required_device<pokey_device> m_pokey;
137   int m_bank;
134138};
135139
136140
137// ======================> a78_rom_abs_device
141// ======================> a78_rom_act_device
138142
139class a78_rom_abs_device : public a78_rom_device
143class a78_rom_act_device : public a78_rom_device
140144{
141145public:
142146   // construction/destruction
143   a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
147   a78_rom_act_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
144148   
145149   // device-level overrides
146150   virtual void device_start();
r32084r32085
155159};
156160
157161
158// ======================> a78_rom_act_device
162// PCB variants with a POKEY at $0450
159163
160class a78_rom_act_device : public a78_rom_device
164// ======================> a78_rom_p450_device
165
166class a78_rom_p450_device : public a78_rom_device
161167{
162168public:
163169   // construction/destruction
164   a78_rom_act_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
170   a78_rom_p450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
165171   
166   // device-level overrides
167   virtual void device_start();
168   virtual void device_reset();
172   virtual machine_config_constructor device_mconfig_additions() const;
169173   
170174   // reading and writing
171   virtual DECLARE_READ8_MEMBER(read_40xx);
172   virtual DECLARE_WRITE8_MEMBER(write_40xx);
175   virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
176   virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
173177   
174178protected:
175   int m_bank;
179   required_device<pokey_device> m_pokey450;
176180};
177181
178182
183// ======================> a78_rom_p450_pokey_device
184
185class a78_rom_p450_pokey_device : public a78_rom_pokey_device
186{
187public:
188   // construction/destruction
189   a78_rom_p450_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
190   
191   virtual machine_config_constructor device_mconfig_additions() const;
192   
193   // reading and writing
194   virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
195   virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
196   
197protected:
198   required_device<pokey_device> m_pokey450;
199};
200
201
202// ======================> a78_rom_p450_sg_ram_device
203
204class a78_rom_p450_sg_ram_device : public a78_rom_sg_ram_device
205{
206public:
207   // construction/destruction
208   a78_rom_p450_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
209   
210   virtual machine_config_constructor device_mconfig_additions() const;
211   
212   // reading and writing
213   virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
214   virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
215   
216protected:
217   required_device<pokey_device> m_pokey450;
218};
219
220
221// ======================> a78_rom_p450_sg9_device
222
223class a78_rom_p450_sg9_device : public a78_rom_sg9_device
224{
225public:
226   // construction/destruction
227   a78_rom_p450_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
228   
229   virtual machine_config_constructor device_mconfig_additions() const;
230
231   // reading and writing
232   virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
233   virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
234   
235protected:
236   required_device<pokey_device> m_pokey450;
237};
238
239
240
241
242
179243// device type definition
180244extern const device_type A78_ROM;
181245extern const device_type A78_ROM_SG;
r32084r32085
183247extern const device_type A78_ROM_SG_POKEY;
184248extern const device_type A78_ROM_SG_RAM;
185249extern const device_type A78_ROM_SG9;
186extern const device_type A78_ROM_SG9_POKEY;
187250extern const device_type A78_ROM_ABSOLUTE;
188251extern const device_type A78_ROM_ACTIVISION;
189252
253// PCB variants with a POKEY at $0450
254extern const device_type A78_ROM_P450;
255extern const device_type A78_ROM_P450_POKEY;
256extern const device_type A78_ROM_P450_SG_RAM;
257extern const device_type A78_ROM_P450_SG9;
190258
191259#endif
trunk/src/emu/bus/a7800/a78_slot.h
r32084r32085
1616   A78_TYPE3,         // as TYPE1 + POKEY chip on the PCB
1717   A78_TYPE6,         // as TYPE1 + RAM IC on the PCB
1818   A78_TYPEA,         // Alien Brigade, Crossbow (9x16K banks with diff bankswitch)
19   A78_TYPEB,         // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800
2019   A78_ABSOLUTE,      // F18 Hornet
2120   A78_ACTIVISION,      // Double Dragon, Rampage
2221   A78_HSC,         // Atari HighScore cart
2322   A78_XB_BOARD,      // A7800 Expansion Board (it shall more or less apply to the Expansion Module too, but this is not officially released yet)
2423   A78_XM_BOARD,      // A7800 XM Expansion Module (theoretical specs only, since this is not officially released yet)
25   A78_MEGACART,      // Homebrew by CPUWIZ, consists of SuperGame bank up to 512K + 32K RAM banked
26   A78_VERSABOARD,      // Homebrew by CPUWIZ, consists of SuperGame bank up to 256K + 32K RAM banked
27   A78_VERSAPOKEY,      // For debugging purpose, same as VersaBoard + SG 9 Banks + POKEY at 0x0450
24   A78_MEGACART,            // Homebrew by CPUWIZ, consists of SuperGame bank up to 512K + 32K RAM banked
25   A78_VERSABOARD = 0x10,      // Homebrew by CPUWIZ, consists of SuperGame bank up to 256K + 32K RAM banked
26   // VersaBoard variants configured as Type 1/3/A or VersaBoard + POKEY at $0450
27   A78_TYPE0_POK450 = 0x20,
28   A78_TYPE1_POK450 = 0x21,
29   A78_TYPE6_POK450 = 0x24,
30   A78_TYPEA_POK450 = 0x25,
31   A78_VERSA_POK450 = 0x30,
2832   A78_NOCART
2933};
3034
r32084r32085
126130   int m_stick_type;
127131
128132   int verify_header(char *header);
133   int validate_header(int head, bool log);
129134   void internal_header_logging(UINT8 *header, UINT32 len);
130135};
131136
trunk/src/emu/bus/a7800/cpuwiz.h
r32084r32085
2727};
2828
2929
30// ======================> a78_versapokey_device
30// ======================> a78_megacart_device
3131
32class a78_versapokey_device : public a78_versaboard_device
32class a78_megacart_device : public a78_versaboard_device
3333{
3434public:
3535   // construction/destruction
36   a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36   a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3737   
38   // device-level overrides
39   virtual machine_config_constructor device_mconfig_additions() const;
40   
4138   // reading and writing
42   virtual DECLARE_READ8_MEMBER(read_04xx);
43   virtual DECLARE_WRITE8_MEMBER(write_04xx);
44   virtual DECLARE_READ8_MEMBER(read_40xx);
4539   virtual DECLARE_WRITE8_MEMBER(write_40xx);
46
47protected:
48   required_device<pokey_device> m_pokey;
4940};
5041
5142
52// ======================> a78_megacart_device
43// VersaBoard variants of the standard carts + POKEY at 0x0450!
5344
54class a78_megacart_device : public a78_versaboard_device
45// ======================> a78_rom_p450_vb_device
46
47class a78_rom_p450_vb_device : public a78_versaboard_device
5548{
5649public:
5750   // construction/destruction
58   a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
51   a78_rom_p450_vb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5952   
53   // device-level overrides
54   virtual machine_config_constructor device_mconfig_additions() const;
55   
6056   // reading and writing
61   virtual DECLARE_WRITE8_MEMBER(write_40xx);
57   virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
58   virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
59   
60protected:
61   required_device<pokey_device> m_pokey450;
6262};
6363
6464
6565
6666// device type definition
6767extern const device_type A78_ROM_VERSABOARD;
68extern const device_type A78_ROM_VERSAPOKEY;
6968extern const device_type A78_ROM_MEGACART;
7069
70extern const device_type A78_ROM_P450_VB;
7171
7272#endif
trunk/src/mess/drivers/a7800.c
r32084r32085
13231323         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cartslot), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cartslot));
13241324         break;
13251325      case A78_XB_BOARD:
1326      case A78_VERSAPOKEY:
1326      case A78_TYPE0_POK450:
1327      case A78_TYPE1_POK450:
1328      case A78_TYPE6_POK450:
1329      case A78_TYPEA_POK450:
1330      case A78_VERSA_POK450:
13271331         // POKEY and RAM regs at 0x400-0x47f
13281332         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cartslot), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cartslot));
13291333         break;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team