summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/qbus/dvk_kgd.h
blob: 8ecd4ef23e22fee2d12697d9744954e9b6b89907 (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
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************

    Monochrome register-addressable framebuffer used in DVK.

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

#ifndef MAME_BUS_QBUS_DVK_KGD_H
#define MAME_BUS_QBUS_DVK_KGD_H

#pragma once

#include "qbus.h"

#include "screen.h"


static constexpr int KGDCR_WR = 0140000;
static constexpr int KGDDR_WR = 0000377;
static constexpr int KGDAR_WR = 0037777;
static constexpr int KGDCT_WR = 0037777;


/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

// ======================> dvk_kgd_device

class dvk_kgd_device : public device_t,
					public device_qbus_card_interface
{
public:
	// construction/destruction
	dvk_kgd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	uint16_t read(offs_t offset);
	void write(offs_t offset, uint16_t data);

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual void device_add_mconfig(machine_config &config) override;

	required_device<screen_device> m_screen;

private:
	std::unique_ptr<uint8_t[]> m_videoram_base;
	uint8_t *m_videoram;

	uint16_t m_cr;
	uint16_t m_dr;
	uint16_t m_ar;
	uint16_t m_ct;
};


// device type definition
DECLARE_DEVICE_TYPE(DVK_KGD, dvk_kgd_device)

#endif