Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
716 lvd 1
#include "std.h"
2
 
3
#include "emul.h"
4
#include "vars.h"
5
#include "draw.h"
6
#include "dxrend.h"
7
#include "dxr_atm0.h"
8
#include "dxr_atm2.h"
9
#include "dxr_atm4.h"
10
#include "dxr_atm6.h"
11
#include "dxr_atm7.h"
12
#include "dxr_atmf.h"
13
 
14
typedef void (*TAtmRendFunc)(unsigned char *dst, unsigned pitch);
15
 
16
static void rend_atm_frame_small(unsigned char *dst, unsigned pitch)
17
{
18
     static const TAtmRendFunc AtmRendFunc[] =
19
     { rend_atmframe8, rend_atmframe16, 0, rend_atmframe32 };
20
 
21
     AtmRendFunc[temp.obpp/8-1](dst, pitch);
22
}
23
 
24
static void rend_atm_frame(unsigned char *dst, unsigned pitch)
25
{
26
    if (conf.fast_sl) {
27
        switch(temp.obpp)
28
        {
29
        case 8:
30
            rend_atmframe_8d1(dst, pitch);
31
            break;
32
        case 16:
33
            rend_atmframe_16d1(dst, pitch);
34
            break;
35
        case 32:
36
            rend_atmframe_32d1(dst, pitch);
37
            break;
38
        }
39
    } else {
40
        switch(temp.obpp)
41
        {
42
        case 8:
43
            rend_atmframe_8d(dst, pitch);
44
            break;
45
        case 16:
46
            rend_atmframe_16d(dst, pitch);
47
            break;
48
        case 32:
49
            rend_atmframe_32d(dst, pitch);
50
            break;
51
        }
52
    }
53
 
54
}
55
 
56
// atm2, atm3
57
void rend_atm_2_small(unsigned char *dst, unsigned pitch)
58
{
59
    if (temp.comp_pal_changed) {
60
        pixel_tables();
61
        temp.comp_pal_changed = 0;
62
    }
63
 
64
    if ( 3 == (comp.pFF77 & 7) ) //< Sinclair VideoMode
65
    {
66
        rend_small(dst, pitch);
67
        return;
68
    }
69
 
70
    if ( 7 == (comp.pFF77 & 7) ) //< Undocumented Sinclair Textmode VideoMode
71
    {
72
//        rend_atm7_small(dst, pitch);
73
        return;
74
    }
75
 
76
    if (temp.oy > temp.scy && conf.fast_sl)
77
        pitch *= 2;
78
    rend_atm_frame_small(dst, pitch);
79
 
80
    for (int y=0; y<200; y++)
81
    {
82
        const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
83
        switch (Scanline.VideoMode)
84
        {
85
        case 0: //< EGA 320x200
86
            rend_atm0_small(dst, pitch, y, Scanline.Offset);
87
            break;
88
/* 640x200
89
        case 2: // Hardware Multicolor
90
            rend_atm2(dst, pitch, y, Scanline.Offset);
91
            break;
92
        case 6: //< Textmode
93
            rend_atm6(dst, pitch, y, Scanline.Offset);
94
            break;
95
*/
96
        }
97
    }
98
}
99
 
100
// atm2, atm3 dbl
101
void rend_atm_2(unsigned char *dst, unsigned pitch)
102
{
103
    if (temp.comp_pal_changed) {
104
        pixel_tables();
105
        temp.comp_pal_changed = 0;
106
    }
107
 
108
    if ( 3 == (comp.pFF77 & 7) ) //< Sinclair VideoMode
109
    {
110
        rend_dbl(dst, pitch);
111
        return;
112
    }
113
 
114
    if ( 7 == (comp.pFF77 & 7) ) //< Undocumented Sinclair Textmode VideoMode
115
    {
116
        rend_atm7(dst, pitch);
117
        return;
118
    }
119
 
120
    if (temp.oy > temp.scy && conf.fast_sl)
121
        pitch *= 2;
122
    rend_atm_frame(dst, pitch);
123
 
124
    for (int y=0; y<200; y++)
125
    {
126
        const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
127
        switch (Scanline.VideoMode)
128
        {
129
        case 0: //< EGA 320x200
130
            rend_atm0(dst, pitch, y, Scanline.Offset);
131
            break;
132
        case 2: // Hardware Multicolor
133
            rend_atm2(dst, pitch, y, Scanline.Offset);
134
            break;
135
        case 4: // Textmode (vga like)
136
            if(conf.mem_model == MM_ATM3)
137
                rend_atm4(dst, pitch, y);
138
            break;
139
        case 6: //< Textmode
140
            rend_atm6(dst, pitch, y, Scanline.Offset);
141
            break;
142
        }
143
    }
144
}
145
 
146
// atm1 small
147
void rend_atm_1_small(unsigned char *dst, unsigned pitch)
148
{
149
   if (temp.comp_pal_changed) {
150
      pixel_tables();
151
      temp.comp_pal_changed = 0;
152
   }
153
 
154
   int VideoMode = (comp.aFE >> 5) & 3;
155
   if ( 3 == VideoMode ) //< Sinclair VideoMode
156
   {
157
       rend_small(dst, pitch);
158
       return;
159
   }
160
 
161
   if (temp.oy > temp.scy && conf.fast_sl)
162
       pitch *= 2;
163
   rend_atm_frame_small(dst, pitch);
164
 
165
   for (int y=0; y<200; y++)
166
   {
167
       const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
168
       switch (Scanline.VideoMode)
169
       {
170
       case 0: //< EGA 320x200
171
           rend_atm0_small(dst, pitch, y, Scanline.Offset);
172
           break;
173
/*
174
       case 1: // Hardware Multicolor
175
           rend_atm2(dst, pitch, y, Scanline.Offset);
176
           break;
177
*/
178
       }
179
   }
180
}
181
 
182
// atm1 dbl
183
void rend_atm_1(unsigned char *dst, unsigned pitch)
184
{
185
   if (temp.comp_pal_changed) {
186
      pixel_tables();
187
      temp.comp_pal_changed = 0;
188
   }
189
 
190
   int VideoMode = (comp.aFE >> 5) & 3;
191
   if ( 3 == VideoMode ) //< Sinclair VideoMode
192
   {
193
       rend_dbl(dst, pitch);
194
       return;
195
   }
196
 
197
   if (temp.oy > temp.scy && conf.fast_sl)
198
       pitch *= 2;
199
   rend_atm_frame(dst, pitch);
200
 
201
   for (int y=0; y<200; y++)
202
   {
203
       const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
204
       switch (Scanline.VideoMode)
205
       {
206
       case 0: //< EGA 320x200
207
           rend_atm0(dst, pitch, y, Scanline.Offset);
208
           break;
209
       case 1: // Hardware Multicolor
210
           rend_atm2(dst, pitch, y, Scanline.Offset);
211
           break;
212
       }
213
   }
214
}