summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/sns_sgb.h
blob: 4c6ebf15af59b0b12ac38e8eeeafa0e6a272467b (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
#ifndef __SNS_SGB_H
#define __SNS_SGB_H

#include "machine/sns_slot.h"
#include "machine/sns_rom.h"

#include "machine/gb_slot.h"


// ======================> sns_rom_sgb_device

class sns_rom_sgb_device : public sns_rom_device
{
public:
	// construction/destruction
	sns_rom_sgb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	
	// device-level overrides
	virtual void device_start();
	virtual void device_reset();
	virtual machine_config_constructor device_mconfig_additions() const;

	// reading and writing
	virtual DECLARE_READ8_MEMBER(read_l);
	virtual DECLARE_READ8_MEMBER(read_h);
	virtual DECLARE_READ8_MEMBER(chip_read);
	virtual DECLARE_WRITE8_MEMBER(chip_write);
	
	virtual DECLARE_READ8_MEMBER(gb_cart_r);
	virtual DECLARE_WRITE8_MEMBER(gb_bank_w);
	virtual DECLARE_READ8_MEMBER(gb_ram_r);
	virtual DECLARE_WRITE8_MEMBER(gb_ram_w);
	virtual DECLARE_WRITE8_MEMBER(gb_timer_callback);

	required_device<cpu_device> m_gb_cpu;
	required_device<gb_cart_slot_device> m_cartslot;

	void lcd_render(UINT32 *source);

	// ICD2 regs
	UINT8 m_sgb_ly;
	UINT8 m_sgb_row;
	UINT8 m_vram;
	UINT8 m_port;
	UINT8 m_joy1, m_joy2, m_joy3, m_joy4;
	UINT8 m_joy_pckt[16];
	UINT16 m_vram_offs;
	UINT8 m_mlt_req;

	UINT32 m_lcd_buffer[4 * 160 * 8];
	UINT16 m_lcd_output[320];
	UINT16 m_lcd_row;

	// input bits
	int m_packetsize;
	UINT8 m_packet_data[64][16];
};


// device type definition
extern const device_type SNS_LOROM_SUPERGB;

#endif