Previous 15994 Revisions Next

r2311 Monday 7th April, 2008 at 01:45:05 UTC by Cowering
[Genesis] Add handler for 'Tenchi o Kurau III - Sangoku Gaiden - Chinese Fighter' (could someone endure this long enough to check final screen graphics)
[src/mess/drivers]genesis.c

src/mess/drivers/genesis.c
r2310r2311
5353#include "includes/genesis.h"
5454#include "devices/cartslot.h"
5555#include "../../mame/drivers/megadriv.h"
56#include "cpu/m68000/m68000.h"
5657
5758static int is_ssf2 = 0;
5859static int is_redcliff = 0;
r2310r2311
7374static int is_smb2 = 0;
7475static int is_kof98 = 0;
7576static int is_kaiju = 0;
77static int is_chifi3 = 0;
7678
7779static UINT8 *genesis_sram;
7880static int genesis_sram_start;
r2310r2311
200202
201203   genesis_sram = NULL;
202204   genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = 0;
203   is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = is_squir = is_smous = is_elfwor = is_lionk2 = is_rx3 = is_bugsl = is_sbub = is_smb2 = is_kof98 = is_kaiju = 0;
205   is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = is_squir = is_smous = is_elfwor = is_lionk2 = is_rx3 = is_bugsl = is_sbub = is_smb2 = is_kof98 = is_kaiju = is_chifi3 = 0;
204206
205207   rawROM = memory_region(REGION_CPU1);
206208        ROM = rawROM /*+ 512 */;
r2310r2311
368370
369371      if (length == 0x200000)
370372      {
373         static unsigned char chifi3sig[] = { 0xb6, 0x16, 0x66, 0x00, 0x00, 0x4a};
374
375         if (!memcmp(&ROM[0x1780 + relocate],&chifi3sig[0],sizeof(chifi3sig)))
376         {
377            is_chifi3 = 1;
378         }
379      }
380
381
382      if (length == 0x200000)
383      {
371384         static unsigned char lionk2sig[] = { 0x26, 0x79, 0x00, 0xff, 0x00, 0xf4};
372385
373386         if (!memcmp(&ROM[0x03c2+relocate],&lionk2sig[0],sizeof(lionk2sig)))
r2310r2311
442455      memcpy(&ROM[0x400000],&ROM[0x000000],0x200000);
443456      memcpy(&ROM[0x600000],&ROM[0x000000],0x200000);
444457   }
458
445459   if (is_radica)
446460   {
447461      memcpy(&ROM[0x400000], &ROM[0], 0x400000); // keep a copy for later banking.. making use of huge ROM_REGION allocated to genesis driver
448462      memcpy(&ROM[0x800000], &ROM[0], 0x400000); // wraparound banking (from hazemd code)
449463   }
464   if (is_chifi3)
465   {
466      memcpy(ROM + 0x400000, ROM + 0x000000, 0x200000);
467      memcpy(ROM + 0x600000, ROM + 0x000000, 0x200000);
468   }
450469
451470
452471        /* check if cart has battery save */
r2310r2311
585604   }
586605}
587606
607
608WRITE16_HANDLER( g_chifi3_bank_w )
609{
610   UINT8 *ROM = memory_region(REGION_CPU1);
611
612   if (data==0xf100) // *hit player
613   {
614      int x;
615      for (x=0;x<0x100000;x+=0x10000)
616      {
617         memcpy(ROM + x, ROM + 0x410000, 0x10000);
618      }
619   }
620   else if (data==0xd700) // title screen..
621   {
622      int x;
623      for (x=0;x<0x100000;x+=0x10000)
624      {
625         memcpy(ROM + x, ROM + 0x470000, 0x10000);
626      }
627   }
628   else if (data==0xd300) // character hits floor
629   {
630      int x;
631      for (x=0;x<0x100000;x+=0x10000)
632      {
633         memcpy(ROM + x, ROM + 0x430000, 0x10000);
634      }
635   }
636   else if (data==0x0000)
637   {
638      int x;
639      for (x=0;x<0x100000;x+=0x10000)
640      {
641         memcpy(ROM + x, ROM + 0x400000+x, 0x10000);
642      }
643   }
644   else
645   {
646      logerror("%06x chifi3, bankw? %04x %04x\n",activecpu_get_pc(), offset,data);
647   }
648
649}
650
651READ16_HANDLER( g_chifi3_prot_r )
652{
653   UINT32 retdat;
654
655   /* not 100% correct, there may be some relationship between the reads here
656   and the writes made at the start of the game.. */
657
658   /*
659   04dc10 chifi3, prot_r? 2800
660   04cefa chifi3, prot_r? 65262
661   */
662
663   if (activecpu_get_pc()==0x01782) // makes 'VS' screen appear
664   {
665      retdat = activecpu_get_reg(M68K_D3)&0xff;
666      retdat<<=8;
667      return retdat;
668   }
669   else if (activecpu_get_pc()==0x1c24) // background gfx etc.
670   {
671      retdat = activecpu_get_reg(M68K_D3)&0xff;
672      retdat<<=8;
673      return retdat;
674   }
675   else if (activecpu_get_pc()==0x10c4a) // unknown
676   {
677      return mame_rand(machine);
678   }
679   else if (activecpu_get_pc()==0x10c50) // unknown
680   {
681      return mame_rand(machine);
682   }
683   else if (activecpu_get_pc()==0x10c52) // relates to the game speed..
684   {
685      retdat = activecpu_get_reg(M68K_D4)&0xff;
686      retdat<<=8;
687      return retdat;
688   }
689   else if (activecpu_get_pc()==0x061ae)
690   {
691      retdat = activecpu_get_reg(M68K_D3)&0xff;
692      retdat<<=8;
693      return retdat;
694   }
695   else if (activecpu_get_pc()==0x061b0)
696   {
697      retdat = activecpu_get_reg(M68K_D3)&0xff;
698      retdat<<=8;
699      return retdat;
700   }
701   else
702   {
703      logerror("%06x chifi3, prot_r? %04x\n",activecpu_get_pc(), offset);
704   }
705
706   return 0;
707}
708
709
710// Kaiju? (Pokemon Stadium) handler from HazeMD
588711static WRITE16_HANDLER( g_kaiju_bank_w )
589712{
590713   UINT8 *ROM = memory_region(REGION_CPU1);
r2310r2311
802925   {
803926      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x7fffff, 0, 0, g_kaiju_bank_w );
804927   }
928   if (is_chifi3)
929   {
930      memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x4fffff, 0, 0, g_chifi3_prot_r );
931      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x600000, 0x6fffff, 0, 0, g_chifi3_bank_w );
805932
933   }
934
806935   if (is_radica)
807936   {
808937      memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa13000, 0xa1307f, 0, 0, radica_bank_select );

Previous 15994 Revisions Next


© 1998-2018 The MESS Team