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 "dxr_atmf.h" |
||
7 | #include "dxr_atm0.h" |
||
8 | |||
9 | static const int ega0_ofs = -4*int(PAGE); |
||
10 | static const int ega1_ofs = 0; |
||
11 | static const int ega2_ofs = -4*int(PAGE)+0x2000; |
||
12 | static const int ega3_ofs = 0x2000; |
||
13 | |||
14 | static void line_atm0_8(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
15 | { |
||
16 | u8 *d = (u8 *)dst; |
||
17 | for (unsigned x = 0; x < 320; x += 8, ++src_offset) |
||
18 | { |
||
19 | src_offset &= 0x1FFF; |
||
20 | d[x+0] = tab[src[ega0_ofs + src_offset]]; |
||
21 | d[x+1] = tab[src[ega0_ofs + src_offset]] >> 16; |
||
22 | d[x+2] = tab[src[ega1_ofs + src_offset]]; |
||
23 | d[x+3] = tab[src[ega1_ofs + src_offset]] >> 16; |
||
24 | d[x+4] = tab[src[ega2_ofs + src_offset]]; |
||
25 | d[x+5] = tab[src[ega2_ofs + src_offset]] >> 16; |
||
26 | d[x+6] = tab[src[ega3_ofs + src_offset]]; |
||
27 | d[x+7] = tab[src[ega3_ofs + src_offset]] >> 16; |
||
28 | } |
||
29 | } |
||
30 | |||
31 | static void line_atm0_8d(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
32 | { |
||
33 | u32 *d = (u32 *)dst; |
||
34 | for (unsigned x = 0; x < 640/4; x += 4, ++src_offset) |
||
35 | { |
||
36 | src_offset &= 0x1FFF; |
||
37 | d[x+0] = tab[src[ega0_ofs + src_offset]]; |
||
38 | d[x+1] = tab[src[ega1_ofs + src_offset]]; |
||
39 | d[x+2] = tab[src[ega2_ofs + src_offset]]; |
||
40 | d[x+3] = tab[src[ega3_ofs + src_offset]]; |
||
41 | } |
||
42 | } |
||
43 | |||
44 | static void line_atm0_16(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
45 | { |
||
46 | u16 *d = (u16 *)dst; |
||
47 | for (unsigned x = 0; x < 320; x += 8, ++src_offset) |
||
48 | { |
||
49 | src_offset &= 0x1FFF; |
||
50 | d[x+0] = tab[0+2*src[ega0_ofs + src_offset]]; |
||
51 | d[x+1] = tab[1+2*src[ega0_ofs + src_offset]]; |
||
52 | d[x+2] = tab[0+2*src[ega1_ofs + src_offset]]; |
||
53 | d[x+3] = tab[1+2*src[ega1_ofs + src_offset]]; |
||
54 | d[x+4] = tab[0+2*src[ega2_ofs + src_offset]]; |
||
55 | d[x+5] = tab[1+2*src[ega2_ofs + src_offset]]; |
||
56 | d[x+6] = tab[0+2*src[ega3_ofs + src_offset]]; |
||
57 | d[x+7] = tab[1+2*src[ega3_ofs + src_offset]]; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | static void line_atm0_16d(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
62 | { |
||
63 | u32 *d = (u32 *)dst; |
||
64 | for (unsigned x = 0; x < 640/2; x += 8, ++src_offset) |
||
65 | { |
||
66 | src_offset &= 0x1FFF; |
||
67 | d[x+0] = tab[0+2*src[ega0_ofs + src_offset]]; |
||
68 | d[x+1] = tab[1+2*src[ega0_ofs + src_offset]]; |
||
69 | d[x+2] = tab[0+2*src[ega1_ofs + src_offset]]; |
||
70 | d[x+3] = tab[1+2*src[ega1_ofs + src_offset]]; |
||
71 | d[x+4] = tab[0+2*src[ega2_ofs + src_offset]]; |
||
72 | d[x+5] = tab[1+2*src[ega2_ofs + src_offset]]; |
||
73 | d[x+6] = tab[0+2*src[ega3_ofs + src_offset]]; |
||
74 | d[x+7] = tab[1+2*src[ega3_ofs + src_offset]]; |
||
75 | } |
||
76 | } |
||
77 | |||
78 | static void line_atm0_32(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
79 | { |
||
80 | u32 *d = (u32 *)dst; |
||
81 | for (unsigned x = 0; x < 320; x += 8, ++src_offset) |
||
82 | { |
||
83 | src_offset &= 0x1FFF; |
||
84 | d[x+0] = tab[0+2*src[ega0_ofs + src_offset]]; |
||
85 | d[x+1] = tab[1+2*src[ega0_ofs + src_offset]]; |
||
86 | d[x+2] = tab[0+2*src[ega1_ofs + src_offset]]; |
||
87 | d[x+3] = tab[1+2*src[ega1_ofs + src_offset]]; |
||
88 | d[x+4] = tab[0+2*src[ega2_ofs + src_offset]]; |
||
89 | d[x+5] = tab[1+2*src[ega2_ofs + src_offset]]; |
||
90 | d[x+6] = tab[0+2*src[ega3_ofs + src_offset]]; |
||
91 | d[x+7] = tab[1+2*src[ega3_ofs + src_offset]]; |
||
92 | } |
||
93 | } |
||
94 | |||
95 | static void line_atm0_32d(unsigned char *dst, unsigned char *src, unsigned *tab, int src_offset) |
||
96 | { |
||
97 | u32 *d = (u32 *)dst; |
||
98 | for (unsigned x = 0; x < 640; x += 16, ++src_offset) |
||
99 | { |
||
100 | src_offset &= 0x1FFF; |
||
101 | d[x+0] = d[x+1] = tab[0+2*src[ega0_ofs + src_offset]]; |
||
102 | d[x+2] = d[x+3] = tab[1+2*src[ega0_ofs + src_offset]]; |
||
103 | d[x+4] = d[x+5] = tab[0+2*src[ega1_ofs + src_offset]]; |
||
104 | d[x+6] = d[x+7] = tab[1+2*src[ega1_ofs + src_offset]]; |
||
105 | d[x+8] = d[x+9] = tab[0+2*src[ega2_ofs + src_offset]]; |
||
106 | d[x+10] = d[x+11] = tab[1+2*src[ega2_ofs + src_offset]]; |
||
107 | d[x+12] = d[x+13] = tab[0+2*src[ega3_ofs + src_offset]]; |
||
108 | d[x+14] = d[x+15] = tab[1+2*src[ega3_ofs + src_offset]]; |
||
109 | } |
||
110 | } |
||
111 | |||
112 | void rend_atm0_small(unsigned char *dst, unsigned pitch, int y, int Offset) |
||
113 | { |
||
114 | unsigned char *dst2 = dst + (temp.ox-320)*temp.obpp/16; |
||
115 | if (temp.scy > 200) |
||
116 | dst2 += (temp.scy-200)/2*pitch * ((temp.oy > temp.scy)?2:1); |
||
117 | |||
118 | dst2 += y*pitch; |
||
119 | switch(temp.obpp) |
||
120 | { |
||
121 | case 8: |
||
122 | line_atm0_8(dst2, temp.base, t.p4bpp8[0], Offset); |
||
123 | dst2 += pitch; |
||
124 | break; |
||
125 | case 16: |
||
126 | line_atm0_16(dst2, temp.base, t.p4bpp16[0], Offset); |
||
127 | dst2 += pitch; |
||
128 | break; |
||
129 | case 32: |
||
130 | line_atm0_32(dst2, temp.base, t.p4bpp32[0], Offset); |
||
131 | dst2 += pitch; |
||
132 | break; |
||
133 | } |
||
134 | } |
||
135 | |||
136 | // EGA 320x200, double |
||
137 | void rend_atm0(unsigned char *dst, unsigned pitch, int y, int Offset) |
||
138 | { |
||
139 | unsigned char *dst2 = dst + (temp.ox-640)*temp.obpp/16; |
||
140 | if (temp.scy > 200) |
||
141 | dst2 += (temp.scy-200)/2*pitch * ((temp.oy > temp.scy)?2:1); |
||
142 | |||
143 | if(conf.fast_sl) |
||
144 | { |
||
145 | dst2 += y*pitch; |
||
146 | switch(temp.obpp) |
||
147 | { |
||
148 | case 8: |
||
149 | line_atm0_8d(dst2, temp.base, t.p4bpp8[0], Offset); |
||
150 | break; |
||
151 | case 16: |
||
152 | line_atm0_16d(dst2, temp.base, t.p4bpp16[0], Offset); |
||
153 | break; |
||
154 | case 32: |
||
155 | line_atm0_32d(dst2, temp.base, t.p4bpp32[0], Offset); |
||
156 | break; |
||
157 | } |
||
158 | } |
||
159 | else |
||
160 | { |
||
161 | dst2 += 2*y*pitch; |
||
162 | switch(temp.obpp) |
||
163 | { |
||
164 | case 8: |
||
165 | line_atm0_8d(dst2, temp.base, t.p4bpp8[0], Offset); |
||
166 | dst2 += pitch; |
||
167 | line_atm0_8d(dst2, temp.base, t.p4bpp8[1], Offset); |
||
168 | break; |
||
169 | case 16: |
||
170 | line_atm0_16d(dst2, temp.base, t.p4bpp16[0], Offset); |
||
171 | dst2 += pitch; |
||
172 | line_atm0_16d(dst2, temp.base, t.p4bpp16[1], Offset); |
||
173 | break; |
||
174 | case 32: |
||
175 | line_atm0_32d(dst2, temp.base, t.p4bpp32[0], Offset); |
||
176 | dst2 += pitch; |
||
177 | line_atm0_32d(dst2, temp.base, t.p4bpp32[1], Offset); |
||
178 | break; |
||
179 | } |
||
180 | } |
||
181 | } |