summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/model3.h
blob: 53d8cfb4b00c51d3c350ae61d4cb9d2a0d7dbce8 (plain) (blame)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#include "video/poly.h"
#include "machine/scsibus.h"
#include "machine/53c810.h"

typedef float MATRIX[4][4];
typedef float VECTOR[4];
typedef float VECTOR3[3];

typedef struct {
	float x,y,z,d;
} PLANE;

typedef struct _cached_texture cached_texture;

class model3_state : public driver_device
{
public:
	model3_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_maincpu(*this,"maincpu"),
		m_lsi53c810(*this, "scsi:lsi53c810"),
		m_work_ram(*this, "work_ram"),
		m_paletteram64(*this, "paletteram64"),
		m_soundram(*this, "soundram"){ }

	required_device<cpu_device> m_maincpu;
	optional_device<lsi53c810_device> m_lsi53c810;

	required_shared_ptr<UINT64> m_work_ram;
	required_shared_ptr<UINT64> m_paletteram64;
	required_shared_ptr<UINT16> m_soundram;

    int m_sound_irq_enable;
    emu_timer *m_sound_timer;
	UINT8 m_irq_enable;
	UINT8 m_irq_state;
	UINT8 m_scsi_irq_state;
	int m_crom_bank;
	int m_controls_bank;
	UINT32 m_real3d_device_id;
	UINT32 m_mpc105_regs[0x40];
	UINT32 m_mpc105_addr;
	int m_pci_bus;
	int m_pci_device;
	int m_pci_function;
	int m_pci_reg;
	UINT32 m_mpc106_regs[0x40];
	UINT32 m_mpc106_addr;
	UINT32 m_dma_data;
	UINT32 m_dma_status;
	UINT32 m_dma_source;
	UINT32 m_dma_dest;
	UINT32 m_dma_endian;
	UINT32 m_dma_irq;
	UINT64 m_controls_2;
	UINT64 m_controls_3;
	UINT8 m_serial_fifo1;
	UINT8 m_serial_fifo2;
	int m_lightgun_reg_sel;
	int m_adc_channel;
	UINT64 m_real3d_status;
	UINT64 *m_network_ram;
	int m_prot_data_ptr;
	int m_scsp_last_line;
	UINT32 *m_vrom;
	int m_step;
	int m_m3_step;
	INT32 m_tap_state;
	UINT64 m_ir;
	UINT8 m_id_data[32];
	INT32 m_id_size;
	int m_tdo;
	UINT8 m_layer_enable;
	UINT32 m_layer_modulate_r;
	UINT32 m_layer_modulate_g;
	UINT32 m_layer_modulate_b;
	UINT32 m_layer_modulate1;
	UINT32 m_layer_modulate2;
	UINT64 m_layer_scroll[2];
	UINT64 *m_m3_char_ram;
	UINT64 *m_m3_tile_ram;
	UINT32 *m_texture_fifo;
	int m_texture_fifo_pos;
	UINT16 *m_texture_ram[2];
	UINT32 *m_display_list_ram;
	UINT32 *m_culling_ram;
	UINT32 *m_polygon_ram;
	UINT16 *m_pal_lookup;
	int m_real3d_display_list;
	bitmap_ind16 m_bitmap3d;
	bitmap_ind32 m_zbuffer;
	rectangle m_clip3d;
	rectangle *m_screen_clip;
	VECTOR3 m_parallel_light;
	float m_parallel_light_intensity;
	float m_ambient_light_intensity;
	poly_manager *m_poly;
	int m_list_depth;
	int m_tick;
	int m_debug_layer_disable;
	UINT64 m_vid_reg0;
	int m_matrix_stack_ptr;
	MATRIX *m_matrix_stack;
	MATRIX m_coordinate_system;
	float m_viewport_focal_length;
	int m_viewport_region_x;
	int m_viewport_region_y;
	int m_viewport_region_width;
	int m_viewport_region_height;
	PLANE m_clip_plane[5];
	UINT32 m_matrix_base_address;
	cached_texture *m_texcache[2][1024/32][2048/32];

	DECLARE_READ32_MEMBER(rtc72421_r);
	DECLARE_WRITE32_MEMBER(rtc72421_w);
	DECLARE_READ64_MEMBER(model3_char_r);
	DECLARE_WRITE64_MEMBER(model3_char_w);
	DECLARE_READ64_MEMBER(model3_tile_r);
	DECLARE_WRITE64_MEMBER(model3_tile_w);
	DECLARE_READ64_MEMBER(model3_vid_reg_r);
	DECLARE_WRITE64_MEMBER(model3_vid_reg_w);
	DECLARE_WRITE64_MEMBER(model3_palette_w);
	DECLARE_READ64_MEMBER(model3_palette_r);
	DECLARE_WRITE64_MEMBER(real3d_display_list_w);
	DECLARE_WRITE64_MEMBER(real3d_polygon_ram_w);
	DECLARE_WRITE64_MEMBER(real3d_cmd_w);
	DECLARE_READ64_MEMBER(mpc105_addr_r);
	DECLARE_WRITE64_MEMBER(mpc105_addr_w);
	DECLARE_READ64_MEMBER(mpc105_data_r);
	DECLARE_WRITE64_MEMBER(mpc105_data_w);
	DECLARE_READ64_MEMBER(mpc105_reg_r);
	DECLARE_WRITE64_MEMBER(mpc105_reg_w);
	DECLARE_READ64_MEMBER(mpc106_addr_r);
	DECLARE_WRITE64_MEMBER(mpc106_addr_w);
	DECLARE_READ64_MEMBER(mpc106_data_r);
	DECLARE_WRITE64_MEMBER(mpc106_data_w);
	DECLARE_READ64_MEMBER(mpc106_reg_r);
	DECLARE_WRITE64_MEMBER(mpc106_reg_w);
	DECLARE_READ64_MEMBER(scsi_r);
	DECLARE_WRITE64_MEMBER(scsi_w);
	DECLARE_READ64_MEMBER(real3d_dma_r);
	DECLARE_WRITE64_MEMBER(real3d_dma_w);
	DECLARE_READ64_MEMBER(model3_ctrl_r);
	DECLARE_WRITE64_MEMBER(model3_ctrl_w);
	DECLARE_READ64_MEMBER(model3_sys_r);
	DECLARE_WRITE64_MEMBER(model3_sys_w);
	DECLARE_READ64_MEMBER(model3_rtc_r);
	DECLARE_WRITE64_MEMBER(model3_rtc_w);
	DECLARE_READ64_MEMBER(real3d_status_r);
	DECLARE_WRITE8_MEMBER(model3_sound_w);
	DECLARE_READ64_MEMBER(network_r);
	DECLARE_WRITE64_MEMBER(network_w);
	DECLARE_READ64_MEMBER(model3_security_r);
	DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
	DECLARE_WRITE16_MEMBER(model3snd_ctrl);
	UINT32 pci_device_get_reg();
	void pci_device_set_reg(UINT32 value);
	DECLARE_DRIVER_INIT(lemans24);
	DECLARE_DRIVER_INIT(vs298);
	DECLARE_DRIVER_INIT(vs299);
	DECLARE_DRIVER_INIT(swtrilgy);
	DECLARE_DRIVER_INIT(scudplus);
	DECLARE_DRIVER_INIT(model3_20);
	DECLARE_DRIVER_INIT(bass);
	DECLARE_DRIVER_INIT(vs2v991);
	DECLARE_DRIVER_INIT(vs2);
	DECLARE_DRIVER_INIT(daytona2);
	DECLARE_DRIVER_INIT(eca);
	DECLARE_DRIVER_INIT(srally2);
	DECLARE_DRIVER_INIT(harleya);
	DECLARE_DRIVER_INIT(skichamp);
	DECLARE_DRIVER_INIT(spikeofe);
	DECLARE_DRIVER_INIT(scud);
	DECLARE_DRIVER_INIT(harley);
	DECLARE_DRIVER_INIT(swtrilga);
	DECLARE_DRIVER_INIT(vs29815);
	DECLARE_DRIVER_INIT(model3_10);
	DECLARE_DRIVER_INIT(vs215);
	DECLARE_DRIVER_INIT(getbass);
	DECLARE_DRIVER_INIT(scudplusa);
	DECLARE_DRIVER_INIT(dirtdvls);
	DECLARE_DRIVER_INIT(vs299b);
	DECLARE_DRIVER_INIT(vf3);
	DECLARE_DRIVER_INIT(von2);
	DECLARE_DRIVER_INIT(vs299a);
	DECLARE_DRIVER_INIT(lostwsga);
	DECLARE_DRIVER_INIT(oceanhun);
	DECLARE_DRIVER_INIT(dayto2pe);
	DECLARE_DRIVER_INIT(spikeout);
	DECLARE_DRIVER_INIT(model3_15);
};


/*----------- defined in drivers/model3.c -----------*/

void model3_set_irq_line(running_machine &machine, UINT8 bit, int state);


/*----------- defined in machine/model3.c -----------*/

void model3_machine_init(running_machine &machine, int step);
int model3_tap_read(running_machine &machine);
void model3_tap_write(running_machine &machine, int tck, int tms, int tdi, int trst);
void model3_tap_reset(running_machine &machine);


/*----------- defined in video/model3.c -----------*/


VIDEO_START(model3);
SCREEN_UPDATE_IND16(model3);

void real3d_display_list_end(running_machine &machine);
void real3d_display_list1_dma(address_space *space, UINT32 src, UINT32 dst, int length, int byteswap);
void real3d_display_list2_dma(address_space *space, UINT32 src, UINT32 dst, int length, int byteswap);
void real3d_vrom_texture_dma(address_space *space, UINT32 src, UINT32 dst, int length, int byteswap);
void real3d_texture_fifo_dma(address_space *space, UINT32 src, int length, int byteswap);
void real3d_polygon_ram_dma(address_space *space, UINT32 src, UINT32 dst, int length, int byteswap);