-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscld.h
136 lines (107 loc) · 4.37 KB
/
scld.h
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
136
/* scld.h: Routines for handling the Timex SCLD
Copyright (c) 2002-2004 Fredrick Meunier, Witold Filipczyk
$Id: scld.h 2993 2007-06-17 13:54:49Z pak21 $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
#ifndef FUSE_SCLD_H
#define FUSE_SCLD_H
#ifndef FUSE_MEMORY_H
#include "memory.h"
#endif /* #ifndef FUSE_MEMORY_H */
#define STANDARD 0x00 /* standard Spectrum */
#define ALTDFILE 0x01 /* the same in nature as above, but using second
display file */
#define EXTCOLOUR 0x02 /* extended colours (data taken from first screen,
attributes 1x8 taken from second display. */
#define EXTCOLALTD 0x03 /* similar to above, but data is taken from second
screen */
#define HIRESATTR 0x04 /* hires mode, data in odd columns is taken from
first screen in standard way, data in even
columns is made from attributes data (8x8) */
#define HIRESATTRALTD 0x05 /* similar to above, but data taken from second
display */
#define HIRES 0x06 /* true hires mode, odd columns from first screen,
even columns from second screen. columns
numbered from 1. */
#define HIRESDOUBLECOL 0x07 /* data taken only from second screen, columns are
doubled */
#define HIRESCOLMASK 0x38
#define WHITEBLACK 0x00
#define YELLOWBLUE 0x01
#define CYANRED 0x02
#define GREENMAGENTA 0x03
#define MAGENTAGREEN 0x04
#define REDCYAN 0x05
#define BLUEYELLOW 0x06
#define BLACKWHITE 0x07
#define ALTDFILE_OFFSET 0x2000
#ifdef WORDS_BIGENDIAN
typedef struct
{
unsigned altmembank : 1; /* ALTMEMBANK : 0 = cartridge, 1 = exrom */
unsigned intdisable : 1; /* INTDISABLE */
unsigned b5 : 1; /* */
unsigned b4 : 1; /* */
unsigned b3 : 1; /* */
unsigned hires : 1; /* SCLD HIRES mode */
unsigned b1 : 1; /* */
unsigned altdfile : 1; /* SCLD use ALTDFILE */
} scld_names;
typedef struct
{
unsigned b7 : 1; /* */
unsigned b6 : 1; /* */
unsigned hirescol : 3; /* HIRESCOLMASK */
unsigned scrnmode : 3; /* SCRNMODEMASK */
} scld_masks;
#else /* #ifdef WORDS_BIGENDIAN */
typedef struct
{
unsigned altdfile : 1; /* SCLD use ALTDFILE */
unsigned b1 : 1; /* */
unsigned hires : 1; /* SCLD HIRES mode */
unsigned b3 : 1; /* */
unsigned b4 : 1; /* */
unsigned b5 : 1; /* */
unsigned intdisable : 1; /* INTDISABLE */
unsigned altmembank : 1; /* ALTMEMBANK : 0 = cartridge, 1 = exrom */
} scld_names;
typedef struct
{
unsigned scrnmode : 3; /* SCRNMODEMASK */
unsigned hirescol : 3; /* HIRESCOLMASK */
unsigned b6 : 1; /* */
unsigned b7 : 1; /* */
} scld_masks;
#endif /* #ifdef WORDS_BIGENDIAN */
typedef union
{
libspectrum_byte byte;
scld_masks mask;
scld_names name;
} scld;
extern scld scld_last_dec; /* The last byte sent to Timex DEC port */
extern libspectrum_byte scld_last_hsr; /* Last byte sent to Timex HSR port */
extern memory_page timex_exrom[8];
extern memory_page timex_dock[8];
int scld_init( void );
void scld_dec_write( libspectrum_word port, libspectrum_byte b );
libspectrum_byte scld_dec_read( libspectrum_word port, int *attached );
void scld_hsr_write( libspectrum_word port, libspectrum_byte b );
libspectrum_byte scld_hsr_read( libspectrum_word port, int *attached );
void scld_memory_map( void );
libspectrum_byte hires_get_attr( void );
libspectrum_byte hires_convert_dec( libspectrum_byte attr );
#endif /* #ifndef FUSE_SCLD_H */