4 /* screen routines for color targets */
7 use for slightly different colors
21 struct rgb norm_colors
[COLORNUM
]={
22 {0,0,0},{N0
,N0
,N1
},{N1
,N0
,N0
},{N1
,N0
,N1
},
23 {N0
,N1
,N0
},{N0
,N1
,N1
},{N1
,N1
,N0
},{N1
,N1
,N1
},
25 {0,0,0},{B0
,B0
,B1
},{B1
,B0
,B0
},{B1
,B0
,B1
},
26 {B0
,B1
,B0
},{B0
,B1
,B1
},{B1
,B1
,B0
},{B1
,B1
,B1
}
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
;
34 void init_spect_scr(void)
38 for(i
= 0; i
< 16; i
++)
40 for(i
= 0; i
< 16; i
++)
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
];
46 sp_image
= (char *) &image_array
;
47 spscr_init_mask_color();
48 spscr_init_line_pointers(HEIGHT
);
52 void update_screen(void)
59 #if LCD_HEIGHT >= ZX_HEIGHT && LCD_WIDTH >= ZX_WIDTH
61 scrptr
= (byte
*) SPNM(image
);
62 frameb
= rb
->lcd_framebuffer
;
63 for ( y
= 0 ; y
< HEIGHT
*WIDTH
; y
++ ){
64 frameb
[y
] = _16bpp_colors
[(unsigned)sp_image
[y
]];
69 int srcx
, srcy
=0; /* x / y coordinates in source image */
71 image
= sp_image
+ ( (Y_OFF
)*(WIDTH
) ) + X_OFF
;
72 frameb
= rb
->lcd_framebuffer
;
73 for(y
= 0; y
< LCD_HEIGHT
; y
++)
75 srcx
= 0; /* reset our x counter before each row... */
76 for(x
= 0; x
< LCD_WIDTH
; x
++)
78 *frameb
= _16bpp_colors
[image
[srcx
>>16]];
79 srcx
+= X_STEP
; /* move through source image */
82 srcy
+= Y_STEP
; /* move through the source image... */
83 image
+= (srcy
>>16)*WIDTH
; /* and possibly to the next row. */
84 srcy
&= 0xffff; /* set up the y-coordinate between 0 and 1 */
88 if ( settings
.showfps
) {
90 int TPF
= HZ
/50;/* ticks per frame */
91 if ((*rb
->current_tick
-start_time
) > TPF
)
92 percent
= 100*video_frames
/((*rb
->current_tick
-start_time
)/TPF
);
93 rb
->snprintf(str
,sizeof(str
),"%d %%",percent
);
94 rb
->lcd_putsxy(0,0,str
);
100 #endif /* HAVE_LCD_COLOR */