Previous 199869 Revisions Next

r30834 Wednesday 4th June, 2014 at 17:57:35 UTC by Wilbert Pol
(MESS) msx.c: Added support for mapper used by Holy Quran. [hap, Wilbert Pol]
[hash]msx1_cart.xml
[src/emu/bus]bus.mak
[src/emu/bus/msx_cart]cartridge.c holy_quran.c* holy_quran.h*

trunk/src/emu/bus/bus.mak
r30833r30834
412412BUSOBJS += $(BUSOBJ)/msx_cart/crossblaim.o
413413BUSOBJS += $(BUSOBJ)/msx_cart/fmpac.o
414414BUSOBJS += $(BUSOBJ)/msx_cart/hfox.o
415BUSOBJS += $(BUSOBJ)/msx_cart/holy_quran.o
415416BUSOBJS += $(BUSOBJ)/msx_cart/konami.o
416417BUSOBJS += $(BUSOBJ)/msx_cart/korean.o
417418BUSOBJS += $(BUSOBJ)/msx_cart/majutsushi.o
trunk/src/emu/bus/msx_cart/holy_quran.c
r0r30834
1#include "emu.h"
2#include "holy_quran.h"
3
4
5const device_type MSX_CART_HOLY_QURAN = &device_creator<msx_cart_holy_quran>;
6
7
8msx_cart_holy_quran::msx_cart_holy_quran(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
9   : device_t(mconfig, MSX_CART_HOLY_QURAN, "MSX Cartridge - Holy Quran", tag, owner, clock, "msx_cart_holy_quran", __FILE__)
10   , msx_cart_interface(mconfig, *this)
11   , m_decrypt(false)
12{
13   for (int i = 0; i < 4; i++)
14   {
15      m_selected_bank[i] = 0;
16      m_bank_base[i] = NULL;
17   }
18
19   /* protection uses a simple rotation on databus, some lines inverted:
20       D0   D4                 D4   D5
21       D1 ~ D3                 D5 ~ D2
22       D2 ~ D6                 D6   D7
23       D3 ~ D0                 D7   D1 */
24   for (int i=0; i < 0x100; i++)
25   {
26      m_lookup_prot[i] = (((i << 4) & 0x50) | ((i >> 3) & 5) | ((i << 1) & 0xa0) | ((i << 2) & 8) | ((i >> 6) & 2)) ^ 0x4d;
27   }
28}
29
30
31void msx_cart_holy_quran::device_start()
32{
33   save_item(NAME(m_selected_bank));
34   save_item(NAME(m_decrypt));
35
36   machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_holy_quran::restore_banks), this));
37}
38
39
40void msx_cart_holy_quran::restore_banks()
41{
42   m_bank_base[0] = get_rom_base() + (m_selected_bank[0] & 0x7f) * 0x2000;
43   m_bank_base[1] = get_rom_base() + (m_selected_bank[1] & 0x7f) * 0x2000;
44   m_bank_base[2] = get_rom_base() + (m_selected_bank[2] & 0x7f) * 0x2000;
45   m_bank_base[3] = get_rom_base() + (m_selected_bank[3] & 0x7f) * 0x2000;
46}
47
48
49void msx_cart_holy_quran::device_reset()
50{
51   for (int i = 0; i < 4; i++)
52   {
53      m_selected_bank[i] = 0;
54   }
55}
56
57
58void msx_cart_holy_quran::initialize_cartridge()
59{
60   if (get_rom_size() != 0x100000)
61   {
62      fatalerror("holy_quran: Invalid ROM size\n");
63   }
64
65   restore_banks();
66}
67
68
69READ8_MEMBER(msx_cart_holy_quran::read_cart)
70{
71   if (offset >= 0x4000 && offset < 0xc000)
72   {
73      UINT8 data = m_bank_base[(offset - 0x4000) >> 13][offset & 0x1fff];
74
75      if (m_decrypt)
76      {
77         return m_lookup_prot[data];
78      }
79
80      // The decryption should actually start working after the first M1 cycle executing something
81      // from the cartridge.
82      if (offset == ((m_rom[3] << 8) | m_rom[2]) && !space.debugger_access())
83      {
84         m_decrypt = true;
85      }
86
87      return data;
88   }
89   return 0xff;
90}
91
92
93WRITE8_MEMBER(msx_cart_holy_quran::write_cart)
94{
95   switch (offset)
96   {
97      case 0x5000:
98         m_selected_bank[0] = data;
99         restore_banks();
100         break;
101      case 0x5400:
102         m_selected_bank[1] = data;
103         restore_banks();
104         break;
105      case 0x5800:
106         m_selected_bank[2] = data;
107         restore_banks();
108         break;
109      case 0x5c00:
110         m_selected_bank[3] = data;
111         restore_banks();
112         break;
113      default:
114         logerror("msx_cart_holy_quran: unhandled write %02x to %04x\n", data, offset);
115         break;
116   }
117}
118
Property changes on: trunk/src/emu/bus/msx_cart/holy_quran.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/msx_cart/holy_quran.h
r0r30834
1#ifndef __MSX_CART_HOLY_QURAN_H
2#define __MSX_CART_HOLY_QURAN_H
3
4#include "bus/msx_cart/cartridge.h"
5
6
7extern const device_type MSX_CART_HOLY_QURAN;
8
9
10class msx_cart_holy_quran : public device_t
11                  , public msx_cart_interface
12{
13public:
14   msx_cart_holy_quran(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
15
16   // device-level overrides
17   virtual void device_start();
18   virtual void device_reset();
19
20   virtual void initialize_cartridge();
21
22   virtual DECLARE_READ8_MEMBER(read_cart);
23   virtual DECLARE_WRITE8_MEMBER(write_cart);
24
25   void restore_banks();
26
27private:
28   UINT8 m_lookup_prot[256];
29   UINT8 m_selected_bank[4];
30   UINT8 *m_bank_base[4];
31   bool m_decrypt;
32};
33
34
35#endif
Property changes on: trunk/src/emu/bus/msx_cart/holy_quran.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/msx_cart/cartridge.c
r30833r30834
55#include "crossblaim.h"
66#include "fmpac.h"
77#include "hfox.h"
8#include "holy_quran.h"
89#include "konami.h"
910#include "korean.h"
1011#include "majutsushi.h"
r30833r30834
4546   SLOT_INTERFACE_INTERNAL("super_swangi", MSX_CART_SUPER_SWANGI)
4647   SLOT_INTERFACE_INTERNAL("hfox", MSX_CART_HFOX)
4748   SLOT_INTERFACE_INTERNAL("keyboard_master", MSX_CART_KEYBOARD_MASTER)
49   SLOT_INTERFACE_INTERNAL("holy_quran", MSX_CART_HOLY_QURAN)
4850SLOT_INTERFACE_END
4951
5052
trunk/hash/msx1_cart.xml
r30833r30834
1524215242      </part>
1524315243   </software>
1524415244
15245<!-- FIXME: proper HOLYQURAN mapper needs to be implemented! -->
15246   <software name="quran" supported="no">
15245   <software name="quran">
1524715246      <description>The Holy Quran</description>
1524815247      <year>1987</year>
1524915248      <publisher>Al Alamiah</publisher>
1525015249      <info name="serial" value="R052" />
1525115250      <info name="usage" value="Requires an Arabic MSX" />
1525215251      <part name="cart" interface="msx_cart">
15253         <feature name="slot" value="ascii16" />
15254         <feature name="mapper" value="M60002-0125SP-16" />  <!-- WRONG MAPPER (but in this way no crash of the emulator) -->
15252         <feature name="slot" value="holy_quran" />
1525515253         <dataarea name="rom" size="1048576">
15256            <rom name="holyquran.rom" size="1048576" crc="83f28ad3" sha1="0dbc7defd96b71c1fe2d63cbc725f5e58aea2db0" offset="0x0000" />
15254            <!-- there are 2 ROMs on the cartridge -->
15255            <rom name="holyquran.rom" size="1048576" crc="3b003e5c" sha1="7d439080b43d94385fd4c426d4f6fee884bc2926" status="baddump" offset="0x0000" />
1525715256         </dataarea>
1525815257      </part>
1525915258   </software>

Previous 199869 Revisions Next


© 1997-2024 The MAME Team