Rev 883 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
716 | lvd | 1 | #pragma once |
2 | |||
3 | #define MAX_WIDTH 512 |
||
4 | #define MAX_WIDTH_P (((MAX_WIDTH)*2)/8) // ������������ ��������� � pc-���������� � ����� ������ |
||
5 | #define MAX_HEIGHT 304 |
||
6 | #define MAX_BUFFERS 8 |
||
7 | |||
8 | #define MAX_FONT_TABLES 0x62000 |
||
9 | static const int sc2lines_width = MAX_WIDTH*2; |
||
10 | |||
11 | CACHE_ALIGNED struct T |
||
12 | { |
||
13 | struct { // switch palette/color values |
||
14 | // 8bit |
||
15 | unsigned sctab8[2][16*0x100]; //4 bits data+pc-attribute -> 4 palette pixels |
||
16 | unsigned sctab8d[2][4*0x100]; //2 bits data+pc-attribute -> 2 palette pixels (doubled) |
||
17 | unsigned sctab8q[2*0x100]; //1 bit data+pc-attribute -> 1 palette pixel (quad) |
||
18 | // 16bit & 32bit |
||
19 | unsigned sctab16[2][4*0x100]; //2 bits data+pc-attribute -> 2 pixels |
||
20 | unsigned sctab16d[2][2*0x100]; //1 bit data+pc-attribute -> 1 pixel (doubled) |
||
784 | DimkaM | 21 | unsigned sctab32[2][2*0x100]; //1 bit data+pc-attribute -> 1 pixel (sctab32[0] = {pix_off=paper[0..0xFF], pix_on=ink[0x100..0x1FF]}) |
716 | lvd | 22 | }; |
23 | |||
24 | union { // switch chunks/noflic |
||
25 | unsigned c32tab[0x100][32]; // for chunks 16/32: n_pixels+attr -> chunk color |
||
26 | struct { |
||
27 | unsigned sctab16_nf[2][4*0x100]; //2 bits data+pc-attribute -> 2 pixels |
||
28 | unsigned sctab16d_nf[2][2*0x100]; //1 bit data+pc-attribute -> 2 pixels |
||
29 | unsigned sctab32_nf[2][2*0x100]; //1 bit data+pc-attribute -> 1 pixel |
||
30 | }; |
||
31 | }; |
||
32 | |||
784 | DimkaM | 33 | unsigned char attrtab[0x200]; // pc attribute + bit (pixel off[0..0xFF]/on[0x100..0x1FF]) -> palette index |
716 | lvd | 34 | |
35 | CACHE_ALIGNED union { |
||
36 | unsigned p4bpp8[2][0x100]; // ATM EGA screen. EGA byte -> raw video data: 2 pixels (doubled) (p2p2p1p1) |
||
37 | unsigned p4bpp16[2][2*0x100];// ATM EGA screen. EGA byte -> raw video data: 2 pixels (doubled) |
||
38 | unsigned p4bpp32[2][2*0x100];// ATM EGA screen. EGA byte -> raw video data: 2 pixels |
||
39 | }; |
||
40 | CACHE_ALIGNED union { |
||
41 | unsigned p4bpp16_nf[2][2*0x100];// ATM EGA screen. EGA byte -> raw video data: 2 pixels (doubled) |
||
42 | unsigned p4bpp32_nf[2][2*0x100];// ATM EGA screen. EGA byte -> raw video data: 2 pixels |
||
43 | }; |
||
44 | CACHE_ALIGNED union { |
||
45 | struct { |
||
46 | unsigned zctab8[2][16*0x100]; // 4 bits data+zx-attribute -> 4 palette pixels |
||
47 | unsigned zctab8ad[2][4*0x100]; // 2 bits data+zx-attribute -> 2 palette pixels (doubled) |
||
48 | }; |
||
49 | struct { |
||
784 | DimkaM | 50 | unsigned zctab16[2][4*0x100]; // 2 bits data+zx-attribute -> 2 pixels |
51 | unsigned zctab16ad[2][2*0x100];// 1 bits data+zx-attribute -> 1 pixel (doubled) |
||
716 | lvd | 52 | }; |
53 | struct { |
||
784 | DimkaM | 54 | unsigned zctab32[2][2*0x100]; // 1 bit data+zx-attribute -> 1 pixel |
55 | unsigned zctab32ad[2][2*0x100];// 1 bit data+zx-attribute -> 1 pixel |
||
716 | lvd | 56 | }; |
57 | }; |
||
58 | |||
59 | union { |
||
60 | struct { // 8bpp |
||
61 | CACHE_ALIGNED unsigned char scale2buf[8][sc2lines_width]; // temp buffer for scale2x,3x filter |
||
62 | CACHE_ALIGNED unsigned char scale4buf[8][sc2lines_width]; // temp buffer for scale4x filter |
||
63 | }; |
||
64 | struct // 32 bpp |
||
65 | { |
||
66 | CACHE_ALIGNED u32 scale2buf32[8][sc2lines_width]; // temp buffer for scale2x,3x filter |
||
67 | CACHE_ALIGNED u32 scale4buf32[8][sc2lines_width]; // temp buffer for scale4x filter |
||
68 | }; |
||
69 | unsigned bs2h[96][129]; // temp buffer for chunks 2x2 flt |
||
70 | unsigned bs4h[48][65]; // temp buffer for chunks 4x4 flt |
||
71 | void* font_tables[MAX_FONT_TABLES / sizeof(void*)]; // for anti-text64 |
||
72 | }; |
||
73 | // pre-calculated |
||
74 | unsigned settab[0x100]; // for chunks 4x4 |
||
75 | unsigned settab2[0x100]; // for chunks 2x2 |
||
76 | unsigned dbl[0x100]; // reverse and double pixels (for scaling renderer) |
||
77 | unsigned scrtab[256]; // offset to start of line |
||
78 | unsigned atrtab[256]; // offset to start of attribute line |
||
79 | unsigned atrtab_hwmc[256]; // attribute for HWMC |
||
80 | unsigned atm_pal_map[0x100]; // atm palette port value -> palette index |
||
784 | DimkaM | 81 | unsigned profi_pal_map[0x100]; // profi palette port value -> palette index |
82 | |||
716 | lvd | 83 | struct { // for AlCo-384 |
84 | unsigned char *s, *a; |
||
85 | } alco[304][8]; |
||
86 | |||
87 | #ifdef MOD_VID_VD |
||
88 | __m64 vdtab[2][4][256]; |
||
89 | #endif |
||
90 | |||
91 | }; |
||
92 | |||
93 | struct videopoint |
||
94 | { |
||
95 | unsigned next_t; // ���� ������ ��� ����� ������ |
||
96 | |||
97 | // ������������ ������ ���� ����� - ����� ������ |
||
98 | unsigned char *screen_ptr; |
||
99 | union { |
||
100 | unsigned nextvmode; // for vmode=1, 0 - ������� ������ ������ |
||
101 | unsigned atr_offs; // for vmode=2 |
||
102 | }; |
||
103 | unsigned scr_offs; |
||
104 | }; |
||
105 | |||
106 | struct AtmVideoController |
||
107 | { |
||
108 | struct ScanLine |
||
109 | { |
||
110 | int Offset; // �������� ������ ��� ������������� |
||
111 | int VideoMode; // ���������� ��� ������ ��������� |
||
112 | }; |
||
113 | void PrepareFrameATM2(int VideoMode); |
||
114 | void PrepareFrameATM1(int VideoMode); |
||
115 | |||
116 | ScanLine Scanlines[256]; // ��������� 56 ������������ ��������� � 200 ��������� ��������� |
||
117 | |||
118 | // ���� ���������� ����������� ���������� �� ����������� ��������� ��������� - |
||
119 | // �� ��� ����������� � � ������ � ����������� � ��������������� ���� .offset ���� ���������. |
||
120 | // |
||
121 | // ���� ���������� ����������� ���������� � ������ ��������� ������ ��� ����� �� ��� - |
||
122 | // �� ��� ����������� � ��������� ���������. |
||
123 | // ����� ����� ���� ���������� ����������� ������������ ��������� ��� ����: |
||
124 | int CurrentRayLine; // ����� ������� ���������, �� ������� ���������� ���������� ����������� |
||
125 | int IncCounter_InRaster; // ������� ��� ���������� +64 �����������, ��������� �� ������ |
||
126 | int IncCounter_InBorder; // ������� ��� ���������� +64 �����������, ��������� �� ������� |
||
127 | }; |
||
128 | |||
129 | extern AtmVideoController AtmVideoCtrl; |
||
130 | |||
131 | static const int rb2_offs = MAX_HEIGHT*MAX_WIDTH_P; |
||
132 | static const int sizeof_rbuf = rb2_offs*(MAX_BUFFERS+2); |
||
133 | // ����� � ������� �������� �������� � zx ������� (������� ������), |
||
134 | // �������� �������������� � pc ������ ����� colortab |
||
135 | // �� ����� ������ �������� ����� �������������� � pc ������ (�������� rgb32) ��� ������ �� ����� |
||
784 | DimkaM | 136 | // ������ ������: pix(8bit), attrs(8bit), ... |
137 | // �������� � ������� 8x1 (�� ������ 8x1 ����� 1 �������) |
||
716 | lvd | 138 | #ifdef CACHE_ALIGNED |
139 | extern CACHE_ALIGNED unsigned char rbuf[sizeof_rbuf]; |
||
140 | #else // __declspec(align) not available, force QWORD align with old method |
||
141 | extern unsigned char * const rbuf; |
||
142 | #endif |
||
143 | |||
144 | extern unsigned char * const save_buf; |
||
145 | // map zx attributes to pc attributes |
||
146 | // pc ������� (8���) ����� ������: |
||
784 | DimkaM | 147 | // ������� 4 ����: paper[3..0] (������������, ���� pix_off) |
148 | // ������� 4 ����: ink[3..0] (������������, ���� pix_on) |
||
716 | lvd | 149 | // ��� ���� ��� ������ ��� bright � flash |
150 | extern unsigned char colortab[0x100]; |
||
151 | // colortab shifted to 8 and 24 |
||
152 | extern unsigned colortab_s8[0x100]; |
||
153 | extern unsigned colortab_s24[0x100]; |
||
154 | |||
155 | extern unsigned *atrtab; |
||
156 | extern T t; |
||
157 | |||
158 | extern PALETTEENTRY pal0[0x100]; // emulator palette |
||
159 | extern unsigned char * const rbuf_s; // frames to mix with noflic and resampler filters |
||
160 | extern unsigned vmode; // what are drawing: 0-not visible, 1-border, 2-screen |
||
161 | extern videopoint *vcurr; |
||
162 | |||
163 | void set_video(); |
||
164 | void apply_video(); |
||
165 | void paint_scr(char alt); // alt=0/1 - main/alt screen, alt=2 - ray-painted |
||
166 | void update_screen(); |
||
167 | void video_timing_tables(); |
||
168 | void pixel_tables(); |
||
169 | void video_color_tables(); |
||
170 | void video_permanent_tables(); |
||
171 | void init_frame(); |
||
172 | void flush_frame(); |
||
173 | void load_spec_colors(); |