1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
#include "sound/okiadpcm.h"
#define MCU_BUFFER_MAX 6
class renegade_adpcm_device;
class renegade_state : public driver_device
{
public:
renegade_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_videoram2(*this, "videoram2"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this,"maincpu"),
m_audiocpu(*this, "audiocpu"),
m_mcu(*this, "mcu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
UINT8 m_bank;
int m_mcu_sim;
int m_from_main;
int m_from_mcu;
int m_main_sent;
int m_mcu_sent;
UINT8 m_ddr_a;
UINT8 m_ddr_b;
UINT8 m_ddr_c;
UINT8 m_port_a_out;
UINT8 m_port_b_out;
UINT8 m_port_c_out;
UINT8 m_port_a_in;
UINT8 m_port_b_in;
UINT8 m_port_c_in;
UINT8 m_mcu_buffer[MCU_BUFFER_MAX];
UINT8 m_mcu_input_size;
UINT8 m_mcu_output_byte;
INT8 m_mcu_key;
int m_mcu_checksum;
const UINT8 *m_mcu_encrypt_table;
int m_mcu_encrypt_table_len;
int m_coin;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_videoram2;
INT32 m_scrollx;
tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap;
required_shared_ptr<UINT8> m_spriteram;
required_device<cpu_device> m_maincpu;
DECLARE_WRITE8_MEMBER(sound_w);
DECLARE_READ8_MEMBER(mcu_reset_r);
DECLARE_WRITE8_MEMBER(mcu_w);
DECLARE_READ8_MEMBER(mcu_r);
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(renegade_coin_counter_w);
void mcu_process_command();
DECLARE_READ8_MEMBER(renegade_68705_port_a_r);
DECLARE_WRITE8_MEMBER(renegade_68705_port_a_w);
DECLARE_WRITE8_MEMBER(renegade_68705_ddr_a_w);
DECLARE_READ8_MEMBER(renegade_68705_port_b_r);
DECLARE_WRITE8_MEMBER(renegade_68705_port_b_w);
DECLARE_WRITE8_MEMBER(renegade_68705_ddr_b_w);
DECLARE_READ8_MEMBER(renegade_68705_port_c_r);
DECLARE_WRITE8_MEMBER(renegade_68705_port_c_w);
DECLARE_WRITE8_MEMBER(renegade_68705_ddr_c_w);
DECLARE_WRITE8_MEMBER(renegade_videoram_w);
DECLARE_WRITE8_MEMBER(renegade_videoram2_w);
DECLARE_WRITE8_MEMBER(renegade_flipscreen_w);
DECLARE_WRITE8_MEMBER(renegade_scroll0_w);
DECLARE_WRITE8_MEMBER(renegade_scroll1_w);
DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
DECLARE_WRITE8_MEMBER(adpcm_play_w);
DECLARE_DRIVER_INIT(kuniokun);
DECLARE_DRIVER_INIT(kuniokunb);
DECLARE_DRIVER_INIT(renegade);
TILE_GET_INFO_MEMBER(get_bg_tilemap_info);
TILE_GET_INFO_MEMBER(get_fg_tilemap_info);
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_renegade(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(renegade_interrupt);
void setbank();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_audiocpu;
optional_device<cpu_device> m_mcu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
class renegade_adpcm_device : public device_t,
public device_sound_interface
{
public:
renegade_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~renegade_adpcm_device() {}
DECLARE_WRITE8_MEMBER(play_w);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
private:
// internal state
oki_adpcm_state m_adpcm;
sound_stream *m_stream;
UINT32 m_current;
UINT32 m_end;
UINT8 m_nibble;
UINT8 m_playing;
UINT8 *m_base;
};
extern const device_type RENEGADE_ADPCM;
|