summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/includes/pokemini.h
blob: 9a25332005a2d2ba06d823e3dc96e0242f50faff (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
/*****************************************************************************
 *
 * includes/pokemini.h
 *
 ****************************************************************************/

#ifndef POKEMINI_H_
#define POKEMINI_H_

#include "sound/speaker.h"
#include "machine/i2cmem.h"
#include "cpu/minx/minx.h"
#include "imagedev/cartslot.h"
#include "rendlay.h"


struct PRC
{
	UINT8       colors_inverted;
	UINT8       background_enabled;
	UINT8       sprites_enabled;
	UINT8       copy_enabled;
	UINT8       map_size;
	UINT8       map_size_x;
	UINT8       frame_count;
	UINT8       max_frame_count;
	UINT32      bg_tiles;
	UINT32      spr_tiles;
	UINT8       count;
	emu_timer   *count_timer;
};


struct TIMERS
{
	emu_timer   *seconds_timer;
	emu_timer   *hz256_timer;
	emu_timer   *timer1;                /* Timer 1 low or 16bit */
	emu_timer   *timer1_hi;             /* Timer 1 hi */
	emu_timer   *timer2;                /* Timer 2 low or 16bit */
	emu_timer   *timer2_hi;             /* Timer 2 high */
	emu_timer   *timer3;                /* Timer 3 low or 16bit */
	emu_timer   *timer3_hi;             /* Timer 3 high */
};


class pokemini_state : public driver_device
{
public:
	pokemini_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_maincpu(*this, "maincpu")
		, m_p_ram(*this, "p_ram")
		, m_speaker(*this, SPEAKER_TAG)
		, m_i2cmem(*this, "i2cmem")
		, m_inputs(*this, "INPUTS")
	{ }

	required_device<cpu_device> m_maincpu;
	required_shared_ptr<UINT8> m_p_ram;
	UINT8 m_pm_reg[0x100];
	PRC m_prc;
	TIMERS m_timers;
	bitmap_ind16 m_bitmap;
	virtual void video_start();
	virtual void machine_start();

	UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	virtual void palette_init();
	TIMER_CALLBACK_MEMBER(pokemini_seconds_timer_callback);
	TIMER_CALLBACK_MEMBER(pokemini_256hz_timer_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer1_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer1_hi_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer2_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer2_hi_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer3_callback);
	TIMER_CALLBACK_MEMBER(pokemini_timer3_hi_callback);
	TIMER_CALLBACK_MEMBER(pokemini_prc_counter_callback);
	DECLARE_WRITE8_MEMBER(pokemini_hwreg_w);
	DECLARE_READ8_MEMBER(pokemini_hwreg_r);
	DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pokemini_cart);

protected:
	required_device<speaker_sound_device> m_speaker;
	required_device<i2cmem_device> m_i2cmem;
	required_ioport m_inputs;

	void pokemini_check_irqs();
	void pokemini_update_sound();
};

#endif /* POKEMINI_H */