2 * Written by Nick Kovac with minor changes by Claudio Matsuoka
17 uint8_t fadepal[768 * 2];
20 extern int l1, l2, l3, l4;
21 extern int k1, k2, k3, k4;
22 extern int il1, il2, il3, il4;
23 extern int ik1, ik2, ik3, ik4;
30 void initpparas(void);
37 for (ccc = 0; ccc < 65; ccc++) {
38 dtau[ccc] = ccc * ccc / 4 * 43 / 128 + 60;
49 // [nk] just before retrace
52 // There is also assembly code to set the first pixel of
53 // display memory here, but it may not be necessary.
55 vga_set_hscroll_offset(cop_scrl);
61 // [nk] Don't think this is used.
66 vga_upload_palette(cop_pal);
81 // [NK 18/1/2014] Disable this for now, as it looks a bit jittery.
85 // [NK] This function toggles the horizontal split point every frame
86 // [NK] between line 60 and 61, and toggles the horizontal offset between 0 and 4.
87 // [NK] I think the original intention of this code was to give more variation
88 // [NK] cheaply, almost like a cheap alpha blend between two plasmas, but
89 // [NK] it seems to cause a lot of flicker in the port. Perhaps more precise timing is
90 // [NK] required to give the original effect? In any case I disabled this code
93 vga_set_line_compare(60);
100 // [NK 12/1/2014] Moving the starting line up and down each alternate frame
101 // [NK 12/1/2014] doesn't look good in windowed mode.
102 // [NK 13/1/2014] Seems to work okay in fullscreen mode though.
103 vga_set_line_compare(61);
134 if (cop_drop <= 64) {
135 vga_set_line_compare(dtau[cop_drop]);
141 if (cop_drop >= 256) {
142 } else if (cop_drop >= 128) {
144 } else if (cop_drop > 96) {
145 } else /*if (cop_drop > 64) */{
153 if (cop_drop == 65) {
154 vga_set_line_compare(400);
159 vga_set_line_compare(60);
161 // [NK 9/1/2014] Fade the palette using 8.8 fixed point numbers.
163 uint8_t* pcop_fadepal = cop_fadepal;
164 uint8_t* pfadepal = fadepal;
166 for (i = 0; i < (768 / 16); i++) {
167 for (ccc = 0; ccc < 16; ccc++) {
168 uint8_t al = pcop_fadepal[ccc*2];
169 uint8_t ah = pcop_fadepal[(ccc*2) + 1];
171 uint8_t oldval = pfadepal[ccc + 768];
172 pfadepal[ccc + 768] += al;
173 uint8_t newval = pfadepal[ccc + 768];
175 if (newval < oldval) {
179 pfadepal[ccc] += ah + carry;