|
21 | 21 | #include <config.h> |
22 | 22 | #include <string.h> |
23 | 23 | #include <stdlib.h> |
24 | | -//#include <zlib.h> |
25 | 24 | #include "video.h" |
26 | 25 | #include "memory.h" |
27 | 26 | #include "emu.h" |
28 | 27 | #include "messages.h" |
29 | 28 | #include "conf.h" |
30 | 29 | #include "screen.h" |
31 | | -// #include "frame_skip.h" |
32 | | -// #include "transpack.h" |
33 | | -//#include <cybergraphx/cybergraphics.h> |
34 | | -//#include <proto/cybergraphics.h> |
35 | | -extern int neogeo_fix_bank_type; |
36 | | - |
37 | | - |
38 | | -// #ifdef PROCESSOR_ARM |
39 | | -// /* global declaration for video_arm.S */ |
40 | | -// uint8_t *mem_gfx = NULL; /*=memory.rom.tiles.p;*/ |
41 | | -// uint8_t *mem_video = NULL; //memory.vid.ram; |
42 | | -// //#define TOTAL_GFX_BANK 4096 |
43 | | -// uint32_t *mem_bank_usage; |
44 | | -// |
45 | | -// //GFX_CACHE gcache; |
46 | | -// |
47 | | -// void draw_one_char_arm(int byte1, int byte2, uint16_t *br); |
48 | | -// int draw_tile_arm_norm(uint32_t tileno, int color, uint8_t *bmp, int zy); |
49 | | -// #endif |
50 | | - |
51 | | -// #ifdef I386_ASM |
52 | | -// /* global declaration for video_i386.asm */ |
53 | | -// uint8_t **mem_gfx; //=&memory.rom.tiles.p; |
54 | | -// uint8_t *mem_video; //=memory.vid.ram; |
55 | | -// |
56 | | -// /* prototype */ |
57 | | -// void draw_tile_i386_norm(uint32_t tileno, int sx, int sy, int zx, int zy, |
58 | | -// int color, int xflip, int yflip, uint8_t *bmp); |
59 | | -// void draw_tile_i386_50(uint32_t tileno, int sx, int sy, int zx, int zy, |
60 | | -// int color, int xflip, int yflip, uint8_t *bmp); |
61 | | -// void draw_one_char_i386(int byte1, int byte2, uint16_t *br); |
62 | | -// |
63 | | -// void draw_scanline_tile_i386_norm(uint32_t tileno, int yoffs, int sx, int line, int zx, |
64 | | -// int color, int xflip, uint8_t *bmp); |
65 | | -// |
66 | | -// void draw_scanline_tile_i386_50(uint32_t tileno, int yoffs, int sx, int line, int zx, |
67 | | -// int color, int xflip, uint8_t *bmp); |
68 | | -// #endif |
69 | 30 |
|
70 | | -//uint8_t strip_usage[0x300]; |
71 | 31 | #define PEN_USAGE(tileno) ((((uint32_t*) memory.rom.spr_usage.p)[tileno>>4]>>((tileno&0xF)*2))&0x3) |
72 | 32 |
|
73 | | - |
74 | | -static uint8_t dr, dg, db, sr, sg, sb; |
75 | | -// static __inline__ uint16_t alpha_blend(uint16_t dest, uint16_t src, uint8_t a) { |
76 | | -// |
77 | | -// |
78 | | -// dr = ((dest & 0xF800) >> 11) << 3; |
79 | | -// dg = ((dest & 0x7E0) >> 5) << 2; |
80 | | -// db = ((dest & 0x1F)) << 3; |
81 | | -// |
82 | | -// sr = ((src & 0xF800) >> 11) << 3; |
83 | | -// sg = ((src & 0x7E0) >> 5) << 2; |
84 | | -// sb = ((src & 0x1F)) << 3; |
85 | | -// |
86 | | -// dr = (((sr - dr)*(a)) >> 8) + dr; |
87 | | -// dg = (((sg - dg)*(a)) >> 8) + dg; |
88 | | -// db = (((sb - db)*(a)) >> 8) + db; |
89 | | -// |
90 | | -// return ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3); |
91 | | -// } |
92 | | -// #define BLEND16_50(a,b) ((((a)&0xf7de)>>1)+(((b)&0xf7de)>>1)) |
93 | | -// #define BLEND16_25(a,b) alpha_blend(a,b,63) |
94 | | - |
95 | | - |
96 | | -char dda_y_skip[17]; |
97 | | -uint32_t dda_y_skip_i; |
98 | | -uint32_t full_y_skip_i = 0xFFFE; |
99 | | -char full_y_skip[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
100 | | -uint32_t neogeo_frame_counter_speed = 8; |
101 | | - |
102 | | -// static uint16_t fix_addr[40][32]; |
103 | | -// static uint8_t fix_shift[40]; |
104 | | - |
105 | | -static uint16_t dda_x_skip_i; |
| 33 | +extern int neogeo_fix_bank_type; |
106 | 34 | const uint16_t ddaxskip_i[17] = { |
107 | 35 | 0x0000, 0x0080, 0x0880, 0x0888, 0x2888, 0x288a, 0x2a8a, 0x2aaa, 0xaaaa, |
108 | 36 | 0xaaea, 0xbaea, 0xbaeb, 0xbbeb, 0xbbef, 0xfbef, 0xfbff, 0xffff |
109 | 37 | }; |
110 | | -#define dda_x_skip(N) (dda_x_skip_i & (1 << N)) |
111 | | -static void fix_value_init(void) { |
112 | | - // int x, y; |
113 | | - // for (x = 0; x < 40; x++) { |
114 | | - // for (y = 0; y < 32; y++) { |
115 | | - // fix_addr[x][y] = 0xea00 + (y << 1) + 64 * (x / 6); |
116 | | - // } |
117 | | - // fix_shift[x] = (5 - (x % 6)); |
118 | | - // } |
119 | | -} |
120 | | - |
121 | | - |
122 | | -/* Drawing function generation */ |
123 | | -// #define RENAME(name) name##_tile |
124 | | -// #define PUTPIXEL(dst,src) dst=src |
125 | | -// #include "video_template.h" |
126 | | - |
127 | | -// #define RENAME(name) name##_tile_50 |
128 | | -// #define PUTPIXEL(dst,src) dst=BLEND16_50(src,dst) |
129 | | -// #include "video_template.h" |
130 | | -// |
131 | | -// #define RENAME(name) name##_tile_25 |
132 | | -// #define PUTPIXEL(dst,src) dst=BLEND16_25(src,dst) |
133 | | -// #include "video_template.h" |
134 | | -// |
135 | | -// #ifdef PROCESSOR_ARM |
136 | | -// |
137 | | -// |
138 | | -// #endif |
139 | 38 | const int overscan = 1; |
140 | 39 |
|
141 | | - |
142 | 40 | extern struct RastPort *theRastPort; |
143 | 41 |
|
144 | 42 | uint8_t line_limit[256] = {0xFF}, *limit; |
| 43 | +uint32_t neogeo_frame_counter_speed = 8; |
145 | 44 | uint32_t even_odd = 0; |
146 | 45 |
|
147 | | -//(palbase, tilepos, gfxdata, rzx, yskip) |
148 | | - |
149 | | -//OPTION_INTERLEAVED |
| 46 | +static uint8_t dr, dg, db, sr, sg, sb; |
150 | 47 |
|
151 | 48 | void draw_screen(void) { |
152 | 49 | if(screen_prerender()) { |
153 | | - if(arg[OPTION_INTERLEAVED]) { |
154 | | - uint8_t c = even_odd - 1; |
155 | | - uint32_t i, x; |
156 | | - uint16_t *clear = (uint16_t*)bufferpixels; |
157 | | - |
158 | | - for(i=0;i<224;i++) { |
159 | | - line_limit[i] = c; |
160 | | - if(!c) { |
161 | | - uint16_t pixel = current_pc_pal[4095]; |
162 | | - for(x=0;x<320;x++) clear[x] = pixel; |
163 | | - c = 255; |
164 | | - } else { |
165 | | - c = 0; |
166 | | - } |
167 | | - clear += 384; |
168 | | - } |
169 | | - even_odd = !even_odd; |
170 | | - |
171 | | - } else { |
172 | | - bzero( line_limit, 224 ); |
173 | | - clr_screen_m68k(bufferpixels, current_pc_pal[4095] ); |
174 | | - } |
| 50 | + clr_screen_m68k(bufferpixels, current_pc_pal[4095] ); |
175 | 51 |
|
176 | 52 | /* Draw sprites */ |
177 | | - if(AC68080) draw_tiles_ammx(); |
178 | | - else draw_tiles_m68k(); |
| 53 | + if(AC68080) |
| 54 | + draw_tiles_ammx(); |
| 55 | + else |
| 56 | + draw_tiles_m68k(); |
179 | 57 |
|
180 | 58 | /* Draw fix layer */ |
181 | 59 | draw_fix_char(bufferpixels, 0, 0); |
182 | 60 |
|
183 | 61 | clr_border_m68k(bufferpixels, 0 ); |
184 | | - screen_update(); |
185 | | - |
| 62 | + screen_update(); |
186 | 63 | } else { |
187 | 64 | debug("Unable to lock screen (%p)\n", bufferpixels); |
188 | 65 | exit(-1); |
189 | 66 | } |
190 | 67 | } |
191 | 68 |
|
192 | | - |
193 | 69 | void init_video(void) { |
194 | | -#ifdef PROCESSOR_ARM |
195 | | - if (!mem_gfx) { |
196 | | - mem_gfx = memory.rom.tiles.p; |
197 | | - } |
198 | | - if (!mem_video) { |
199 | | - mem_video = memory.vid.ram; |
200 | | - } |
201 | | -#elif I386_ASM |
202 | | - mem_gfx = &memory.rom.tiles.p; |
203 | | - mem_video = memory.vid.ram; |
204 | | -#endif |
205 | | - fix_value_init(); |
206 | 70 | memory.vid.modulo = 1; |
207 | 71 | } |
0 commit comments