fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/chipset/e6845.h *
7 * Created: 2017-08-07 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2017-2022 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23/* MC6850 CRTC */
24
25
26#ifndef PCE_CHIPSET_E6845_H
27#define PCE_CHIPSET_E6845_H 1
28
29
30#define E6845_REG_CNT 18
31
32#define E6845_REG_HT 0
33#define E6845_REG_HD 1
34#define E6845_REG_HS 2
35#define E6845_REG_SW 3
36#define E6845_REG_VT 4
37#define E6845_REG_VA 5
38#define E6845_REG_VD 6
39#define E6845_REG_VS 7
40#define E6845_REG_IL 8
41#define E6845_REG_ML 9
42#define E6845_REG_CS 10
43#define E6845_REG_CE 11
44#define E6845_REG_AH 12
45#define E6845_REG_AL 13
46#define E6845_REG_CH 14
47#define E6845_REG_CL 15
48#define E6845_REG_LH 16
49#define E6845_REG_LL 17
50
51
52typedef struct {
53 unsigned ccol;
54 unsigned crow;
55 unsigned frame;
56 unsigned ma;
57 unsigned char ra;
58
59 unsigned char hsync_cnt;
60 unsigned char vsync_cnt;
61
62 unsigned char index;
63 unsigned char reg[E6845_REG_CNT];
64
65 void *hsync_ext;
66 void (*hsync_fct) (void *ext);
67
68 void *vsync_ext;
69 void (*vsync_fct) (void *ext);
70} e6845_t;
71
72
73#define e6845_get_ht(crt) ((crt)->reg[E6845_REG_HT])
74#define e6845_get_hd(crt) ((crt)->reg[E6845_REG_HD])
75#define e6845_get_hs(crt) ((crt)->reg[E6845_REG_HS])
76#define e6845_get_sw(crt) ((crt)->reg[E6845_REG_SW])
77#define e6845_get_vt(crt) ((crt)->reg[E6845_REG_VT])
78#define e6845_get_va(crt) ((crt)->reg[E6845_REG_VA])
79#define e6845_get_vd(crt) ((crt)->reg[E6845_REG_VD])
80#define e6845_get_vs(crt) ((crt)->reg[E6845_REG_VS])
81#define e6845_get_il(crt) ((crt)->reg[E6845_REG_IL])
82#define e6845_get_ml(crt) ((crt)->reg[E6845_REG_ML])
83#define e6845_get_cs(crt) ((crt)->reg[E6845_REG_CS])
84#define e6845_get_ce(crt) ((crt)->reg[E6845_REG_CE])
85#define e6845_get_ah(crt) ((crt)->reg[E6845_REG_AH])
86#define e6845_get_al(crt) ((crt)->reg[E6845_REG_AL])
87#define e6845_get_ch(crt) ((crt)->reg[E6845_REG_CH])
88#define e6845_get_cl(crt) ((crt)->reg[E6845_REG_CL])
89#define e6845_get_lh(crt) ((crt)->reg[E6845_REG_LH])
90#define e6845_get_ll(crt) ((crt)->reg[E6845_REG_LL])
91
92
93void e6845_init (e6845_t *crt);
94void e6845_free (e6845_t *crt);
95
96void e6845_set_hsync_fct (e6845_t *crt, void *ext, void *fct);
97void e6845_set_vsync_fct (e6845_t *crt, void *ext, void *fct);
98
99unsigned e6845_get_start_address (const e6845_t *crt);
100unsigned e6845_get_cursor_address (const e6845_t *crt);
101unsigned e6845_get_cursor_mask (e6845_t *crt, int blink);
102unsigned e6845_get_vtl (const e6845_t *crt);
103unsigned e6845_get_vdl (const e6845_t *crt);
104unsigned e6845_get_vsl (const e6845_t *crt);
105int e6845_get_hde (const e6845_t *crt);
106int e6845_get_vde (const e6845_t *crt);
107int e6845_get_de (const e6845_t *crt);
108
109void e6845_set_pen (e6845_t *crt);
110
111unsigned char e6845_get_index (const e6845_t *crt);
112unsigned char e6845_get_data (e6845_t *crt);
113unsigned char e6845_get_uint8 (e6845_t *crt, unsigned long addr);
114unsigned short e6845_get_uint16 (e6845_t *crt, unsigned long addr);
115
116void e6845_set_index (e6845_t *crt, unsigned char val);
117void e6845_set_data (e6845_t *crt, unsigned char val);
118void e6845_set_uint8 (e6845_t *crt, unsigned long addr, unsigned char val);
119void e6850_set_uint16 (e6845_t *crt, unsigned long addr, unsigned short val);
120
121void e6845_reset (e6845_t *crt);
122
123void e6845_clock (e6845_t *crt, unsigned cnt);
124
125
126#endif