-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
177 lines (148 loc) · 4.91 KB
/
common.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* z81/xz81, Linux console and X ZX81/ZX80 emulators.
* Copyright (C) 1994 Ian Collier. z81 changes (C) 1995-2001 Russell Marks.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* common.h - prototypes etc. for common.c.
*/
/*
Display constants
*/
#ifndef _COMMON_H_
#define _COMMON_H_
#include <stdbool.h>
#include <stdint.h>
// Sizes for normal display
#define DISPLAY_N_WIDTH 320
#define DISPLAY_N_HEIGHT 240
#define DISPLAY_N_START_X 46
#define DISPLAY_N_START_Y 24
#define DISPLAY_N_PIXEL_OFF 4
// Size for 576 line display (as for PAL TV)
#define DISPLAY_P_WIDTH 360
#define DISPLAY_P_HEIGHT 288
#define DISPLAY_P_START_X 24
#define DISPLAY_P_START_Y 0
#define DISPLAY_P_PIXEL_OFF 4
// Sizes for full (debug) display
#define DISPLAY_F_WIDTH 416
#define DISPLAY_F_HEIGHT 314
#define DISPLAY_F_START_X 0
#define DISPLAY_F_START_Y 0
#define DISPLAY_F_PIXEL_OFF 6
// Size of Padding between lines (in Bytes)
#define DISPLAY_PADDING 1
// ZX80 ROM OFFSET
#define DISPLAY_ZX80_OFF 6
typedef struct
{
uint16_t width; // width of screen in pixels
uint16_t height; // Height of screen in pixels
uint16_t length; // Size of buffer, including padding
uint16_t stride_bit; // bits in one line including padding
uint16_t stride_byte; // bytes in one line including padding
uint16_t start_x; // X Offset in bits to first pixel to display, without centring
uint16_t end_x; // X Offset in bits to last pixel to display, without centring
uint16_t start_y; // Y Offset in lines to first line to display
uint16_t end_y; // Y Offset in lines to last line to display
int16_t adjust_x; // Pixels to skip before start to display line
int16_t offset; // Offset in bits to convert from raster to display coords
uint16_t padding; // Padding per line in bytes
} Display_T;
extern Display_T disp;
#ifdef LOAD_AND_SAVE
/* ROM Patching */
#define LOAD_START_4K 0x207 // POP DE D1
#define SAVE_START_4K 0x1b7 // POP DE D1
#define LOAD_SAVE_RET_4K 0x203 // POP HL E1
#define LOAD_SAVE_RSTRT_4K 0x283
#define LOAD_START_8K 0x347 // RRC D CB 10
#define SAVE_START_8K 0x2ff // LD DE,$12CB 11
#define LOAD_SAVE_RET_8K 0x20A // LD HL,$403B 21
#define LOAD_SAVE_RSTRT_8K 0x207
typedef struct
{
uint16_t start;
bool use_rom;
} RomPatch_T;
typedef struct
{
RomPatch_T load;
RomPatch_T save;
uint16_t retAddr;
uint16_t rstrtAddr;
} RomPatches_T;
extern RomPatches_T rom_patches;
#endif
/* AY board types */
#define AY_TYPE_NONE 0
#define AY_TYPE_QUICKSILVA 1
#define AY_TYPE_ZONX 2
#define HIRESDISABLED 0
#define HIRESWRX 1
#define CHRGENSINCLAIR 0
#define CHRGENQS 2
#define CHRGENCHR16 3
extern unsigned char mem[];
extern unsigned char *memptr[64];
extern int memattr[64];
extern unsigned char keyports[9];
extern unsigned long tstates;
extern int help,sound,sound_vsync,sound_ay,sound_ay_type;
extern int invert_screen;
extern int interrupted;
extern int refresh_screen;
extern int zx80;
extern int rom4k;
extern int ignore_esc;
/* Variables set from SDL menus */
extern bool m1not;
extern bool useWRX;
extern bool useQSUDG;
extern bool chr128;
extern bool UDGEnabled;
extern bool LowRAM;
extern bool useNTSC;
/* Variable set from command line options*/
extern bool centreScreen;
extern bool fullDisplay;
extern bool fiveSevenSix;
extern bool romLoad;
extern bool romSave;
extern int vertTol;
/* Chroma variables */
extern int chromamode;
extern unsigned char bordercolour;
extern unsigned char bordercolournew;
extern unsigned char fullcolour;
extern unsigned char chroma_set;
/* Constants*/
extern const unsigned long tsmax;
extern void initmem();
extern void zxpopen(void);
extern void zxpclose(void);
extern unsigned int in(int h,int l);
extern unsigned int out(int h,int l,int a);
extern void do_interrupt();
extern void update_kybd();
extern void do_interrupt();
extern void frame_pause(void);
extern void common_reset(void);
extern void initdisplay(void);
extern void init_mem_structures(int ramsize);
extern void rom4kPatches(void);
extern void rom8kPatches(void);
#endif