Previous 199869 Revisions Next

r22522 Wednesday 24th April, 2013 at 09:12:40 UTC by Fabio Priuli
(MESS) megadriv.c: fixed crash in the debugger due to access beyond end of the rom. nw.
[src/mess/machine]md_rom.c

trunk/src/mess/machine/md_rom.c
r22521r22522
527527READ16_MEMBER(md_rom_mcpirate_device::read)
528528{
529529   if (offset < 0x400000/2)
530   {
531      return m_rom[offset + (m_bank * 0x10000)/2];
532   }
530      return m_rom[(((m_bank * 0x10000) + (offset << 1)) & (m_rom_size - 1))/2];
533531   else
534   {
535532      return read(space, offset - 0x400000/2, 0xffff);
536   }
537533}
538534
539535WRITE16_MEMBER(md_rom_mcpirate_device::write_a13)
r22521r22522
623619      }
624620      return 0;
625621   }
626
627   return m_rom[offset & 0x1fffff/2];
622   
623   // non-protection accesses
624   if (offset < 0x400000/2)
625      return m_rom[MD_ADDR(offset)];
626   else
627      return 0xffff;
628628}
629629
630630WRITE16_MEMBER(md_rom_chinf3_device::write)
r22521r22522
650650
651651READ16_MEMBER(md_rom_elfwor_device::read)
652652{
653   /* It returns (0x55 @ 0x400000 OR 0xc9 @ 0x400004) AND (0x0f @ 0x400002 OR 0x18 @ 0x400006).
654    It is probably best to add handlers for all 4 addresses. */
653   // It returns (0x55 @ 0x400000 OR 0xc9 @ 0x400004) AND (0x0f @ 0x400002 OR 0x18 @ 0x400006).
654   // It is probably best to add handlers for all 4 addresses
655655   if (offset == 0x400000/2)   return 0x5500;
656656   if (offset == 0x400002/2)   return 0x0f00;
657657   if (offset == 0x400004/2)   return 0xc900;
658658   if (offset == 0x400006/2)   return 0x1800;
659   return m_rom[MD_ADDR(offset)];
659
660   // non-protection accesses
661   if (offset < 0x400000/2)
662      return m_rom[MD_ADDR(offset)];
663   else
664      return 0xffff;
660665}
661666
662667/*-------------------------------------------------
r22521r22522
669674   if (offset == 0x400002/2)   return 0x0f00;
670675   if (offset == 0x400004/2)   return 0xaa00;
671676   if (offset == 0x400006/2)   return 0xf000;
672   return m_rom[MD_ADDR(offset)];
677
678   // non-protection accesses
679   if (offset < 0x400000/2)
680      return m_rom[MD_ADDR(offset)];
681   else
682      return 0xffff;
673683}
674684
675685/*-------------------------------------------------
r22521r22522
682692   if (offset == 0x400002/2)   return 0x9800;
683693   if (offset == 0x400004/2)   return 0xc900;
684694   if (offset == 0x400006/2)   return 0x1800;
685   return m_rom[MD_ADDR(offset)];
695
696   // non-protection accesses
697   if (offset < 0x400000/2)
698      return m_rom[MD_ADDR(offset)];
699   else
700      return 0xffff;
686701}
687702
688703/*-------------------------------------------------
r22521r22522
697712   if (offset == 0x488880/2)   return 0xaa00;
698713   if (offset == 0x4a8820/2)   return 0x0a00;
699714   if (offset == 0x4f8820/2)   return 0x0000;
700   return m_rom[MD_ADDR(offset)];
715
716   // non-protection accesses
717   if (offset < 0x400000/2)
718      return m_rom[MD_ADDR(offset)];
719   else
720      return 0xffff;
701721}
702722
703723/*-------------------------------------------------
r22521r22522
720740{
721741   if (offset == 0x400002/2)   return m_prot1_data;
722742   if (offset == 0x400006/2)   return m_prot2_data;
723   return m_rom[MD_ADDR(offset)];
743
744   // non-protection accesses
745   if (offset < 0x400000/2)
746      return m_rom[MD_ADDR(offset)];
747   else
748      return 0xffff;
724749}
725750
726751WRITE16_MEMBER(md_rom_lion2_device::write)
r22521r22522
756781      return 0;
757782   }
758783
759   return m_rom[MD_ADDR(offset)];
784   if (offset < 0x400000/2)
785      return m_rom[MD_ADDR(offset)];
786   else
787      return 0xffff;
760788}
761789
762790WRITE16_MEMBER(md_rom_lion3_device::write)
r22521r22522
815843{
816844   if (offset == 0x400000/2)   return 0x9000;
817845   if (offset == 0x401000/2)   return 0xd300;
818   return m_rom[MD_ADDR(offset)];
846
847   // non-protection accesses
848   if (offset < 0x400000/2)
849      return m_rom[MD_ADDR(offset)];
850   else
851      return 0xffff;
819852}
820853
821854
r22521r22522
827860{
828861   if (offset == 0x400000/2)   return 0x5500;
829862   if (offset == 0x400002/2)   return 0x0f00;
830   return m_rom[MD_ADDR(offset)];
863
864   // non-protection accesses
865   if (offset < 0x400000/2)
866      return m_rom[MD_ADDR(offset)];
867   else
868      return 0xffff;
831869}
832870
833871/*-------------------------------------------------
r22521r22522
839877   if (offset == 0x400002/2)   return 0x9800;
840878   if (offset == 0x400004/2)   return 0xc900;
841879   if (offset == 0x400006/2)   return 0xf000;
842   return m_rom[MD_ADDR(offset)];
880
881   // non-protection accesses
882   if (offset < 0x400000/2)
883      return m_rom[MD_ADDR(offset)];
884   else
885      return 0xffff;
843886}
844887
845888/*-------------------------------------------------
r22521r22522
852895{
853896   if (offset < 0x100000/2)
854897      return m_rom[MD_POKESTAD_ADDR(offset)];
855   return m_rom[MD_ADDR(offset)];
898
899   // non-protection accesses
900   if (offset < 0x400000/2)
901      return m_rom[MD_ADDR(offset)];
902   else
903      return 0xffff;
856904}
857905
858906WRITE16_MEMBER(md_rom_pokestad_device::write)
r22521r22522
880928READ16_MEMBER(md_rom_realtec_device::read)
881929{
882930   if (offset < (m_bank_size * 0x20000))   // two banks of same (variable) size at the bottom of the rom
883      return m_rom[offset + (m_bank_addr * 0x20000)/2];
884   return m_rom[(offset & 0x1fff/2) + 0x7e000/2];  // otherwise it accesses the final 8k of the image
931      return m_rom[MD_ADDR(offset + (m_bank_addr * 0x20000)/2)];
932   return m_rom[MD_ADDR((offset & 0x1fff/2) + 0x7e000/2)];  // otherwise it accesses the final 8k of the image
885933}
886934
887935WRITE16_MEMBER(md_rom_realtec_device::write)
r22521r22522
911959{
912960   if (offset == 0x400000/2)   return 0x55 << 8;
913961   if (offset == 0x400004/2)   return -0x56 << 8;
914   return m_rom[MD_ADDR(offset)];
962
963   // non-protection accesses
964   if (offset < 0x400000/2)
965      return m_rom[MD_ADDR(offset)];
966   else
967      return 0xffff;
915968}
916969
917970/*-------------------------------------------------
r22521r22522
934987{
935988   if ((offset >= 0x400000/2) && (offset < 0x400008/2))
936989      return m_latch;
937   return m_rom[MD_ADDR(offset)];
990
991   // non-protection accesses
992   if (offset < 0x400000/2)
993      return m_rom[MD_ADDR(offset)];
994   else
995      return 0xffff;
938996}
939997
940998WRITE16_MEMBER(md_rom_squir_device::write)
r22521r22522
11331191   if (offset >= 0x60000/2 && offset < 0x68000/2)
11341192      return m_rom[offset + (m_bank[2] * 0x110000)/2];
11351193
1136   return m_rom[offset];
1194   // non-protection accesses
1195   if (offset < 0x400000/2)
1196      return m_rom[MD_ADDR(offset)];
1197   else
1198      return 0xffff;
11371199}
11381200
11391201WRITE16_MEMBER(md_rom_topf_device::write)
r22521r22522
11631225
11641226READ16_MEMBER(md_rom_radica_device::read)
11651227{
1166   return m_rom[m_bank * 0x10000/2 + offset];
1228   return m_rom[(((m_bank * 0x10000) + (offset << 1)) & (m_rom_size - 1))/2];
11671229}
11681230
11691231READ16_MEMBER(md_rom_radica_device::read_a13)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team