summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/naomim2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/naomim2.h')
-rw-r--r--src/mame/machine/naomim2.h48
1 files changed, 9 insertions, 39 deletions
diff --git a/src/mame/machine/naomim2.h b/src/mame/machine/naomim2.h
index e5406763d48..4efce0fcbe8 100644
--- a/src/mame/machine/naomim2.h
+++ b/src/mame/machine/naomim2.h
@@ -2,6 +2,7 @@
#define _NAOMIM2_H_
#include "naomibd.h"
+#include "315-5881_crypt.h"
#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _actel_tag, _irq_cb) \
MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _actel_tag, _irq_cb) \
@@ -11,12 +12,17 @@ class naomi_m2_board : public naomi_board
{
public:
naomi_m2_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ UINT32 rom_cur_address;
+ static const int RAM_SIZE = 65536;
+ UINT8* ram;
static void static_set_tags(device_t &device, const char *_key_tag);
+ UINT16 read_callback(UINT32 addr);
protected:
virtual void device_start();
virtual void device_reset();
+ virtual machine_config_constructor device_mconfig_additions() const;
virtual void board_setup_address(UINT32 address, bool is_dma);
virtual void board_get_buffer(UINT8 *&base, UINT32 &limit);
@@ -24,48 +30,12 @@ protected:
virtual void board_write(offs_t offset, UINT16 data);
private:
- enum {
- RAM_SIZE = 65536, BUFFER_SIZE = 32768, LINE_SIZE = 512,
- FLAG_COMPRESSED = 0x10000, FLAG_LINE_SIZE_512 = 0x20000
- };
- const char *key_tag;
- UINT32 key;
-
- UINT8 *ram, *buffer, *line_buffer, *line_buffer_prev;
- UINT32 rom_cur_address, prot_cur_address;
- UINT16 subkey, dec_hist;
- UINT32 dec_header;
- bool enc_ready;
-
- int buffer_pos, line_buffer_pos, line_buffer_size, buffer_bit;
-
- struct sbox {
- UINT8 table[64];
- int inputs[6]; // positions of the inputs bits, -1 means no input except from key
- int outputs[2]; // positions of the output bits
- };
-
- static const sbox fn1_sboxes[4][4];
- static const sbox fn2_sboxes[4][4];
- static const int fn1_game_key_scheduling[38][2];
- static const int fn2_game_key_scheduling[34][2];
- static const int fn1_sequence_key_scheduling[20][2];
- static const int fn2_sequence_key_scheduling[16];
- static const int fn2_middle_result_scheduling[16];
-
- static const UINT8 trees[9][2][32];
-
- int feistel_function(int input, const struct sbox *sboxes, UINT32 subkeys);
- UINT16 block_decrypt(UINT32 game_key, UINT16 sequence_key, UINT16 counter, UINT16 data);
-
- UINT16 get_decrypted_16();
- int get_compressed_bit();
+ const char *key_tag;
- void enc_start();
- void enc_fill();
- void line_fill();
+
+ required_device<sega_315_5881_crypt_device> m_cryptdevice;
};
extern const device_type NAOMI_M2_BOARD;