Jo Engine  2024.04.28
Jo Sega Saturn Engine
vdp2.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2024, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35  /*
36  ▲ IMPORTANT NOTE ABOUT VDP2 USAGE (extract from ST-058-R2-060194.pdf p61):
37  Depending on the color count of NBG0 and NBG1, the scroll screen that cannot be displayed will appear.
38 
39  - When NBG0 is set as 2048 or 32768 colors, NBG2 can not longer be displayed.
40  - When NBG0 is set at 16,770,000 colors, NBG1 to NBG3 can not longer be displayed.
41  - When NBG1 is set at 2048 or 32768 colors, NBG3 can longer be displayed.
42  */
43 
44 #ifndef __JO_VDP2_H__
45 # define __JO_VDP2_H__
46 
53 int sprintf(char* str, const char* format, ...);
54 
59 
63 void jo_set_displayed_screens(const jo_scroll_screen scroll_screen_flags);
64 
68 void jo_set_default_background_color(const jo_color background_color);
69 
70 /*
71 ███╗ ██╗██████╗ ██████╗ ██████╗ ██╗██████╗ ███████╗ ██████╗ ███╗ ██╗████████╗
72 ████╗ ██║██╔══██╗██╔════╝ ╚════██╗ ██╔╝╚════██╗ ██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝
73 ██╔██╗ ██║██████╔╝██║ ███╗ █████╔╝ ██╔╝ █████╔╝ █████╗ ██║ ██║██╔██╗ ██║ ██║
74 ██║╚██╗██║██╔══██╗██║ ██║██╔═══╝ ██╔╝ ╚═══██╗ ██╔══╝ ██║ ██║██║╚██╗██║ ██║
75 ██║ ╚████║██████╔╝╚██████╔╝███████╗██╔╝ ██████╔╝ ██║ ╚██████╔╝██║ ╚████║ ██║
76 ╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝
77 */
78 
79 #ifndef JO_COMPILE_WITH_PRINTF_SUPPORT
80 
86 void jo_nbg2_print(int x, int y, char * str);
87 
93 # define jo_nbg2_printf(X, Y, ...) do {sprintf(__jo_sprintf_buf, __VA_ARGS__); jo_nbg2_print(X, Y, __jo_sprintf_buf); } while(0)
94 
103 void jo_vdp2_set_nbg2_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled);
104 
107 void jo_nbg2_clear(void);
108 
114 void jo_nbg3_print(int x, int y, char * str);
115 
121 # define jo_nbg3_printf(X, Y, ...) do {sprintf(__jo_sprintf_buf, __VA_ARGS__); jo_nbg3_print(X, Y, __jo_sprintf_buf); } while(0)
122 
131 void jo_vdp2_set_nbg3_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled);
132 
135 void jo_nbg3_clear(void);
136 
137 #endif
138 
139 /*
140 ██████╗ ██████╗ █████╗ ██╗ ██╗ ██╗███╗ ███╗ █████╗ ██████╗ ███████╗
141 ██╔══██╗██╔══██╗██╔══██╗██║ ██║ ██║████╗ ████║██╔══██╗██╔════╝ ██╔════╝
142 ██║ ██║██████╔╝███████║██║ █╗ ██║ ██║██╔████╔██║███████║██║ ███╗█████╗
143 ██║ ██║██╔══██╗██╔══██║██║███╗██║ ██║██║╚██╔╝██║██╔══██║██║ ██║██╔══╝
144 ██████╔╝██║ ██║██║ ██║╚███╔███╔╝ ██║██║ ╚═╝ ██║██║ ██║╚██████╔╝███████╗
145 ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
146 
147 */
148 
155 void jo_vdp2_set_nbg1_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip);
156 
157 #ifndef JO_COMPILE_WITH_PRINTF_SUPPORT
158 
165 void jo_vdp2_set_nbg0_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
166 #endif
167 
175 void jo_vdp2_set_nbg2_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
176 
184 void jo_vdp2_set_nbg3_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
185 
191 void jo_vdp2_set_nbg1_image(const jo_img * const img, const unsigned short left, const unsigned short top);
192 
197 
198 /*
199 ███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ███████╗ ██████╗ ██████╗ ███╗ ███╗
200 ████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ╚══███╔╝██╔═══██╗██╔═══██╗████╗ ████║
201 ██╔████╔██║██║ ██║██║ ██║█████╗ ████████╗ ███╔╝ ██║ ██║██║ ██║██╔████╔██║
202 ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔═██╔═╝ ███╔╝ ██║ ██║██║ ██║██║╚██╔╝██║
203 ██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██████║ ███████╗╚██████╔╝╚██████╔╝██║ ╚═╝ ██║
204 ╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
205 
206 */
207 
212 static __jo_force_inline void jo_vdp2_move_nbg1(const int x, const int y)
213 {
214 #if JO_COMPILE_USING_SGL
215  slScrPosNbg1(JO_MULT_BY_65536(x), JO_MULT_BY_65536(y));
216 #else
217  JO_VDP2_SCXIN1 = x;
218  JO_VDP2_SCYIN1 = y;
219 #endif
220 }
221 
226 static __jo_force_inline void jo_vdp2_zoom_nbg1f(const float width_factor, const float height_factor)
227 {
228 #if JO_COMPILE_USING_SGL
229  slZoomNbg1(toFIXED(width_factor), toFIXED(height_factor));
230 #else
231  int fixed_width = jo_float2fixed(width_factor);
232  int fixed_height = jo_float2fixed(height_factor);
233  JO_VDP2_ZMXIN1 = JO_DIV_BY_32768(fixed_width);
234  JO_VDP2_ZMYIN1 = JO_DIV_BY_32768(fixed_height);
235  JO_VDP2_ZMXDN1 = JO_MOD_POW2(fixed_width, 32768) * 2; /*TODO : fix x2 */
236  JO_VDP2_ZMYDN1 = JO_MOD_POW2(fixed_height, 32768) * 2;
237 #endif
238 }
239 
243 static __jo_force_inline void jo_vdp2_zoom_nbg1(const float factor)
244 {
245  jo_vdp2_zoom_nbg1f(factor, factor);
246 }
247 
252 static __jo_force_inline void jo_vdp2_move_nbg0(const int x, const int y)
253 {
254 #if JO_COMPILE_USING_SGL
255  slScrPosNbg0(JO_MULT_BY_65536(x), JO_MULT_BY_65536(y));
256 #else
257  JO_VDP2_SCXIN0 = x;
258  JO_VDP2_SCYIN0 = y;
259 #endif
260 }
261 
266 static __jo_force_inline void jo_vdp2_zoom_nbg0f(const float width_factor, const float height_factor)
267 {
268 #if JO_COMPILE_USING_SGL
269  slZoomNbg0(toFIXED(width_factor), toFIXED(height_factor));
270 #else
271  int fixed_width = jo_float2fixed(width_factor);
272  int fixed_height = jo_float2fixed(height_factor);
273  JO_VDP2_ZMXIN0 = JO_DIV_BY_32768(fixed_width);
274  JO_VDP2_ZMYIN0 = JO_DIV_BY_32768(fixed_height);
275  JO_VDP2_ZMXDN0 = JO_MOD_POW2(fixed_width, 32768) * 2; /*TODO : fix x2 */
276  JO_VDP2_ZMYDN0 = JO_MOD_POW2(fixed_height, 32768) * 2;
277 #endif
278 }
279 
283 static __jo_force_inline void jo_vdp2_zoom_nbg0(const float factor)
284 {
285  jo_vdp2_zoom_nbg0f(factor, factor);
286 }
287 
288 /*
289 ██████╗ █████╗ ███████╗██╗ ██████╗ ██████╗ ██████╗ █████╗ ██╗ ██╗██╗███╗ ██╗ ██████╗
290 ██╔══██╗██╔══██╗██╔════╝██║██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██║ ██║██║████╗ ██║██╔════╝
291 ██████╔╝███████║███████╗██║██║ ██║ ██║██████╔╝███████║██║ █╗ ██║██║██╔██╗ ██║██║ ███╗
292 ██╔══██╗██╔══██║╚════██║██║██║ ██║ ██║██╔══██╗██╔══██║██║███╗██║██║██║╚██╗██║██║ ██║
293 ██████╔╝██║ ██║███████║██║╚██████╗ ██████╔╝██║ ██║██║ ██║╚███╔███╔╝██║██║ ╚████║╚██████╔╝
294 ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
295 *
296 ** ▲ ONLY WORKS IN BITMAP MODE
297 */
298 
306 void jo_vdp2_draw_bitmap_nbg1_line(int x0, int y0, int x1, int y1, const jo_color color);
307 
315 static __jo_force_inline void jo_vdp2_draw_bitmap_nbg1_square(const int x, const int y, const short width, const short height, const jo_color color)
316 {
317  jo_vdp2_draw_bitmap_nbg1_line(x, y, x + width, y, color);
318  jo_vdp2_draw_bitmap_nbg1_line(x + width, y + height, x + width, y, color);
319  jo_vdp2_draw_bitmap_nbg1_line(x, y + height, x + width, y + height, color);
320  jo_vdp2_draw_bitmap_nbg1_line(x, y + height, x, y, color);
321 }
322 
328 static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1(const int x, const int y, const jo_color color)
329 {
330  *(((unsigned short *)VDP2_VRAM_A0) + x + y * JO_VDP2_WIDTH) = color;
331 }
332 
340 static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1_rgb(const int x, const int y, unsigned char r, unsigned char g, unsigned char b)
341 {
342  jo_vdp2_put_pixel_bitmap_nbg1(x, y, C_RGB(r, g, b));
343 }
344 
345 /*
346 ██████╗ ██████╗ ██████╗ ██╗ █████╗ ███╗ ██╗███████╗███████╗
347 ╚════██╗██╔══██╗ ██╔══██╗██║ ██╔══██╗████╗ ██║██╔════╝██╔════╝
348  █████╔╝██║ ██║ ██████╔╝██║ ███████║██╔██╗ ██║█████╗ ███████╗
349  ╚═══██╗██║ ██║ ██╔═══╝ ██║ ██╔══██║██║╚██╗██║██╔══╝ ╚════██║
350 ██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚████║███████╗███████║
351 ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝
352 ** - Two planes are available: A and B
353 ** - Each plane is 512 x 512 size
354 */
355 
359 
363 
371 void jo_vdp2_set_rbg0_plane_a_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip);
372 
380 void jo_vdp2_set_rbg0_plane_b_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip);
381 
389 
397 
398 #if JO_COMPILE_USING_SGL
399 
403 static __jo_force_inline void jo_vdp2_draw_rbg0_plane_a(const bool use_scroll_format_matrix)
404 {
405  slCurRpara(RA); if (use_scroll_format_matrix) slScrMatConv(); slScrMatSet();
406 }
407 
411 static __jo_force_inline void jo_vdp2_draw_rbg0_plane_b(const bool use_scroll_format_matrix)
412 {
413  slCurRpara(RB); if (use_scroll_format_matrix) slScrMatConv(); slScrMatSet();
414 }
415 
416 #endif
417 
418 /*
419 ███╗ ███╗ ██████╗ ███████╗ █████╗ ██╗ ██████╗
420 ████╗ ████║██╔═══██╗╚══███╔╝██╔══██╗██║██╔════╝
421 ██╔████╔██║██║ ██║ ███╔╝ ███████║██║██║
422 ██║╚██╔╝██║██║ ██║ ███╔╝ ██╔══██║██║██║
423 ██║ ╚═╝ ██║╚██████╔╝███████╗██║ ██║██║╚██████╗
424 ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝
425 */
426 
427 #if JO_COMPILE_USING_SGL
428 
435 static __jo_force_inline void jo_enable_screen_mozaic(const jo_scroll_screen screens, const short x, const short y)
436 {
437  slScrMosSize(x, y);
438  slScrMosaicOn(screens);
439 }
440 
444 {
445  slScrMosSize(1, 1);
446  slScrMosaicOn(0);
447 }
448 
449 #endif
450 
451 /*
452 ██╗ ██╗ ██████╗ ██████╗ ██╗███████╗ ██████╗ ███╗ ██╗████████╗ █████╗ ██╗
453 ██║ ██║██╔═══██╗██╔══██╗██║╚══███╔╝██╔═══██╗████╗ ██║╚══██╔══╝██╔══██╗██║
454 ███████║██║ ██║██████╔╝██║ ███╔╝ ██║ ██║██╔██╗ ██║ ██║ ███████║██║
455 ██╔══██║██║ ██║██╔══██╗██║ ███╔╝ ██║ ██║██║╚██╗██║ ██║ ██╔══██║██║
456 ██║ ██║╚██████╔╝██║ ██║██║███████╗╚██████╔╝██║ ╚████║ ██║ ██║ ██║███████╗
457 ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝
458 
459 ██╗ ██╗███╗ ██╗███████╗ ███████╗ ██████╗██████╗ ██████╗ ██╗ ██╗
460 ██║ ██║████╗ ██║██╔════╝ ██╔════╝██╔════╝██╔══██╗██╔═══██╗██║ ██║
461 ██║ ██║██╔██╗ ██║█████╗ ███████╗██║ ██████╔╝██║ ██║██║ ██║
462 ██║ ██║██║╚██╗██║██╔══╝ ╚════██║██║ ██╔══██╗██║ ██║██║ ██║
463 ███████╗██║██║ ╚████║███████╗ ███████║╚██████╗██║ ██║╚██████╔╝███████╗███████╗
464 ╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
465 
466 ▲ ONLY WORKS IF BACKGROUND IMAGE IS LOADED THROUH jo_vdp2_set_nbg1_8bits_image() ▲
467  OTHERWISE IT MAY GLITCH
468 */
469 
472 # define JO_NBG1_SCROLL_TABLE_SIZE (512)
473 
479 
483 
487 void jo_vdp2_compute_nbg1_line_scroll(unsigned short offset);
488 
491 # define JO_NBG0_SCROLL_TABLE_SIZE (512)
492 
498 
502 
506 void jo_vdp2_compute_nbg0_line_scroll(unsigned short offset);
507 
508 /*
509 ████████╗██████╗ █████╗ ███╗ ██╗███████╗██████╗ █████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ ██╗
510 ╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝
511  ██║ ██████╔╝███████║██╔██╗ ██║███████╗██████╔╝███████║██████╔╝█████╗ ██╔██╗ ██║██║ ╚████╔╝
512  ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██╔═══╝ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ╚██╔╝
513  ██║ ██║ ██║██║ ██║██║ ╚████║███████║██║ ██║ ██║██║ ██║███████╗██║ ╚████║╚██████╗ ██║
514  ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝
515 
516 */
517 
521 
526 void jo_enable_screen_transparency(const jo_scroll_screen screen, const unsigned short transparency_level);
527 
528 #endif /* !__JO_VDP2_H__ */
529 
530 /*
531 ** END OF FILE
532 */
jo_vdp2_replace_rbg0_plane_a_8bits_image
void jo_vdp2_replace_rbg0_plane_a_8bits_image(jo_img_8bits *img, bool vertical_flip)
Replace plane A image.
jo_vdp2_move_nbg0
static __jo_force_inline void jo_vdp2_move_nbg0(const int x, const int y)
Move NBG0 (scrolling)
Definition: vdp2.h:252
jo_enable_screen_transparency
void jo_enable_screen_transparency(const jo_scroll_screen screen, const unsigned short transparency_level)
Enable screen transparency.
JO_VDP2_ZMYIN0
#define JO_VDP2_ZMYIN0
Definition: sega_saturn.h:300
jo_vdp2_draw_bitmap_nbg1_square
static __jo_force_inline void jo_vdp2_draw_bitmap_nbg1_square(const int x, const int y, const short width, const short height, const jo_color color)
Draw a square on NBG1.
Definition: vdp2.h:315
jo_nbg2_clear
void jo_nbg2_clear(void)
Clear NBG2.
JO_VDP2_SCXIN1
#define JO_VDP2_SCXIN1
Definition: sega_saturn.h:303
jo_vdp2_zoom_nbg1f
static __jo_force_inline void jo_vdp2_zoom_nbg1f(const float width_factor, const float height_factor)
Zoom NBG1 width and height independently.
Definition: vdp2.h:226
jo_vdp2_set_nbg2_8bits_font
void jo_vdp2_set_nbg2_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG2 font image.
jo_vdp2_zoom_nbg1
static __jo_force_inline void jo_vdp2_zoom_nbg1(const float factor)
Zoom NBG1.
Definition: vdp2.h:243
jo_set_displayed_screens
void jo_set_displayed_screens(const jo_scroll_screen scroll_screen_flags)
Set displayed screens.
jo_vdp2_enable_nbg1_line_scroll
int * jo_vdp2_enable_nbg1_line_scroll(void)
Enable NBG1 horizontal line scroll effect.
JO_VDP2_ZMXDN1
#define JO_VDP2_ZMXDN1
Definition: sega_saturn.h:308
sprintf
int sprintf(char *str, const char *format,...)
sprintf prototypes
JO_MOD_POW2
#define JO_MOD_POW2(N, M)
Fast modulo of a power of 2.
Definition: math.h:220
jo_vdp2_set_nbg1_8bits_image
void jo_vdp2_set_nbg1_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip)
Add 8 bits NBG1 image.
JO_VDP2_ZMYIN1
#define JO_VDP2_ZMYIN1
Definition: sega_saturn.h:309
JO_VDP2_ZMYDN1
#define JO_VDP2_ZMYDN1
Definition: sega_saturn.h:310
JO_MULT_BY_65536
#define JO_MULT_BY_65536(X)
Multiply a variable by 65536.
Definition: math.h:138
jo_vdp2_draw_rbg0_plane_b
static __jo_force_inline void jo_vdp2_draw_rbg0_plane_b(const bool use_scroll_format_matrix)
Draw plane A.
Definition: vdp2.h:411
JO_VDP2_SCYIN1
#define JO_VDP2_SCYIN1
Definition: sega_saturn.h:305
jo_vdp2_enable_nbg0_line_scroll
int * jo_vdp2_enable_nbg0_line_scroll(void)
Enable NBG0 horizontal line scroll effect.
jo_vdp2_compute_nbg1_line_scroll
void jo_vdp2_compute_nbg1_line_scroll(unsigned short offset)
Compute NBG1 horizontal line scroll effect using specific offset.
jo_vdp2_disable_nbg1_line_scroll
void jo_vdp2_disable_nbg1_line_scroll(void)
Disable NBG1 horizontal line scroll effect.
jo_set_default_background_color
void jo_set_default_background_color(const jo_color background_color)
Set default background color.
jo_vdp2_set_nbg3_8bits_font
void jo_vdp2_set_nbg3_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG3 font image.
__jo_sprintf_buf
char __jo_sprintf_buf[JO_PRINTF_BUF_SIZE]
Internal sprintf buffer.
jo_vdp2_draw_bitmap_nbg1_line
void jo_vdp2_draw_bitmap_nbg1_line(int x0, int y0, int x1, int y1, const jo_color color)
Draw a NBG1 line using Bresenham's line algorithm.
jo_vdp2_set_nbg3_8bits_image
void jo_vdp2_set_nbg3_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG3 image.
jo_vdp2_disable_rbg0
void jo_vdp2_disable_rbg0(void)
Disable 3D planes.
jo_color
unsigned short jo_color
15 bits color type
Definition: types.h:42
jo_vdp2_zoom_nbg0f
static __jo_force_inline void jo_vdp2_zoom_nbg0f(const float width_factor, const float height_factor)
Zoom NBG0 width and height independently.
Definition: vdp2.h:266
jo_vdp2_move_nbg1
static __jo_force_inline void jo_vdp2_move_nbg1(const int x, const int y)
Move NBG1 (scrolling)
Definition: vdp2.h:212
jo_vdp2_set_nbg0_8bits_image
void jo_vdp2_set_nbg0_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG0 image.
JO_DIV_BY_32768
#define JO_DIV_BY_32768(X)
Devide a variable by 32768.
Definition: math.h:186
JO_PRINTF_BUF_SIZE
#define JO_PRINTF_BUF_SIZE
Max character in available in jo_printf()
Definition: conf.h:165
jo_img_8bits
8 bits image struct
Definition: types.h:234
__jo_force_inline
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: types.h:39
jo_nbg3_clear
void jo_nbg3_clear(void)
Clear NBG3.
JO_VDP2_ZMXIN1
#define JO_VDP2_ZMXIN1
Definition: sega_saturn.h:307
JO_VDP2_WIDTH
#define JO_VDP2_WIDTH
VDP2 Background bitmap width.
Definition: conf.h:159
jo_vdp2_replace_rbg0_plane_b_8bits_image
void jo_vdp2_replace_rbg0_plane_b_8bits_image(jo_img_8bits *img, bool vertical_flip)
Replace plane B image.
jo_vdp2_draw_rbg0_plane_a
static __jo_force_inline void jo_vdp2_draw_rbg0_plane_a(const bool use_scroll_format_matrix)
Draw plane A.
Definition: vdp2.h:403
jo_vdp2_compute_nbg0_line_scroll
void jo_vdp2_compute_nbg0_line_scroll(unsigned short offset)
Compute NBG0 horizontal line scroll effect using specific offset.
jo_nbg2_print
void jo_nbg2_print(int x, int y, char *str)
NBG2 Print implementation.
JO_VDP2_SCXIN0
#define JO_VDP2_SCXIN0
Definition: sega_saturn.h:294
jo_vdp2_set_nbg1_image
void jo_vdp2_set_nbg1_image(const jo_img *const img, const unsigned short left, const unsigned short top)
Set NBG1 bitmap image.
JO_VDP2_ZMYDN0
#define JO_VDP2_ZMYDN0
Definition: sega_saturn.h:301
jo_disable_all_screens_transparency
void jo_disable_all_screens_transparency(void)
Disable all screens transparency.
jo_vdp2_set_rbg0_plane_a_8bits_image
void jo_vdp2_set_rbg0_plane_a_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip)
Setup plane A.
jo_vdp2_set_nbg2_8bits_image
void jo_vdp2_set_nbg2_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG2 image.
jo_vdp2_zoom_nbg0
static __jo_force_inline void jo_vdp2_zoom_nbg0(const float factor)
Zoom NBG0.
Definition: vdp2.h:283
jo_vdp2_put_pixel_bitmap_nbg1
static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1(const int x, const int y, const jo_color color)
Put pixel in NBG1 using color.
Definition: vdp2.h:328
jo_nbg3_print
void jo_nbg3_print(int x, int y, char *str)
NBG3 Print implementation.
jo_vdp2_clear_bitmap_nbg1
void jo_vdp2_clear_bitmap_nbg1(const jo_color color)
Clear NBG1 bitmap.
jo_vdp2_put_pixel_bitmap_nbg1_rgb
static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1_rgb(const int x, const int y, unsigned char r, unsigned char g, unsigned char b)
Put pixel in NBG1 using composite color.
Definition: vdp2.h:340
jo_enable_screen_mozaic
static __jo_force_inline void jo_enable_screen_mozaic(const jo_scroll_screen screens, const short x, const short y)
Enable mozaic effect for scroll screen.
Definition: vdp2.h:435
jo_disable_all_screen_mozaic
static __jo_force_inline void jo_disable_all_screen_mozaic(void)
Disable mozaic effect for all scroll screen.
Definition: vdp2.h:443
JO_VDP2_SCYIN0
#define JO_VDP2_SCYIN0
Definition: sega_saturn.h:296
jo_float2fixed
static __jo_force_inline jo_fixed jo_float2fixed(const float x)
Convert float to jo engine fixed (avoid usage of GCC Soft Float)
Definition: math.h:433
JO_VDP2_ZMXDN0
#define JO_VDP2_ZMXDN0
Definition: sega_saturn.h:299
jo_vdp2_enable_rbg0
void jo_vdp2_enable_rbg0(void)
Enable 3D planes.
jo_img
15 bits image struct
Definition: types.h:226
JO_VDP2_ZMXIN0
#define JO_VDP2_ZMXIN0
Definition: sega_saturn.h:298
jo_vdp2_disable_nbg0_line_scroll
void jo_vdp2_disable_nbg0_line_scroll(void)
Disable NBG0 horizontal line scroll effect.
jo_vdp2_set_rbg0_plane_b_8bits_image
void jo_vdp2_set_rbg0_plane_b_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip)
Setup plane B.
jo_scroll_screen
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition: types.h:316