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 "dxrframe.h"
7
#include "dxr_atmf.h"
8
#include "dxr_atm7.h"
9
#include "fontatm2.h"
10
 
11
const int text_ofs = 0x1840;
12
 
13
void line_atm7_8(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font)
14
{
15
   unsigned i = 0;
16
   for (unsigned x = 0; x < 512; x += 0x10) {
17
      unsigned chr = src[(i+1) & 0x1F]; i++;
18
      unsigned *tab = tab0 + (chr << 2);
19
      chr = font[chr];
20
      *(unsigned*)(dst+x+0x00) = tab[(chr >> 6) & 0x03];
21
      *(unsigned*)(dst+x+0x04) = tab[(chr >> 4) & 0x03];
22
      *(unsigned*)(dst+x+0x08) = tab[(chr >> 2) & 0x03];
23
      *(unsigned*)(dst+x+0x0C) = tab[chr & 0x03];
24
   }
25
}
26
 
27
void line_atm7_16(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font)
28
{
29
   unsigned i = 0;
30
   for (unsigned x = 0; x < 512*2; x += 0x20) {
31
      unsigned chr = src[(i+1) & 0x1F]; i++;
32
      unsigned *tab = tab0+chr;
33
      chr = font[chr];
34
      *(unsigned*)(dst+x+0x00) = tab[((chr << 1) & 0x100)];
35
      *(unsigned*)(dst+x+0x04) = tab[((chr << 2) & 0x100)];
36
      *(unsigned*)(dst+x+0x08) = tab[((chr << 3) & 0x100)];
37
      *(unsigned*)(dst+x+0x0C) = tab[((chr << 4) & 0x100)];
38
      *(unsigned*)(dst+x+0x10) = tab[((chr << 5) & 0x100)];
39
      *(unsigned*)(dst+x+0x14) = tab[((chr << 6) & 0x100)];
40
      *(unsigned*)(dst+x+0x18) = tab[((chr << 7) & 0x100)];
41
      *(unsigned*)(dst+x+0x1C) = tab[((chr << 8) & 0x100)];
42
   }
43
}
44
 
45
void line_atm7_32(unsigned char *dst, unsigned char *src, unsigned *tab0, unsigned char *font)
46
{
47
   unsigned i = 0;
48
   for (unsigned x = 0; x < 512*4; x += 0x40) {
49
      unsigned chr = src[(i+1) & 0x1F]; i++;
50
      unsigned *tab = tab0+chr;
51
      chr = font[chr];
52
      *(unsigned*)(dst+x+0x00) = *(unsigned*)(dst+x+0x04) = tab[((chr << 1) & 0x100)];
53
      *(unsigned*)(dst+x+0x08) = *(unsigned*)(dst+x+0x0C) = tab[((chr << 2) & 0x100)];
54
      *(unsigned*)(dst+x+0x10) = *(unsigned*)(dst+x+0x14) = tab[((chr << 3) & 0x100)];
55
      *(unsigned*)(dst+x+0x18) = *(unsigned*)(dst+x+0x1C) = tab[((chr << 4) & 0x100)];
56
      *(unsigned*)(dst+x+0x20) = *(unsigned*)(dst+x+0x24) = tab[((chr << 5) & 0x100)];
57
      *(unsigned*)(dst+x+0x28) = *(unsigned*)(dst+x+0x2C) = tab[((chr << 6) & 0x100)];
58
      *(unsigned*)(dst+x+0x30) = *(unsigned*)(dst+x+0x34) = tab[((chr << 7) & 0x100)];
59
      *(unsigned*)(dst+x+0x38) = *(unsigned*)(dst+x+0x3C) = tab[((chr << 8) & 0x100)];
60
   }
61
}
62
 
63
void r_atm7_8s(unsigned char *dst, unsigned pitch)
64
{
65
   for (unsigned y = 0; y < 192; y += 32)
66
      for (unsigned s = 0; s < 4; s++)
67
         for (unsigned v = 0; v < 8; v++) {
68
            line_atm7_8(dst, temp.base + text_ofs + y, t.zctab8ad[0], fontatm2 + v*0x100); dst += pitch;
69
         }
70
}
71
 
72
void r_atm7_8d(unsigned char *dst, unsigned pitch)
73
{
74
   for (unsigned y = 0; y < 192; y += 32)
75
      for (unsigned s = 0; s < 4; s++)
76
         for (unsigned v = 0; v < 8; v++) {
77
            line_atm7_8(dst, temp.base + text_ofs + y, t.zctab8ad[0], fontatm2 + v*0x100); dst += pitch;
78
            line_atm7_8(dst, temp.base + text_ofs + y, t.zctab8ad[1], fontatm2 + v*0x100); dst += pitch;
79
         }
80
}
81
 
82
void r_atm7_16s(unsigned char *dst, unsigned pitch)
83
{
84
   for (unsigned y = 0; y < 192; y += 32)
85
      for (unsigned s = 0; s < 4; s++)
86
         for (unsigned v = 0; v < 8; v++) {
87
            line_atm7_16(dst, temp.base + text_ofs + y, t.zctab16ad[0], fontatm2 + v*0x100); dst += pitch;
88
         }
89
}
90
 
91
void r_atm7_16d(unsigned char *dst, unsigned pitch)
92
{
93
   for (unsigned y = 0; y < 192; y += 32)
94
      for (unsigned s = 0; s < 4; s++)
95
         for (unsigned v = 0; v < 8; v++) {
96
            line_atm7_16(dst, temp.base + text_ofs + y, t.zctab16ad[0], fontatm2 + v*0x100); dst += pitch;
97
            line_atm7_16(dst, temp.base + text_ofs + y, t.zctab16ad[1], fontatm2 + v*0x100); dst += pitch;
98
         }
99
}
100
 
101
void r_atm7_32s(unsigned char *dst, unsigned pitch)
102
{
103
   for (unsigned y = 0; y < 192; y += 32)
104
      for (unsigned s = 0; s < 4; s++)
105
         for (unsigned v = 0; v < 8; v++) {
106
            line_atm7_32(dst, temp.base + text_ofs + y, t.zctab32ad[0], fontatm2 + v*0x100); dst += pitch;
107
         }
108
}
109
 
110
void r_atm7_32d(unsigned char *dst, unsigned pitch)
111
{
112
   for (unsigned y = 0; y < 192; y += 32)
113
      for (unsigned s = 0; s < 4; s++)
114
         for (unsigned v = 0; v < 8; v++) {
115
            line_atm7_32(dst, temp.base + text_ofs + y, t.zctab32ad[0], fontatm2 + v*0x100); dst += pitch;
116
            line_atm7_32(dst, temp.base + text_ofs + y, t.zctab32ad[1], fontatm2 + v*0x100); dst += pitch;
117
         }
118
}
119
 
120
void rend_atm7(unsigned char *dst, unsigned pitch)
121
{
122
   unsigned char *dst2 = dst + (temp.ox-512)*temp.obpp/16;
123
   if (temp.scy > 200) dst2 += (temp.scy-192)/2*pitch * ((temp.oy > temp.scy)?2:1);
124
   if (temp.oy > temp.scy && conf.fast_sl) pitch *= 2;
125
 
126
   if (temp.obpp == 8)  { if (conf.fast_sl) rend_frame_8d1(dst, pitch), r_atm7_8s (dst2, pitch); else rend_frame_8d (dst, pitch), r_atm7_8d (dst2, pitch); return; }
127
   if (temp.obpp == 16) { if (conf.fast_sl) rend_frame_16d1(dst, pitch), r_atm7_16s(dst2, pitch); else rend_frame_16d(dst, pitch), r_atm7_16d(dst2, pitch); return; }
128
   if (temp.obpp == 32) { if (conf.fast_sl) rend_frame_32d1(dst, pitch), r_atm7_32s(dst2, pitch); else rend_frame_32d(dst, pitch), r_atm7_32d(dst2, pitch); return; }
129
}