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_atm4.h" |
||
8 | #include "fontatm2.h" |
||
9 | |||
10 | // vga like textmode (80x25) |
||
11 | |||
12 | static const int text0_ofs = 4*PAGE + 0x0; |
||
13 | static const int text2_ofs = 4*PAGE + 0x800; |
||
14 | |||
15 | void line_atm4_8(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font) |
||
16 | { |
||
17 | for (unsigned x = 0; x < 640; x += 0x20) |
||
18 | { |
||
19 | unsigned p0 = *(unsigned*)(src + text0_ofs), |
||
20 | a0 = *(unsigned*)(src + text2_ofs); |
||
21 | unsigned c, *tab; |
||
22 | tab = tab0 + ((a0 << 4) & 0xFF0), c = font[p0 & 0xFF]; |
||
23 | *(unsigned*)(dst+x+0x00) = tab[((c >> 4) & 0xF)]; |
||
24 | *(unsigned*)(dst+x+0x04) = tab[c & 0xF]; |
||
25 | |||
26 | tab = tab0 + ((a0 >> 4) & 0xFF0); c = font[(p0 >> 8) & 0xFF]; |
||
27 | *(unsigned*)(dst+x+0x08) = tab[((c >> 4) & 0xF)]; |
||
28 | *(unsigned*)(dst+x+0x0C) = tab[c & 0xF]; |
||
29 | |||
30 | tab = tab0 + ((a0 >> 12) & 0xFF0); c = font[(p0 >> 16) & 0xFF]; |
||
31 | *(unsigned*)(dst+x+0x10) = tab[((c >> 4) & 0xF)]; |
||
32 | *(unsigned*)(dst+x+0x14) = tab[c & 0xF]; |
||
33 | |||
34 | tab = tab0 + ((a0 >> 20) & 0xFF0); c = font[p0 >> 24]; |
||
35 | *(unsigned*)(dst+x+0x18) = tab[((c >> 4) & 0xF)]; |
||
36 | *(unsigned*)(dst+x+0x1C) = tab[c & 0xF]; |
||
37 | |||
38 | src += 4; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | void line_atm4_16(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font) |
||
43 | { |
||
44 | for (unsigned x = 0; x < 640*2; x += 0x40) |
||
45 | { |
||
46 | unsigned p0 = *(unsigned*)(src + text0_ofs), |
||
47 | a0 = *(unsigned*)(src + text2_ofs); |
||
48 | unsigned c, *tab; |
||
49 | tab = tab0 + ((a0 << 2) & 0x3FC), c = font[p0 & 0xFF]; |
||
50 | *(unsigned*)(dst+x+0x00) = tab[((c >> 6) & 0x03)]; |
||
51 | *(unsigned*)(dst+x+0x04) = tab[((c >> 4) & 0x03)]; |
||
52 | *(unsigned*)(dst+x+0x08) = tab[((c >> 2) & 0x03)]; |
||
53 | *(unsigned*)(dst+x+0x0C) = tab[((c >> 0) & 0x03)]; |
||
54 | |||
55 | tab = tab0 + ((a0 >> 6) & 0x3FC); c = font[(p0 >> 8) & 0xFF]; |
||
56 | *(unsigned*)(dst+x+0x10) = tab[((c >> 6) & 0x03)]; |
||
57 | *(unsigned*)(dst+x+0x14) = tab[((c >> 4) & 0x03)]; |
||
58 | *(unsigned*)(dst+x+0x18) = tab[((c >> 2) & 0x03)]; |
||
59 | *(unsigned*)(dst+x+0x1C) = tab[((c >> 0) & 0x03)]; |
||
60 | |||
61 | tab = tab0 + ((a0 >> 14) & 0x3FC); c = font[(p0 >> 16) & 0xFF]; |
||
62 | *(unsigned*)(dst+x+0x20) = tab[((c >> 6) & 0x03)]; |
||
63 | *(unsigned*)(dst+x+0x24) = tab[((c >> 4) & 0x03)]; |
||
64 | *(unsigned*)(dst+x+0x28) = tab[((c >> 2) & 0x03)]; |
||
65 | *(unsigned*)(dst+x+0x2C) = tab[((c >> 0) & 0x03)]; |
||
66 | |||
67 | tab = tab0 + ((a0 >> 22) & 0x3FC); c = font[p0 >> 24]; |
||
68 | *(unsigned*)(dst+x+0x30) = tab[((c >> 6) & 0x03)]; |
||
69 | *(unsigned*)(dst+x+0x34) = tab[((c >> 4) & 0x03)]; |
||
70 | *(unsigned*)(dst+x+0x38) = tab[((c >> 2) & 0x03)]; |
||
71 | *(unsigned*)(dst+x+0x3C) = tab[((c >> 0) & 0x03)]; |
||
72 | |||
73 | src += 4; |
||
74 | } |
||
75 | } |
||
76 | |||
77 | void line_atm4_32(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font) |
||
78 | { |
||
79 | for (unsigned x = 0; x < 640*4; x += 0x40) |
||
80 | { |
||
81 | unsigned c, *tab; |
||
82 | tab = tab0 + src[text2_ofs]; c = font[src[text0_ofs]]; |
||
83 | *(unsigned*)(dst+x+0x00) = tab[((c << 1) & 0x100)]; |
||
84 | *(unsigned*)(dst+x+0x04) = tab[((c << 2) & 0x100)]; |
||
85 | *(unsigned*)(dst+x+0x08) = tab[((c << 3) & 0x100)]; |
||
86 | *(unsigned*)(dst+x+0x0C) = tab[((c << 4) & 0x100)]; |
||
87 | *(unsigned*)(dst+x+0x10) = tab[((c << 5) & 0x100)]; |
||
88 | *(unsigned*)(dst+x+0x14) = tab[((c << 6) & 0x100)]; |
||
89 | *(unsigned*)(dst+x+0x18) = tab[((c << 7) & 0x100)]; |
||
90 | *(unsigned*)(dst+x+0x1C) = tab[((c << 8) & 0x100)]; |
||
91 | |||
92 | tab = tab0 + src[text2_ofs + 1]; c = font[src[text0_ofs + 1]]; |
||
93 | *(unsigned*)(dst+x+0x20) = tab[((c << 1) & 0x100)]; |
||
94 | *(unsigned*)(dst+x+0x24) = tab[((c << 2) & 0x100)]; |
||
95 | *(unsigned*)(dst+x+0x28) = tab[((c << 3) & 0x100)]; |
||
96 | *(unsigned*)(dst+x+0x2C) = tab[((c << 4) & 0x100)]; |
||
97 | *(unsigned*)(dst+x+0x30) = tab[((c << 5) & 0x100)]; |
||
98 | *(unsigned*)(dst+x+0x34) = tab[((c << 6) & 0x100)]; |
||
99 | *(unsigned*)(dst+x+0x38) = tab[((c << 7) & 0x100)]; |
||
100 | *(unsigned*)(dst+x+0x3C) = tab[((c << 8) & 0x100)]; |
||
101 | |||
102 | src += 2; |
||
103 | } |
||
104 | } |
||
105 | |||
106 | // Textmode |
||
107 | void rend_atm4(unsigned char *dst, unsigned pitch, int y) |
||
108 | { |
||
109 | unsigned char *dst2 = dst + (temp.ox-640)*temp.obpp/16; |
||
110 | if (temp.scy > 200) |
||
111 | dst2 += (temp.scy-200)/2*pitch * ((temp.oy > temp.scy)?2:1); |
||
112 | |||
113 | int v = y%8; |
||
114 | int l = y/8; |
||
115 | if (conf.fast_sl) |
||
116 | { |
||
117 | dst2 += y*pitch; |
||
118 | switch(temp.obpp) |
||
119 | { |
||
120 | case 8: |
||
121 | line_atm4_8 (dst2, temp.base + l*80, t.zctab8 [0], fontatm2 + v*0x100); |
||
122 | break; |
||
123 | case 16: |
||
124 | line_atm4_16(dst2, temp.base + l*80, t.zctab16[0], fontatm2 + v*0x100); |
||
125 | break; |
||
126 | case 32: |
||
127 | line_atm4_32(dst2, temp.base + l*80, t.zctab32[0], fontatm2 + v*0x100); |
||
128 | break; |
||
129 | } |
||
130 | } |
||
131 | else |
||
132 | { |
||
133 | dst2 += 2*y*pitch; |
||
134 | switch(temp.obpp) |
||
135 | { |
||
136 | case 8: |
||
137 | line_atm4_8 (dst2, temp.base + l*80, t.zctab8 [0], fontatm2 + v*0x100); |
||
138 | dst2 += pitch; |
||
139 | line_atm4_8 (dst2, temp.base + l*80, t.zctab8 [1], fontatm2 + v*0x100); |
||
140 | break; |
||
141 | case 16: |
||
142 | line_atm4_16(dst2, temp.base + l*80, t.zctab16[0], fontatm2 + v*0x100); |
||
143 | dst2 += pitch; |
||
144 | line_atm4_16(dst2, temp.base + l*80, t.zctab16[1], fontatm2 + v*0x100); |
||
145 | break; |
||
146 | case 32: |
||
147 | line_atm4_32(dst2, temp.base + l*80, t.zctab32[0], fontatm2 + v*0x100); |
||
148 | dst2 += pitch; |
||
149 | line_atm4_32(dst2, temp.base + l*80, t.zctab32[1], fontatm2 + v*0x100); |
||
150 | break; |
||
151 | } |
||
152 | } |
||
153 | } |