summaryrefslogtreecommitdiffstats
path: root/src/mame/includes/namcos22.h
blob: 425867a770acfcab3e6b996595243438865fa009 (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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino, hap, R. Belmont
/***************************************************************************

    Namco System 22 / Super System 22 hardware

***************************************************************************/

#include "machine/eeprompar.h"
#include "machine/timer.h"
#include "video/rgbutil.h"
#include "video/poly.h"
#include "screen.h"

enum
{
	NAMCOS22_AIR_COMBAT22,
	NAMCOS22_ALPINE_RACER,
	NAMCOS22_CYBER_COMMANDO,
	NAMCOS22_CYBER_CYCLES,
	NAMCOS22_PROP_CYCLE,
	NAMCOS22_RAVE_RACER,
	NAMCOS22_RIDGE_RACER,
	NAMCOS22_RIDGE_RACER2,
	NAMCOS22_TIME_CRISIS,
	NAMCOS22_VICTORY_LAP,
	NAMCOS22_ACE_DRIVER,
	NAMCOS22_ALPINE_RACER_2,
	NAMCOS22_ALPINE_SURFER,
	NAMCOS22_TOKYO_WARS,
	NAMCOS22_AQUA_JET,
	NAMCOS22_DIRT_DASH,
	NAMCOS22_ARMADILLO_RACING
};


struct namcos22_polyvertex
{
	float x, y, z;
	int u, v; /* 0..0xfff */
	int bri;  /* 0..0xff */
};

enum namcos22_scenenode_type
{
	NAMCOS22_SCENENODE_NONLEAF,
	NAMCOS22_SCENENODE_QUAD,
	NAMCOS22_SCENENODE_SPRITE
};

#define NAMCOS22_RADIX_BITS 4
#define NAMCOS22_RADIX_BUCKETS (1 << NAMCOS22_RADIX_BITS)
#define NAMCOS22_RADIX_MASK (NAMCOS22_RADIX_BUCKETS - 1)

struct namcos22_scenenode
{
	namcos22_scenenode_type type;
	struct namcos22_scenenode *next;
	union
	{
		struct
		{
			struct namcos22_scenenode *next[NAMCOS22_RADIX_BUCKETS];
		} nonleaf;

		struct
		{
			float vx, vy, vw, vh;
			int texturebank;
			int color;
			int cmode;
			int flags;
			int cz_adjust;
			int direct;
			namcos22_polyvertex v[4];
		} quad;

		struct
		{
			int tile, color, pri;
			int flipx, flipy;
			int linktype;
			int cols, rows;
			int xpos, ypos;
			int cx_min, cx_max;
			int cy_min, cy_max;
			int sizex, sizey;
			int translucency;
			int cz;
		} sprite;
	} data;
};


struct namcos22_object_data
{
	/* poly / sprites */
	rgbaint_t fogcolor;
	rgbaint_t fadecolor;
	rgbaint_t polycolor;
	const pen_t *pens;
	bitmap_rgb32 *destbase;
	bitmap_ind8 *primap;
	int bn;
	int flags;
	int prioverchar;
	int cmode;
	int fadefactor;
	int pfade_enabled;
	int fogfactor;
	int zfog_enabled;
	int cz_adjust;
	int cz_sdelta;
	const uint8_t *czram;

	/* sprites */
	const uint8_t *source;
	int alpha;
	int line_modulo;
	int flipx;
	int flipy;
};


class namcos22_state;

class namcos22_renderer : public poly_manager<float, namcos22_object_data, 4, 8000>
{
public:
	namcos22_renderer(namcos22_state &state);

	void render_scene(screen_device &screen, bitmap_rgb32 &bitmap);
	struct namcos22_scenenode *new_scenenode(running_machine &machine, uint32_t zsort, namcos22_scenenode_type type);

	void reset();

private:
	namcos22_state &m_state;

	struct namcos22_scenenode m_scenenode_root;
	struct namcos22_scenenode *m_scenenode_cur;

	int m_clipx;
	int m_clipy;
	rectangle m_cliprect;

	inline uint8_t nthbyte(const uint32_t *src, int n) { return (src[n / 4] << ((n & 3) * 8)) >> 24; }
	inline uint16_t nthword(const uint32_t *src, int n) { return (src[n / 2] << ((n & 1) * 16)) >> 16; }

	void render_scene_nodes(screen_device &screen, bitmap_rgb32 &bitmap, struct namcos22_scenenode *node);
	void render_sprite(screen_device &screen, bitmap_rgb32 &bitmap, struct namcos22_scenenode *node);
	void poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bitmap, struct namcos22_scenenode *node);
	void poly3d_drawsprite(screen_device &screen, bitmap_rgb32 &dest_bmp, uint32_t code, uint32_t color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int cz_factor, int prioverchar, int alpha);

	void free_scenenode(struct namcos22_scenenode *node);
	struct namcos22_scenenode *alloc_scenenode(running_machine &machine, struct namcos22_scenenode *node);

	void renderscanline_uvi_full(int32_t scanline, const extent_t &extent, const namcos22_object_data &extra, int threadid);
	void renderscanline_sprite(int32_t scanline, const extent_t &extent, const namcos22_object_data &extra, int threadid);
};


enum namcos22_dsp_upload_state
{
	NAMCOS22_DSP_UPLOAD_READY,
	NAMCOS22_DSP_UPLOAD_DEST,
	NAMCOS22_DSP_UPLOAD_DATA
};

#define NAMCOS22_MAX_LIT_SURFACES 0x80
#define NAMCOS22_MAX_RENDER_CMD_SEQ 0x1c

class namcos22_state : public driver_device
{
public:
	namcos22_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_spriteram(*this, "spriteram")
		, m_czattr(*this, "czattr")
		, m_czram(*this, "czram")
		, m_gfxdecode(*this, "gfxdecode")
		, m_palette(*this, "palette")
		, m_maincpu(*this, "maincpu")
		, m_master(*this, "master")
		, m_slave(*this, "slave")
		, m_mcu(*this, "mcu")
		, m_iomcu(*this, "iomcu")
		, m_shareram(*this, "shareram")
		, m_eeprom(*this, "eeprom")
		, m_pSlaveExternalRAM(*this, "slaveextram")
		, m_pMasterExternalRAM(*this, "masterextram")
		, m_paletteram(*this, "paletteram")
		, m_cgram(*this, "cgram")
		, m_textram(*this, "textram")
		, m_polygonram(*this, "polygonram")
		, m_mixer(*this, "video_mixer")
		, m_gamma_proms(*this, "gamma_proms")
		, m_vics_data(*this, "vics_data")
		, m_vics_control(*this, "vics_control")
		, m_tilemapattr(*this, "tilemapattr")
		, m_motor_timer(*this, "motor_timer")
		, m_pc_pedal_interrupt(*this, "pc_p_int")
		, m_screen(*this, "screen")
		, m_adc_ports(*this, "ADC.%u", 0)
		, m_p1(*this, "P1")
		, m_p2(*this, "P2")
		, m_mcup5a(*this, "MCUP5A")
		, m_mcup5b(*this, "MCUP5B")
		, m_led(*this, "led")
		, m_cpuled(*this, "cpuled%u", 0U)
	{ }

	optional_shared_ptr<uint32_t> m_spriteram;
	optional_shared_ptr<uint32_t> m_czattr;
	optional_shared_ptr<uint32_t> m_czram;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	int m_poly_translucency;
	uint16_t *m_texture_tilemap;
	std::unique_ptr<uint8_t[]> m_texture_tileattr;
	uint8_t *m_texture_tiledata;
	std::unique_ptr<uint8_t[]> m_texture_ayx_to_pixel;
	std::unique_ptr<uint8_t[]> m_recalc_czram[4];
	int m_is_ss22;
	int m_mixer_flags;
	int m_fog_r;
	int m_fog_g;
	int m_fog_b;
	int m_fog_r_per_cztype[4];
	int m_fog_g_per_cztype[4];
	int m_fog_b_per_cztype[4];
	uint32_t m_fog_colormask;
	int m_screen_fade_r;
	int m_screen_fade_g;
	int m_screen_fade_b;
	int m_screen_fade_factor;
	int m_poly_fade_r;
	int m_poly_fade_g;
	int m_poly_fade_b;
	int m_poly_fade_enabled;

	DECLARE_WRITE32_MEMBER(namcos22s_czram_w);
	DECLARE_READ32_MEMBER(namcos22s_czram_r);
	DECLARE_READ32_MEMBER(namcos22s_vics_control_r);
	DECLARE_WRITE32_MEMBER(namcos22s_vics_control_w);
	DECLARE_WRITE32_MEMBER(namcos22_textram_w);
	DECLARE_READ32_MEMBER(namcos22_tilemapattr_r);
	DECLARE_WRITE32_MEMBER(namcos22_tilemapattr_w);
	DECLARE_READ32_MEMBER(namcos22s_spotram_r);
	DECLARE_WRITE32_MEMBER(namcos22s_spotram_w);
	DECLARE_READ32_MEMBER(namcos22_dspram_r);
	DECLARE_WRITE32_MEMBER(namcos22_dspram_w);
	DECLARE_WRITE32_MEMBER(namcos22_cgram_w);
	DECLARE_WRITE32_MEMBER(namcos22_paletteram_w);
	DECLARE_WRITE16_MEMBER(namcos22_dspram16_bank_w);
	DECLARE_READ16_MEMBER(namcos22_dspram16_r);
	DECLARE_WRITE16_MEMBER(namcos22_dspram16_w);
	DECLARE_CUSTOM_INPUT_MEMBER(alpine_motor_read);
	DECLARE_READ16_MEMBER(pdp_status_r);
	DECLARE_READ16_MEMBER(pdp_begin_r);
	DECLARE_READ16_MEMBER(slave_external_ram_r);
	DECLARE_WRITE16_MEMBER(slave_external_ram_w);
	DECLARE_READ16_MEMBER(dsp_hold_signal_r);
	DECLARE_WRITE16_MEMBER(dsp_hold_ack_w);
	DECLARE_WRITE16_MEMBER(dsp_xf_output_w);
	DECLARE_WRITE16_MEMBER(point_address_w);
	DECLARE_WRITE16_MEMBER(point_loword_iw);
	DECLARE_WRITE16_MEMBER(point_hiword_w);
	DECLARE_READ16_MEMBER(point_loword_r);
	DECLARE_READ16_MEMBER(point_hiword_ir);
	DECLARE_WRITE16_MEMBER(dsp_unk2_w);
	DECLARE_READ16_MEMBER(dsp_unk_port3_r);
	DECLARE_WRITE16_MEMBER(upload_code_to_slave_dsp_w);
	DECLARE_READ16_MEMBER(dsp_unk8_r);
	DECLARE_READ16_MEMBER(custom_ic_status_r);
	DECLARE_READ16_MEMBER(dsp_upload_status_r);
	DECLARE_READ16_MEMBER(master_external_ram_r);
	DECLARE_WRITE16_MEMBER(master_external_ram_w);
	DECLARE_WRITE16_MEMBER(slave_serial_io_w);
	DECLARE_READ16_MEMBER(master_serial_io_r);
	DECLARE_WRITE16_MEMBER(dsp_unk_porta_w);
	DECLARE_WRITE16_MEMBER(dsp_led_w);
	DECLARE_WRITE16_MEMBER(dsp_unk8_w);
	DECLARE_WRITE16_MEMBER(master_render_device_w);
	DECLARE_READ16_MEMBER(dsp_bioz_r);
	DECLARE_READ16_MEMBER(dsp_slave_port3_r);
	DECLARE_READ16_MEMBER(dsp_slave_port4_r);
	DECLARE_READ16_MEMBER(dsp_slave_port5_r);
	DECLARE_READ16_MEMBER(dsp_slave_port6_r);
	DECLARE_WRITE16_MEMBER(dsp_slave_portc_w);
	DECLARE_READ16_MEMBER(dsp_slave_port8_r);
	DECLARE_READ16_MEMBER(dsp_slave_portb_r);
	DECLARE_WRITE16_MEMBER(dsp_slave_portb_w);
	DECLARE_READ32_MEMBER(namcos22_sci_r);
	DECLARE_READ8_MEMBER(namcos22_system_controller_r);
	DECLARE_WRITE8_MEMBER(namcos22s_system_controller_w);
	DECLARE_WRITE8_MEMBER(namcos22_system_controller_w);
	DECLARE_READ16_MEMBER(namcos22_keycus_r);
	DECLARE_WRITE16_MEMBER(namcos22_keycus_w);
	DECLARE_READ16_MEMBER(namcos22_portbit_r);
	DECLARE_WRITE16_MEMBER(namcos22_portbit_w);
	DECLARE_READ16_MEMBER(namcos22_dipswitch_r);
	DECLARE_READ32_MEMBER(namcos22_gun_r);
	DECLARE_WRITE16_MEMBER(namcos22_cpuleds_w);
	DECLARE_READ32_MEMBER(alpinesa_prot_r);
	DECLARE_WRITE32_MEMBER(alpinesa_prot_w);
	DECLARE_WRITE32_MEMBER(namcos22s_chipselect_w);
	DECLARE_READ16_MEMBER(s22mcu_shared_r);
	DECLARE_WRITE16_MEMBER(s22mcu_shared_w);
	DECLARE_WRITE8_MEMBER(mcu_port4_w);
	DECLARE_READ8_MEMBER(mcu_port4_r);
	DECLARE_WRITE8_MEMBER(mcu_port5_w);
	DECLARE_READ8_MEMBER(mcu_port5_r);
	DECLARE_WRITE8_MEMBER(mcu_port6_w);
	DECLARE_READ8_MEMBER(mcu_port6_r);
	DECLARE_WRITE8_MEMBER(mcu_port7_w);
	DECLARE_READ8_MEMBER(mcu_port7_r);
	DECLARE_READ8_MEMBER(namcos22s_mcu_adc_r);
	DECLARE_WRITE8_MEMBER(propcycle_mcu_port5_w);
	DECLARE_WRITE8_MEMBER(alpine_mcu_port5_w);
	DECLARE_READ8_MEMBER(mcu_port4_s22_r);
	DECLARE_READ8_MEMBER(iomcu_port4_s22_r);
	DECLARE_READ16_MEMBER(mcu141_speedup_r);
	DECLARE_WRITE16_MEMBER(mcu_speedup_w);
	DECLARE_READ16_MEMBER(mcu130_speedup_r);
	DECLARE_READ16_MEMBER(mcuc74_speedup_r);

	inline uint8_t nthbyte(const uint32_t *src, int n) { return (src[n / 4] << ((n & 3) * 8)) >> 24; }
	inline uint16_t nthword(const uint32_t *src, int n) { return (src[n / 2] << ((n & 1) * 16)) >> 16; }

	inline int32_t signed18(int32_t val) { return (val & 0x00020000) ? (int32_t)(val | 0xfffc0000) : val & 0x0001ffff; }
	inline int32_t signed24(int32_t val) { return (val & 0x00800000) ? (int32_t)(val | 0xff000000) : val & 0x007fffff; }

	inline float dspfixed_to_nativefloat(int16_t val) { return val / (float)0x7fff; }
	float dspfloat_to_nativefloat(uint32_t val);

	void handle_driving_io();
	void handle_coinage(int slots, int address_is_odd);
	void handle_cybrcomm_io();
	uint32_t pdp_polygonram_read(offs_t offs);
	void pdp_polygonram_write(offs_t offs, uint32_t data);
	void point_write(offs_t offs, uint32_t data);
	void slave_halt();
	void slave_enable();
	void enable_slave_simulation(bool enable);

	void matrix3d_multiply(float a[4][4], float b[4][4]);
	void matrix3d_identity(float m[4][4]);
	void transform_point(float *vx, float *vy, float *vz, float m[4][4]);
	void transform_normal(float *nx, float *ny, float *nz, float m[4][4]);
	void register_normals(int32_t addr, float m[4][4]);

	void blit_single_quad(bitmap_rgb32 &bitmap, uint32_t color, uint32_t addr, float m[4][4], int32_t polyshift, int flags, int packetformat);
	void blit_quads(bitmap_rgb32 &bitmap, int32_t addr, float m[4][4], int32_t base);
	void blit_polyobject(bitmap_rgb32 &bitmap, int code, float m[4][4]);

	void slavesim_handle_bb0003(const int32_t *src);
	void slavesim_handle_200002(bitmap_rgb32 &bitmap, const int32_t *src);
	void slavesim_handle_300000(const int32_t *src);
	void slavesim_handle_233002(const int32_t *src);
	void simulate_slavedsp(bitmap_rgb32 &bitmap);

	int32_t point_read(int32_t addr);
	void init_tables();
	void update_mixer();
	void update_palette();
	void recalc_czram();
	void draw_direct_poly(const uint16_t *src);
	void draw_polygons(bitmap_rgb32 &bitmap);
	void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
	void draw_sprite_group(bitmap_rgb32 &bitmap, const rectangle &cliprect, const uint32_t *src, const uint32_t *attr, int num_sprites, int deltax, int deltay, int y_lowres);
	void draw_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	void namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int prival);
	void namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);

	void install_c74_speedup();
	void install_130_speedup();
	void install_141_speedup();
	void namcos22_init(int game_type);

	void init_acedrvr();
	void init_aquajet();
	void init_adillor();
	void init_cybrcyc();
	void init_raveracw();
	void init_ridger2j();
	void init_victlap();
	void init_cybrcomm();
	void init_timecris();
	void init_tokyowar();
	void init_propcycl();
	void init_alpiner2();
	void init_dirtdash();
	void init_airco22();
	void init_alpiner();
	void init_ridgeraj();
	void init_alpinesa();

	TILE_GET_INFO_MEMBER(get_text_tile_info);
	DECLARE_MACHINE_START(adillor);
	uint32_t screen_update_namcos22s(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_namcos22(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	INTERRUPT_GEN_MEMBER(namcos22s_interrupt);
	INTERRUPT_GEN_MEMBER(namcos22_interrupt);
	TIMER_DEVICE_CALLBACK_MEMBER(adillor_trackball_update);
	TIMER_CALLBACK_MEMBER(adillor_trackball_interrupt);
	TIMER_DEVICE_CALLBACK_MEMBER(propcycl_pedal_update);
	TIMER_DEVICE_CALLBACK_MEMBER(propcycl_pedal_interrupt);
	TIMER_DEVICE_CALLBACK_MEMBER(alpine_steplock_callback);
	TIMER_DEVICE_CALLBACK_MEMBER(dsp_master_serial_irq);
	TIMER_DEVICE_CALLBACK_MEMBER(dsp_slave_serial_irq);
	TIMER_DEVICE_CALLBACK_MEMBER(mcu_irq);
	void namcos22s(machine_config &config);
	void propcycl(machine_config &config);
	void dirtdash(machine_config &config);
	void airco22b(machine_config &config);
	void cybrcycc(machine_config &config);
	void tokyowar(machine_config &config);
	void cybrcomm(machine_config &config);
	void alpine(machine_config &config);
	void alpinesa(machine_config &config);
	void adillor(machine_config &config);
	void timecris(machine_config &config);
	void namcos22(machine_config &config);
	void alpine_io_map(address_map &map);
	void alpinesa_am(address_map &map);
	void iomcu_s22_io(address_map &map);
	void iomcu_s22_program(address_map &map);
	void master_dsp_data(address_map &map);
	void master_dsp_io(address_map &map);
	void master_dsp_program(address_map &map);
	void mcu_io(address_map &map);
	void mcu_program(address_map &map);
	void mcu_s22_io(address_map &map);
	void mcu_s22_program(address_map &map);
	void namcos22_am(address_map &map);
	void namcos22s_am(address_map &map);
	void propcycl_io_map(address_map &map);
	void slave_dsp_data(address_map &map);
	void slave_dsp_io(address_map &map);
	void slave_dsp_program(address_map &map);
	void timecris_am(address_map &map);

protected:
	virtual void machine_reset() override;
	virtual void machine_start() override;
	virtual void video_start() override;

	required_device<cpu_device> m_maincpu;
	required_device<cpu_device> m_master;
	required_device<cpu_device> m_slave;
	required_device<cpu_device> m_mcu;
	optional_device<cpu_device> m_iomcu;
	required_shared_ptr<uint32_t> m_shareram;
	required_device<eeprom_parallel_28xx_device> m_eeprom;
	required_shared_ptr<uint16_t> m_pSlaveExternalRAM;
	required_shared_ptr<uint16_t> m_pMasterExternalRAM;
	required_shared_ptr<uint32_t> m_paletteram;
	required_shared_ptr<uint32_t> m_cgram;
	required_shared_ptr<uint32_t> m_textram;
	required_shared_ptr<uint32_t> m_polygonram;
	required_shared_ptr<uint32_t> m_mixer;
	optional_region_ptr<uint8_t> m_gamma_proms;
	optional_shared_ptr<uint32_t> m_vics_data;
	optional_shared_ptr<uint32_t> m_vics_control;
	required_shared_ptr<uint32_t> m_tilemapattr;
	optional_device<timer_device> m_motor_timer;
	optional_device<timer_device> m_pc_pedal_interrupt;
	required_device<screen_device> m_screen;
	optional_ioport_array<8> m_adc_ports;
	optional_ioport m_p1;
	optional_ioport m_p2;
	optional_ioport m_mcup5a;
	optional_ioport m_mcup5b;
	output_finder<> m_led;
	output_finder<8> m_cpuled;

	uint8_t m_syscontrol[0x20];
	bool m_dsp_irq_enabled;
	emu_timer *m_ar_tb_interrupt[2];
	uint16_t m_dsp_master_bioz;
	std::unique_ptr<uint32_t[]> m_pointram;
	uint32_t m_old_coin_state;
	uint32_t m_credits1;
	uint32_t m_credits2;
	uint32_t m_point_address;
	uint32_t m_point_data;
	uint16_t m_SerialDataSlaveToMasterNext;
	uint16_t m_SerialDataSlaveToMasterCurrent;
	int m_RenderBufSize;
	uint16_t m_RenderBufData[NAMCOS22_MAX_RENDER_CMD_SEQ];
	uint16_t m_portbits[2];
	int m_irq_state;
	namcos22_dsp_upload_state m_dsp_upload_state;
	int m_UploadDestIdx;
	uint32_t m_alpinesa_protection;
	int m_motor_status;
	int m_p4;
	uint16_t m_su_82;
	uint16_t m_keycus_id;
	uint16_t m_keycus_rng;
	int m_gametype;
	int m_chipselect;
	int m_spot_enable;
	int m_spot_read_address;
	int m_spot_write_address;
	std::unique_ptr<uint16_t[]> m_spotram;
	std::unique_ptr<uint16_t[]> m_banked_czram[4];
	uint32_t m_cz_was_written[4];
	int m_cz_adjust;
	namcos22_renderer *m_poly;
	uint16_t m_dspram_bank;
	uint16_t m_dspram16_latch;
	bool m_slave_simulation_active;
	int32_t m_absolute_priority;
	int32_t m_objectshift;
	uint16_t m_PrimitiveID;
	float m_viewmatrix[4][4];
	uint8_t m_LitSurfaceInfo[NAMCOS22_MAX_LIT_SURFACES];
	int32_t m_SurfaceNormalFormat;
	unsigned m_LitSurfaceCount;
	unsigned m_LitSurfaceIndex;
	int m_pointrom_size;
	int32_t *m_pointrom;
	std::unique_ptr<uint8_t[]> m_dirtypal;
	std::unique_ptr<bitmap_ind16> m_mix_bitmap;
	tilemap_t *m_bgtilemap;

	int m_spot_limit;
	int m_text_palbase;

	float m_camera_zoom;
	float m_camera_vx;
	float m_camera_vy;
	float m_camera_vw;
	float m_camera_vh;
	float m_camera_lx; // unit vector for light direction
	float m_camera_ly; // "
	float m_camera_lz; // "
	int m_camera_ambient; // 0.0..1.0
	int m_camera_power;   // 0.0..1.0
};