summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/isa/aga.h
blob: 990bd5d31828ef1812936b65aa0a142abdcd1a0e (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
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/*
  pc cga/mda combi adapters

  one type hardware switchable between cga and mda/hercules
  another type software switchable between cga and mda/hercules

  some support additional modes like
  commodore pc10 320x200 in 16 colors


    // aga
    // 256 8x8 thick chars
    // 256 8x8 thin chars
    // 256 9x14 in 8x16 chars, line 3 is connected to a10
    ROM_LOAD("aga.chr",     0x00000, 0x02000, CRC(aca81498))
    // hercules font of above
    ROM_LOAD("hercules.chr", 0x00000, 0x1000, CRC(7e8c9d76))

*/
#ifndef MAME_BUS_ISA_AGA_H
#define MAME_BUS_ISA_AGA_H

#include "isa.h"
#include "cga.h"
#include "video/mc6845.h"
#include "emupal.h"

enum AGA_MODE  { AGA_OFF, AGA_COLOR, AGA_MONO };

// ======================> isa8_aga_device

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

	DECLARE_READ8_MEMBER( pc_aga_mda_r );
	DECLARE_WRITE8_MEMBER( pc_aga_mda_w );
	DECLARE_READ8_MEMBER( pc_aga_cga_r );
	DECLARE_WRITE8_MEMBER( pc_aga_cga_w );
	void set_palette_luts(void);
	void pc_aga_set_mode(AGA_MODE mode);
	DECLARE_WRITE8_MEMBER( pc_aga_videoram_w );
	DECLARE_READ8_MEMBER( pc_aga_videoram_r );

	MC6845_UPDATE_ROW( mda_text_inten_update_row );
	MC6845_UPDATE_ROW( mda_text_blink_update_row );
	MC6845_UPDATE_ROW( cga_text_inten_update_row );
	MC6845_UPDATE_ROW( cga_text_inten_alt_update_row );
	MC6845_UPDATE_ROW( cga_text_blink_update_row );
	MC6845_UPDATE_ROW( cga_text_blink_alt_update_row );
	MC6845_UPDATE_ROW( cga_gfx_4bppl_update_row );
	MC6845_UPDATE_ROW( cga_gfx_4bpph_update_row );
	MC6845_UPDATE_ROW( cga_gfx_2bpp_update_row );
	MC6845_UPDATE_ROW( cga_gfx_1bpp_update_row );

	required_device<palette_device> m_palette;
	required_device<mc6845_device> m_mc6845;

protected:
	isa8_aga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);

	// device-level overrides
	virtual void device_start() override;

	// optional information overrides
	virtual void device_add_mconfig(machine_config &config) override;
	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual ioport_constructor device_input_ports() const override;

	required_ioport m_cga_config;

	int     m_update_row_type;
	AGA_MODE    m_mode;
	uint8_t   m_mda_mode_control;
	uint8_t   m_mda_status;
	uint8_t   *m_mda_chr_gen;

	uint8_t   m_cga_mode_control;
	uint8_t   m_cga_color_select;
	uint8_t   m_cga_status;
	uint8_t   *m_cga_chr_gen;

	int   m_framecnt;
	uint8_t   m_vsync;
	uint8_t   m_hsync;


	uint8_t   m_cga_palette_lut_2bpp[4];

	std::unique_ptr<uint8_t[]>  m_videoram;

private:
	MC6845_UPDATE_ROW( aga_update_row );
	DECLARE_WRITE_LINE_MEMBER( hsync_changed );
	DECLARE_WRITE_LINE_MEMBER( vsync_changed );
};

// device type definition
DECLARE_DEVICE_TYPE(ISA8_AGA, isa8_aga_device)

// ======================> isa8_aga_pc200_device

class isa8_aga_pc200_device :
		public isa8_aga_device
{
public:
	// construction/destruction
	isa8_aga_pc200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
	// optional information overrides
	virtual const tiny_rom_entry *device_rom_region() const override;

	DECLARE_READ8_MEMBER( pc200_videoram_r );
	DECLARE_WRITE8_MEMBER( pc200_videoram_w );
	DECLARE_WRITE8_MEMBER( pc200_cga_w );
	DECLARE_READ8_MEMBER( pc200_cga_r );

protected:
	// device-level overrides
	virtual void device_start() override;

	uint8_t m_port8;
	uint8_t m_portd;
	uint8_t m_porte;
};

// device type definition
DECLARE_DEVICE_TYPE(ISA8_AGA_PC200, isa8_aga_pc200_device)

#endif // MAME_BUS_ISA_AGA_H