diff options
Diffstat (limited to 'apps/plugins/zxbox')
-rw-r--r-- | apps/plugins/zxbox/SOURCES | 7 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxvid_16bpp.c | 57 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxvid_2bpp.c (renamed from apps/plugins/zxbox/zxvid_4bpp.c) | 37 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxvid_grey.c | 40 |
4 files changed, 59 insertions, 82 deletions
diff --git a/apps/plugins/zxbox/SOURCES b/apps/plugins/zxbox/SOURCES index ae0307135f..489a3c0613 100644 --- a/apps/plugins/zxbox/SOURCES +++ b/apps/plugins/zxbox/SOURCES | |||
@@ -27,6 +27,11 @@ z80_step.c | |||
27 | z80optab.c | 27 | z80optab.c |
28 | zxbox.c | 28 | zxbox.c |
29 | zxbox_keyb.c | 29 | zxbox_keyb.c |
30 | #ifdef HAVE_LCD_COLOR | ||
30 | zxvid_16bpp.c | 31 | zxvid_16bpp.c |
31 | zxvid_4bpp.c | 32 | #else |
33 | #if LCD_DEPTH == 2 | ||
34 | zxvid_2bpp.c | ||
35 | #endif | ||
32 | zxvid_grey.c | 36 | zxvid_grey.c |
37 | #endif | ||
diff --git a/apps/plugins/zxbox/zxvid_16bpp.c b/apps/plugins/zxbox/zxvid_16bpp.c index 336e1c2447..4a05c69f97 100644 --- a/apps/plugins/zxbox/zxvid_16bpp.c +++ b/apps/plugins/zxbox/zxvid_16bpp.c | |||
@@ -1,48 +1,46 @@ | |||
1 | #include "zxvid_com.h" | 1 | #include "zxvid_com.h" |
2 | 2 | ||
3 | #if LCD_DEPTH > 4 | ||
4 | /* screen routines for color targets */ | 3 | /* screen routines for color targets */ |
5 | 4 | ||
6 | /* | ||
7 | use for slightly different colors | ||
8 | #define N0 0x04 | ||
9 | #define N1 0x34 | ||
10 | |||
11 | #define B0 0x08 | ||
12 | #define B1 0x3F | ||
13 | */ | ||
14 | |||
15 | #define N0 0x00 | 5 | #define N0 0x00 |
16 | #define N1 0xC0 | 6 | #define N1 0xC0 |
17 | |||
18 | #define B0 0x00 | 7 | #define B0 0x00 |
19 | #define B1 0xFF | 8 | #define B1 0xFF |
20 | 9 | ||
21 | struct rgb norm_colors[COLORNUM]={ | 10 | #define IN0 (0xFF-N0) |
22 | {0,0,0},{N0,N0,N1},{N1,N0,N0},{N1,N0,N1}, | 11 | #define IN1 (0xFF-N1) |
23 | {N0,N1,N0},{N0,N1,N1},{N1,N1,N0},{N1,N1,N1}, | 12 | #define IB0 (0xFF-B0) |
24 | 13 | #define IB1 (0xFF-B1) | |
25 | {0,0,0},{B0,B0,B1},{B1,B0,B0},{B1,B0,B1}, | 14 | |
26 | {B0,B1,B0},{B0,B1,B1},{B1,B1,B0},{B1,B1,B1} | 15 | static const fb_data _16bpp_colors[32] = { |
16 | /* normal */ | ||
17 | LCD_RGBPACK(N0, N0, N0), LCD_RGBPACK(N0, N0, N1), | ||
18 | LCD_RGBPACK(N1, N0, N0), LCD_RGBPACK(N1, N0, N1), | ||
19 | LCD_RGBPACK(N0, N1, N0), LCD_RGBPACK(N0, N1, N1), | ||
20 | LCD_RGBPACK(N1, N1, N0), LCD_RGBPACK(N1, N1, N1), | ||
21 | LCD_RGBPACK(B0, B0, B0), LCD_RGBPACK(B0, B0, B1), | ||
22 | LCD_RGBPACK(B1, B0, B0), LCD_RGBPACK(B1, B0, B1), | ||
23 | LCD_RGBPACK(B0, B1, B0), LCD_RGBPACK(B0, B1, B1), | ||
24 | LCD_RGBPACK(B1, B1, B0), LCD_RGBPACK(B1, B1, B1), | ||
25 | /* inverted */ | ||
26 | LCD_RGBPACK(IN0, IN0, IN0), LCD_RGBPACK(IN0, IN0, IN1), | ||
27 | LCD_RGBPACK(IN1, IN0, IN0), LCD_RGBPACK(IN1, IN0, IN1), | ||
28 | LCD_RGBPACK(IN0, IN1, IN0), LCD_RGBPACK(IN0, IN1, IN1), | ||
29 | LCD_RGBPACK(IN1, IN1, IN0), LCD_RGBPACK(IN1, IN1, IN1), | ||
30 | LCD_RGBPACK(IB0, IB0, IB0), LCD_RGBPACK(IB0, IB0, IB1), | ||
31 | LCD_RGBPACK(IB1, IB0, IB0), LCD_RGBPACK(IB1, IB0, IB1), | ||
32 | LCD_RGBPACK(IB0, IB1, IB0), LCD_RGBPACK(IB0, IB1, IB1), | ||
33 | LCD_RGBPACK(IB1, IB1, IB0), LCD_RGBPACK(IB1, IB1, IB1), | ||
27 | }; | 34 | }; |
28 | 35 | ||
29 | |||
30 | /* since emulator uses array of bytes for screen representation | ||
31 | * short 16b colors won't fit there */ | ||
32 | short _16bpp_colors[16] IBSS_ATTR; | ||
33 | |||
34 | void init_spect_scr(void) | 36 | void init_spect_scr(void) |
35 | { | 37 | { |
36 | int i; | 38 | int i; |
39 | int offset = settings.invert_colors ? 16 : 0; | ||
37 | 40 | ||
38 | for(i = 0; i < 16; i++) | 41 | for(i = 0; i < 16; i++) |
39 | sp_colors[i] = i; | 42 | sp_colors[i] = i + offset; |
40 | for(i = 0; i < 16; i++) | 43 | |
41 | _16bpp_colors[i] = LCD_RGBPACK(norm_colors[i].r,norm_colors[i].g,norm_colors[i].b); | ||
42 | if ( settings.invert_colors ){ | ||
43 | for ( i = 0 ; i < 16 ; i++ ) | ||
44 | _16bpp_colors[i] = 0xFFFFFF - _16bpp_colors[i]; | ||
45 | } | ||
46 | sp_image = (char *) &image_array; | 44 | sp_image = (char *) &image_array; |
47 | spscr_init_mask_color(); | 45 | spscr_init_mask_color(); |
48 | spscr_init_line_pointers(HEIGHT); | 46 | spscr_init_line_pointers(HEIGHT); |
@@ -97,4 +95,3 @@ void update_screen(void) | |||
97 | } | 95 | } |
98 | 96 | ||
99 | 97 | ||
100 | #endif /* HAVE_LCD_COLOR */ | ||
diff --git a/apps/plugins/zxbox/zxvid_4bpp.c b/apps/plugins/zxbox/zxvid_2bpp.c index 1d9902e125..0a4519e0ac 100644 --- a/apps/plugins/zxbox/zxvid_4bpp.c +++ b/apps/plugins/zxbox/zxvid_2bpp.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "zxvid_com.h" | 1 | #include "zxvid_com.h" |
2 | 2 | ||
3 | #if !defined USE_GREY && LCD_DEPTH < 4 | 3 | #ifndef USE_GREY |
4 | /* screen routines for greyscale targets not using greyscale lib */ | 4 | /* screen routines for greyscale targets not using greyscale lib */ |
5 | 5 | ||
6 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | 6 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING |
@@ -21,32 +21,19 @@ fb_data pixval[4] ICONST_ATTR = { | |||
21 | }; | 21 | }; |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static const unsigned char graylevels[16] = { | ||
25 | 0, 1, 1, 1, 2, 2, 3, 3, | ||
26 | 0, 1, 1, 1, 2, 2, 3, 3 | ||
27 | }; | ||
28 | |||
24 | void init_spect_scr(void) | 29 | void init_spect_scr(void) |
25 | { | 30 | { |
26 | sp_colors[0] = 0;/* BLACK ? */ | 31 | int i; |
27 | sp_colors[1] = 1;/* BLUE ? */ | 32 | unsigned mask = settings.invert_colors ? 0 : 3; |
28 | sp_colors[2] = 1;/* RED ? */ | 33 | |
29 | sp_colors[3] = 1;/* MAGENTA ? */ | 34 | for(i = 0; i < 16; i++) |
30 | sp_colors[4] = 2;/* GREEN ? */ | 35 | sp_colors[i] = graylevels[i] ^ mask; |
31 | sp_colors[5] = 2;/* CYAN ? */ | ||
32 | sp_colors[6] = 3;/* YELLOW ? */ | ||
33 | sp_colors[7] = 3;/* WHITE ? */ | ||
34 | |||
35 | /* same but 'light/bright' colors */ | ||
36 | sp_colors[8] = 0; | ||
37 | sp_colors[9] = 1; | ||
38 | sp_colors[10] = 1; | ||
39 | sp_colors[11] = 1; | ||
40 | sp_colors[12] = 2; | ||
41 | sp_colors[13] = 2; | ||
42 | sp_colors[14] = 3; | ||
43 | sp_colors[15] = 3; | ||
44 | 36 | ||
45 | if ( !settings.invert_colors ){ | ||
46 | int i; | ||
47 | for ( i = 0 ; i < 16 ; i++ ) | ||
48 | sp_colors[i] = 3 - sp_colors[i]; | ||
49 | } | ||
50 | sp_image = (char *) &image_array; | 37 | sp_image = (char *) &image_array; |
51 | spscr_init_mask_color(); | 38 | spscr_init_mask_color(); |
52 | spscr_init_line_pointers(HEIGHT); | 39 | spscr_init_line_pointers(HEIGHT); |
@@ -127,4 +114,4 @@ void update_screen(void) | |||
127 | rb -> lcd_update(); | 114 | rb -> lcd_update(); |
128 | } | 115 | } |
129 | 116 | ||
130 | #endif | 117 | #endif /* !USE_GREY */ |
diff --git a/apps/plugins/zxbox/zxvid_grey.c b/apps/plugins/zxbox/zxvid_grey.c index de9cd97874..d713eba4b5 100644 --- a/apps/plugins/zxbox/zxvid_grey.c +++ b/apps/plugins/zxbox/zxvid_grey.c | |||
@@ -1,40 +1,28 @@ | |||
1 | #include "zxvid_com.h" | 1 | #include "zxvid_com.h" |
2 | #if !defined HAVE_LCD_COLOR && defined USE_GREY | ||
3 | /* | ||
4 | use for slightly different colors | ||
5 | #define N0 0x04 | ||
6 | #define N1 0x34 | ||
7 | 2 | ||
8 | #define B0 0x08 | 3 | #ifdef USE_GREY |
9 | #define B1 0x3F | ||
10 | */ | ||
11 | 4 | ||
12 | /* these ones are the same as for color targets ... may be tweak for greyscale? */ | ||
13 | #define N0 0x00 | 5 | #define N0 0x00 |
14 | #define N1 0xAA | 6 | #define N1 0xC0 |
15 | 7 | #define B0 0x00 | |
16 | #define B0 0x55 | ||
17 | #define B1 0xFF | 8 | #define B1 0xFF |
18 | static unsigned char graybuffer[LCD_HEIGHT*LCD_WIDTH] IBSS_ATTR; /* off screen buffer */ | ||
19 | 9 | ||
20 | struct rgb norm_colors[COLORNUM]={ | 10 | static unsigned char graybuffer[LCD_HEIGHT*LCD_WIDTH] IBSS_ATTR; /* off screen buffer */ |
21 | {0,0,0},{N0,N0,N1},{N1,N0,N0},{N1,N0,N1}, | ||
22 | {N0,N1,N0},{N0,N1,N1},{N1,N1,N0},{N1,N1,N1}, | ||
23 | 11 | ||
24 | {0x15,0x15,0x15},{B0,B0,B1},{B1,B0,B0},{B1,B0,B1}, | 12 | static const unsigned char graylevels[16] = { |
25 | {B0,B1,B0},{B0,B1,B1},{B1,B1,B0},{B1,B1,B1} | 13 | N0, (6*N0+1*N1)/7, (5*N0+2*N1)/7, (4*N0+3*N1)/7, |
14 | (3*N0+4*N1)/7, (2*N0+5*N1)/7, (1*N0+6*N1)/7, N1, | ||
15 | B0, (6*B0+1*B1)/7, (5*B0+2*B1)/7, (4*B0+3*B1)/7, | ||
16 | (3*B0+4*B1)/7, (2*B0+5*B1)/7, (1*B0+6*B1)/7, B1 | ||
26 | }; | 17 | }; |
27 | 18 | ||
28 | void init_spect_scr(void) | 19 | void init_spect_scr(void) |
29 | { | 20 | { |
30 | int i; | 21 | int i; |
22 | unsigned mask = settings.invert_colors ? 0xFF : 0; | ||
23 | |||
31 | for(i = 0; i < 16; i++) | 24 | for(i = 0; i < 16; i++) |
32 | sp_colors[i] = 0.3*norm_colors[i].r + 0.59*norm_colors[i].g + 0.11*norm_colors[i].b; | 25 | sp_colors[i] = graylevels[i] ^ mask; |
33 | if ( settings.invert_colors ){ | ||
34 | int i; | ||
35 | for ( i = 0 ; i < 16 ; i++ ) | ||
36 | sp_colors[i] = 255 - sp_colors[i]; | ||
37 | } | ||
38 | 26 | ||
39 | sp_image = (char *) &image_array; | 27 | sp_image = (char *) &image_array; |
40 | spscr_init_mask_color(); | 28 | spscr_init_mask_color(); |
@@ -52,7 +40,7 @@ void update_screen(void) | |||
52 | int srcx, srcy=0; /* x / y coordinates in source image */ | 40 | int srcx, srcy=0; /* x / y coordinates in source image */ |
53 | image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF; | 41 | image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF; |
54 | unsigned char* buf_ptr; | 42 | unsigned char* buf_ptr; |
55 | buf_ptr = (unsigned char*) &graybuffer; | 43 | buf_ptr = graybuffer; |
56 | for(y = 0; y < LCD_HEIGHT; y++) | 44 | for(y = 0; y < LCD_HEIGHT; y++) |
57 | { | 45 | { |
58 | srcx = 0; /* reset our x counter before each row... */ | 46 | srcx = 0; /* reset our x counter before each row... */ |
@@ -94,4 +82,4 @@ void update_screen(void) | |||
94 | 82 | ||
95 | } | 83 | } |
96 | 84 | ||
97 | #endif | 85 | #endif /* USE_GREY */ |