-
Notifications
You must be signed in to change notification settings - Fork 4
/
dxr_atm.cpp
209 lines (185 loc) · 4.97 KB
/
dxr_atm.cpp
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#include "std.h"
#include "emul.h"
#include "vars.h"
#include "draw.h"
#include "dxrend.h"
#include "dxr_atm0.h"
#include "dxr_atm2.h"
#include "dxr_atm6.h"
#include "dxr_atm7.h"
#include "dxr_atmf.h"
typedef void (*TAtmRendFunc)(unsigned char *dst, unsigned pitch);
static void rend_atm_frame_small(unsigned char *dst, unsigned pitch)
{
static const TAtmRendFunc AtmRendFunc[] =
{ rend_atmframe8, rend_atmframe16, 0, rend_atmframe32 };
AtmRendFunc[temp.obpp/8-1](dst, pitch);
}
static void rend_atm_frame(unsigned char *dst, unsigned pitch)
{
if (conf.fast_sl) {
switch(temp.obpp)
{
case 8:
rend_atmframe_8d1(dst, pitch);
break;
case 16:
rend_atmframe_16d1(dst, pitch);
break;
case 32:
rend_atmframe_32d1(dst, pitch);
break;
}
} else {
switch(temp.obpp)
{
case 8:
rend_atmframe_8d(dst, pitch);
break;
case 16:
rend_atmframe_16d(dst, pitch);
break;
case 32:
rend_atmframe_32d(dst, pitch);
break;
}
}
}
// atm2, atm3
void rend_atm_2_small(unsigned char *dst, unsigned pitch)
{
if (temp.comp_pal_changed) {
pixel_tables();
temp.comp_pal_changed = 0;
}
if ( 3 == (comp.pFF77 & 7) ) //< Sinclair VideoMode
{
rend_small(dst, pitch);
return;
}
if ( 7 == (comp.pFF77 & 7) ) //< Undocumented Sinclair Textmode VideoMode
{
// rend_atm7_small(dst, pitch);
return;
}
if (temp.oy > temp.scy && conf.fast_sl)
pitch *= 2;
rend_atm_frame_small(dst, pitch);
for (int y=0; y<200; y++)
{
const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
switch (Scanline.VideoMode)
{
case 0: //< EGA 320x200
rend_atm0_small(dst, pitch, y, Scanline.Offset);
break;
/* 640x200
case 2: // Hardware Multicolor
rend_atm2(dst, pitch, y, Scanline.Offset);
break;
case 6: //< Textmode
rend_atm6(dst, pitch, y, Scanline.Offset);
break;
*/
}
}
}
// atm2, atm3 dbl
void rend_atm_2(unsigned char *dst, unsigned pitch)
{
if (temp.comp_pal_changed) {
pixel_tables();
temp.comp_pal_changed = 0;
}
if ( 3 == (comp.pFF77 & 7) ) //< Sinclair VideoMode
{
rend_dbl(dst, pitch);
return;
}
if ( 7 == (comp.pFF77 & 7) ) //< Undocumented Sinclair Textmode VideoMode
{
rend_atm7(dst, pitch);
return;
}
if (temp.oy > temp.scy && conf.fast_sl)
pitch *= 2;
rend_atm_frame(dst, pitch);
for (int y=0; y<200; y++)
{
const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
switch (Scanline.VideoMode)
{
case 0: //< EGA 320x200
rend_atm0(dst, pitch, y, Scanline.Offset);
break;
case 2: // Hardware Multicolor
rend_atm2(dst, pitch, y, Scanline.Offset);
break;
case 6: //< Textmode
rend_atm6(dst, pitch, y, Scanline.Offset);
break;
}
}
}
// atm1 small
void rend_atm_1_small(unsigned char *dst, unsigned pitch)
{
if (temp.comp_pal_changed) {
pixel_tables();
temp.comp_pal_changed = 0;
}
int VideoMode = (comp.aFE >> 5) & 3;
if ( 3 == VideoMode ) //< Sinclair VideoMode
{
rend_small(dst, pitch);
return;
}
if (temp.oy > temp.scy && conf.fast_sl)
pitch *= 2;
rend_atm_frame_small(dst, pitch);
for (int y=0; y<200; y++)
{
const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
switch (Scanline.VideoMode)
{
case 0: //< EGA 320x200
rend_atm0_small(dst, pitch, y, Scanline.Offset);
break;
/*
case 1: // Hardware Multicolor
rend_atm2(dst, pitch, y, Scanline.Offset);
break;
*/
}
}
}
// atm1 dbl
void rend_atm_1(unsigned char *dst, unsigned pitch)
{
if (temp.comp_pal_changed) {
pixel_tables();
temp.comp_pal_changed = 0;
}
int VideoMode = (comp.aFE >> 5) & 3;
if ( 3 == VideoMode ) //< Sinclair VideoMode
{
rend_dbl(dst, pitch);
return;
}
if (temp.oy > temp.scy && conf.fast_sl)
pitch *= 2;
rend_atm_frame(dst, pitch);
for (int y=0; y<200; y++)
{
const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
switch (Scanline.VideoMode)
{
case 0: //< EGA 320x200
rend_atm0(dst, pitch, y, Scanline.Offset);
break;
case 1: // Hardware Multicolor
rend_atm2(dst, pitch, y, Scanline.Offset);
break;
}
}
}