summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/pc_vga_video7.cpp
blob: 273d5cf9ce797fcf437e1666cfde1f3838ef3681 (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
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
/**************************************************************************************************

Video7 / Headland / SPEA (S)VGA chipsets

TODO:
- drops in MDA mode with IOAS = 1 (EGA switch or extended switch at $f7?)

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

#include "emu.h"
#include "pc_vga_video7.h"

#define VERBOSE (LOG_GENERAL)
//#define LOG_OUTPUT_FUNC osd_printf_info

#include "logmacro.h"


DEFINE_DEVICE_TYPE(HT208_VIDEO7_VGA,    ht208_video7_vga_device,    "ht208_video7_vga",    "Headland HT208 VGA i/f")

ht208_video7_vga_device::ht208_video7_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
	: svga_device(mconfig, type, tag, owner, clock)
{
	m_seq_space_config = address_space_config("sequencer_regs", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(FUNC(ht208_video7_vga_device::sequencer_map), this));
}

ht208_video7_vga_device::ht208_video7_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: ht208_video7_vga_device(mconfig, HT208_VIDEO7_VGA, tag, owner, clock)
{
}

void ht208_video7_vga_device::device_start()
{
	svga_device::device_start();
	zero();

	vga.crtc.maximum_scan_line = 1;

	save_item(NAME(m_seq_unlock_reg));
	save_item(NAME(m_ext_b0_scratch));
	save_item(NAME(m_ext_fbctrl));
	save_item(NAME(m_ext_16bit));
}

void ht208_video7_vga_device::device_reset()
{
	svga_device::device_reset();

	std::fill(std::begin(m_ext_b0_scratch), std::end(m_ext_b0_scratch), 0);
	m_seq_unlock_reg = false;
	m_ext_fbctrl = 0;
	m_ext_16bit = 0;
}

void ht208_video7_vga_device::sequencer_map(address_map &map)
{
	svga_device::sequencer_map(map);
	map(0x08, 0xff).unmaprw();

	map(0x06, 0x06).lrw8(
		NAME([this] (offs_t offset) {
			// xxxx xxx- <unused>
			// ---- ---x unlocked if '1'
			return m_seq_unlock_reg;
		}),
		NAME([this] (offs_t offset, u8 data) {
			// TODO: log & actual space unlock
			if (data == 0xea)
				m_seq_unlock_reg = true;
			if (data == 0xae)
				m_seq_unlock_reg = false;
		})
	);

	map(0xa4, 0xa4).lrw8(
		NAME([this] (offs_t offset) { return m_ext_clock_select; }),
		NAME([this] (offs_t offset, u8 data) {
			LOG("ERA4: Clock Select %02x\n", data);
			m_ext_clock_select = data;
		})
	);
	map(0xb0, 0xbf).lrw8(
		NAME([this] (offs_t offset) { return m_ext_b0_scratch[offset]; }),
		NAME([this] (offs_t offset, u8 data) {
			m_ext_b0_scratch[offset] = data;
		})
	);

	map(0xf7, 0xf7).lr8(
		NAME([] (offs_t offset) { return 0; })
	);

	map(0xfe, 0xfe).lrw8(
		NAME([this] (offs_t offset) { return m_ext_fbctrl; }),
		NAME([this] (offs_t offset, u8 data) {
			LOG("ERFE: Foreground/Background Control %02x\n", data);
			m_ext_fbctrl = data;
		})
	);
	map(0xff, 0xff).lrw8(
		NAME([this] (offs_t offset) { return m_ext_16bit; }),
		NAME([this] (offs_t offset, u8 data) {
			LOG("ERFF: 16-bit i/f Control %02x\n", data);
			m_ext_16bit = data;
		})
	);
}