Previous 199869 Revisions Next

r33186 Tuesday 4th November, 2014 at 00:51:52 UTC by David Haywood
just test code (nw)
[src/mame/drivers]stv.c
[src/mame/includes]stv.h
[src/mame/machine]315-5881_crypt.c 315-5881_crypt.h stvprot.c

trunk/src/mame/drivers/stv.c
r241697r241698
10231023   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
10241024
10251025   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
1026   //MCFG_SET_READ_CALLBACK(stv_state, read_callback)
1026   MCFG_SET_READ_CALLBACK(stv_state, crypt_read_callback)
10271027MACHINE_CONFIG_END
10281028
10291029/*
trunk/src/mame/includes/stv.h
r241697r241698
3535         m_cart3(*this, "stv_slot3"),
3636         m_cart4(*this, "stv_slot4"),
3737         m_gfxdecode(*this, "gfxdecode"),
38         m_palette(*this, "palette"),
39         m_cryptdevice(*this, "315_5881")
38         m_palette(*this, "palette")
4039   {
4140   }
4241
r241697r241698
170169   required_device<gfxdecode_device> m_gfxdecode;
171170   required_device<palette_device> m_palette;
172171
173   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
174172
175173
176174   bitmap_rgb32 m_tmpbitmap;
r241697r241698
700698   stv_state(const machine_config &mconfig, device_type type, const char *tag)
701699      : saturn_state(mconfig, type, tag),
702700      m_adsp(*this, "adsp"),
703      m_adsp_pram(*this, "adsp_pram")
701      m_adsp_pram(*this, "adsp_pram"),
702      m_cryptdevice(*this, "315_5881")
704703   {
705704   }
706705
r241697r241698
835834   DECLARE_WRITE32_MEMBER( decathlt_prot2_w );
836835   void write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which);
837836   void install_decathlt_protection();
837
838   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
839   UINT16 crypt_read_callback(UINT32 addr);
838840};
839841
840842
trunk/src/mame/machine/315-5881_crypt.c
r241697r241698
6565   buffer_bit = 0;
6666}
6767
68void sega_315_5881_crypt_device::do_decrypt(UINT8 *&base)
68UINT16 sega_315_5881_crypt_device::do_decrypt(UINT8 *&base)
6969{
7070   if(!enc_ready)
7171      enc_start();
r241697r241698
8080      base = buffer + buffer_pos;
8181      buffer_pos += 2;
8282   }
83
84   return (base[0] << 8) | base[1];
8385}
8486
8587void sega_315_5881_crypt_device::set_addr_low(UINT16 data)
trunk/src/mame/machine/315-5881_crypt.h
r241697r241698
1919   sega_315_5881_crypt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2020   
2121
22   void do_decrypt(UINT8 *&base);
22   UINT16 do_decrypt(UINT8 *&base);
2323   void set_addr_low(UINT16 data);
2424   void set_addr_high(UINT16 data);
2525   void set_subkey(UINT16 data);
trunk/src/mame/machine/stvprot.c
r241697r241698
590590
591591         logerror("A-Bus control protection read at %06x with data = %08x Returning = %08x Would otherwise return = %08x\n",space.device().safe_pc(),m_abus_protkey, retdata, realret);
592592
593         //UINT16 res = m_cryptdevice->do_decrypt(base);
594
593595         m_ctrl_index += 4;
594596         return retdata;
595597
r241697r241698
604606}
605607
606608
609UINT16 stv_state::crypt_read_callback(UINT32 addr)
610{
611   const UINT8 *base = m_cart_reg[0]->base() + 2*addr;
612   return base[1] | (base[0] << 8);
613}
607614
608
609615WRITE32_MEMBER ( stv_state::common_prot_w )
610616{
611617   COMBINE_DATA(&m_a_bus[offset]);
r241697r241698
627633   {
628634      COMBINE_DATA(&m_abus_protkey);
629635
630      m_cryptdevice->set_subkey(m_abus_protkey);
636      m_cryptdevice->set_subkey(m_abus_protkey>>16);
631637
632638
633639      int a_bus_vector;
r241697r241698
665671{
666672   install_common_protection();
667673   m_prot_readback = astrass_prot_read_callback;
674//   m_cryptdevice->set_key(0x00000000);
668675}
669676
670677void stv_state::install_ffreveng_protection()


Previous 199869 Revisions Next


© 1997-2024 The MAME Team