![]() |
Jo Engine 2026.11.6
Jo Sega Saturn Engine
|
Jo Engine core function prototypes. More...
Go to the source code of this file.
Data Structures | |
| struct | __jo_screen_mode |
| The screen now (Internal usage, see jo_core_set_screen_resolution()). More... | |
Macros | |
| #define | jo_core_error(...) |
| #define | __JO_INDEX_IS_WRONG(INDEX, COUNT, WHAT) |
| Check an index given to a function of the engine (Internal usage, JO_DEBUG). | |
| #define | JO_ENGINE_VERSION |
| Jo Engine Version. | |
| #define | jo_core_set_screens_order(screen1, args...) |
| Set scroll screen order between them. | |
Typedefs | |
| typedef void(*) | jo_event_callback(void) |
| Function prototype for jo_core_add_callback(). | |
| typedef void(*) | jo_interrupt_handler(void) |
| Function prototype for interrupt handlers (Internal usage). | |
| typedef void(*) | jo_slave_callback(void) |
| Function prototype for jo_core_exec_on_slave(). | |
| typedef void(*) | jo_slave_job_function(void *argument) |
| Function of a job of the slave CPU (Internal usage). | |
| typedef void(*) | jo_core_error_handler(const char *message, const char *function) |
| Function called by jo_core_error() (see jo_core_set_error_handler()). | |
Functions | |
| void | __jo_core_errorf (const char *function, const char *format,...) __attribute__((cold |
| The message formatted, then __jo_core_error() (Internal usage): one call at each of the hundreds of jo_core_error() (the formatting at each of them was about 4 KB of code), out of the hot code (cold). | |
| void | jo_core_init (const jo_color back_color) |
| Init the engine. | |
| void | jo_core_run (void) |
| Run the game. | |
| int | jo_core_add_vblank_callback (const jo_event_callback callback) |
| Add a callback during VBLANK interruption. | |
| void | jo_core_remove_vblank_callback (const int vblank_event_id) |
| Remove a callback during VBLANK interruption. | |
| int | jo_core_add_callback (const jo_event_callback callback) |
| Add a callback in the game loop on main CPU. | |
| void | jo_core_remove_callback (const int event_id) |
| Remove a callback in the game loop from on main CPU. | |
| int | jo_core_add_slave_callback (const jo_event_callback callback) |
| Add a callback in the game loop on slave CPU. | |
| void | jo_core_remove_slave_callback (const int event_id) |
| Remove a callback in the game loop from on slave CPU. | |
| void | jo_core_set_restart_game_callback (const jo_event_callback callback) |
| Add a callback when A+B+C+Start is pressed on the first control pad (called at each frame while they are pressed). | |
| void | jo_core_set_cd_tray_open_callback (const jo_event_callback callback) |
| Add a callback when the tray of the CD is opened. | |
| void | jo_goto_boot_menu (void) |
| Return to the boot menu. | |
| void | jo_core_exec_on_slave (jo_slave_callback callback) |
| Execute a callback on the slave CPU. | |
| void | jo_core_wait_for_slave (void) |
| Wait until all the callbacks given to jo_core_exec_on_slave() are completed. | |
| int | jo_core_slave_idle_time (void) |
| Balance of the CPUs in the last frame (between the 2 last calls of jo_core_wait_for_slave()). | |
| int | jo_core_master_wait_time (void) |
| The time the master CPU waited for the slave CPU in the last jo_core_wait_for_slave(). | |
| static __jo_force_inline void | jo_core_disable_reset (void) |
| Disable reset button. | |
| static __jo_force_inline void | jo_core_enable_reset (void) |
| Enable reset button (see jo_core_disable_reset()). | |
| void | jo_core_tv_off (void) |
| Turn OFF scroll drawing processing in the monitor. | |
| void | jo_core_tv_on (void) |
| Turn ON scroll drawing processing in the monitor. | |
| bool | jo_core_set_screen_resolution (const int width, const int height) |
| Change the resolution of the screen while the game runs. | |
| void | jo_core_set_screen_single_interlace (const bool enabled) |
| Single density interlace: the image of 224 to 256 lines is displayed in the 2 fields, the second one half a line lower (the look of the games that use it on a CRT: no dark lines between the lines, a slight flicker). | |
| static __jo_force_inline int | jo_core_get_screen_width (void) |
| Get the width of the screen. | |
| static __jo_force_inline int | jo_core_get_screen_height (void) |
| Get the height of the screen. | |
| void | jo_core_set_screen_palette (const int palette_id) |
| Choose the palette of the sprites in the 640 and 704 pixels modes (the frame buffer of the VDP1 has 8 bits per pixel: one palette of 256 colors for all the sprites). | |
| static __jo_force_inline int | jo_core_get_refresh_rate (void) |
| Get the refresh rate of the console. | |
| static __jo_force_inline void | jo_core_exit_to_multiplayer (void) |
| Exit program and return to the Saturn multiplayer (CD player) screen. | |
| static __jo_force_inline void | jo_core_restart_saturn (void) |
| Restart the Saturn. | |
| void | jo_core_suspend (void) |
| Stop the execution until someone press Start. | |
| void | jo_core_set_error_handler (const jo_core_error_handler handler) |
| Call a function instead of the error screen (JO_DEBUG): automated tests count the errors and go on. | |
| static __jo_force_inline char * | jo_get_last_error (void) |
| Get last error. | |
| void | jo_dump_vdp1_registers (void) |
| Dump VDP1 registers. | |
| void | jo_dump_vdp2_registers (void) |
| Dump VDP2 registers. | |
| void | __jo_core_set_screens_order (jo_scroll_screen screen1,...) |
| Screen order (Internal usage). | |
| static __jo_force_inline unsigned int | jo_core_get_vblank_count (void) |
| Get the number of VBLANK since startup (60 per second in NTSC, 50 in PAL). | |
| static __jo_force_inline int | jo_core_get_fps (void) |
| Get the frames per second really shown, measured over the last 2 seconds. | |
| static __jo_force_inline unsigned int | jo_core_get_late_frame_count (void) |
| Get the count of the late frames since startup. | |
Variables | |
| char | __jo_last_error [JO_PRINTF_BUF_SIZE] |
| Error handling (Internal usage). | |
| void | noinline |
| __jo_screen_mode | __jo_screen |
| The screen now (Internal usage). | |
| volatile unsigned int | __jo_core_vblank_count |
| Number of VBLANK since startup (Internal usage). | |
| int | __jo_core_fps |
| Frames per second shown (Internal usage, see jo_core_get_fps()). | |
| unsigned int | __jo_core_late_frames |
| Count of late frames (Internal usage, see jo_core_get_late_frame_count()). | |
Jo Engine core function prototypes.
| struct __jo_screen_mode |
The screen now (Internal usage, see jo_core_set_screen_resolution()).
| Data Fields | ||
|---|---|---|
| short | background_height | |
| short | background_width | The size of the screen in pixels of NBG0 and NBG1 (jo_printf(), the NBG1 bitmap): they are zoomed 2 times in the hi-res and interlace modes. |
| bool | clock_352 | 352 or 704 pixels: the system clock is 28.6 MHz (26.8 MHz otherwise) |
| short | height | |
| short | height_2 | |
| bool | hires | 640 or 704 pixels: the frame buffer of the VDP1 has 8 bits per pixel |
| bool | interlace | 448 to 512 lines: double density interlace |
| bool | single_interlace | Single density interlace (see jo_core_set_screen_single_interlace()). |
| short | width | |
| short | width_2 | |
| #define __JO_INDEX_IS_WRONG | ( | INDEX, | |
| COUNT, | |||
| WHAT ) |
Check an index given to a function of the engine (Internal usage, JO_DEBUG).
| INDEX | Index (int) |
| COUNT | Size of the table: the index must be in [0, COUNT) |
| WHAT | What the index is (a string, in the error) |
| #define jo_core_error | ( | ... | ) |
| #define jo_core_set_screens_order | ( | screen1, | |
| args... ) |
Set scroll screen order between them.
| screen1 | First screen (high priority) |
| args | Other screens |
| #define JO_ENGINE_VERSION |
Jo Engine Version.
| typedef void(*) jo_core_error_handler(const char *message, const char *function) |
Function called by jo_core_error() (see jo_core_set_error_handler()).
| message | The error |
| function | The function of the error |
| typedef void(*) jo_event_callback(void) |
Function prototype for jo_core_add_callback().
| typedef void(*) jo_interrupt_handler(void) |
Function prototype for interrupt handlers (Internal usage).
| typedef void(*) jo_slave_callback(void) |
Function prototype for jo_core_exec_on_slave().
| typedef void(*) jo_slave_job_function(void *argument) |
Function of a job of the slave CPU (Internal usage).
| void __jo_core_errorf | ( | const char * | function, |
| const char * | format, | ||
| ... ) |
The message formatted, then __jo_core_error() (Internal usage): one call at each of the hundreds of jo_core_error() (the formatting at each of them was about 4 KB of code), out of the hot code (cold).
| void __jo_core_set_screens_order | ( | jo_scroll_screen | screen1, |
| ... ) |
Screen order (Internal usage).
| int jo_core_add_callback | ( | const jo_event_callback | callback | ) |
Add a callback in the game loop on main CPU.
| callback | Function name with no parameters and no return value |
| int jo_core_add_slave_callback | ( | const jo_event_callback | callback | ) |
Add a callback in the game loop on slave CPU.
| callback | Function name with no parameters and no return value |
| int jo_core_add_vblank_callback | ( | const jo_event_callback | callback | ) |
Add a callback during VBLANK interruption.
| callback | Function name with no parameters and no return value |
|
static |
Disable reset button.
|
static |
Enable reset button (see jo_core_disable_reset()).
| void jo_core_exec_on_slave | ( | jo_slave_callback | callback | ) |
Execute a callback on the slave CPU.
| callback | Function name with no parameters and no return value |
|
static |
Exit program and return to the Saturn multiplayer (CD player) screen.
|
static |
Get the frames per second really shown, measured over the last 2 seconds.
|
static |
Get the count of the late frames since startup.
|
static |
Get the refresh rate of the console.
|
static |
Get the height of the screen.
|
static |
Get the width of the screen.
|
static |
Get the number of VBLANK since startup (60 per second in NTSC, 50 in PAL).
| void jo_core_init | ( | const jo_color | back_color | ) |
Init the engine.
| back_color | Default background color (colors.h) |
| int jo_core_master_wait_time | ( | void | ) |
The time the master CPU waited for the slave CPU in the last jo_core_wait_for_slave().
| void jo_core_remove_callback | ( | const int | event_id | ) |
Remove a callback in the game loop from on main CPU.
| event_id | Value returned by jo_core_add_callback() |
| void jo_core_remove_slave_callback | ( | const int | event_id | ) |
Remove a callback in the game loop from on slave CPU.
| event_id | Value returned by jo_core_add_slave_callback() |
| void jo_core_remove_vblank_callback | ( | const int | vblank_event_id | ) |
Remove a callback during VBLANK interruption.
| vblank_event_id | Value returned by jo_core_add_vblank_callback() |
|
static |
Restart the Saturn.
| void jo_core_run | ( | void | ) |
Run the game.
| void jo_core_set_cd_tray_open_callback | ( | const jo_event_callback | callback | ) |
Add a callback when the tray of the CD is opened.
| callback | Function name with no parameters and no return value (JO_NULL, by default: back to the multiplayer screen of the BIOS, see jo_core_exit_to_multiplayer()) |
| void jo_core_set_error_handler | ( | const jo_core_error_handler | handler | ) |
Call a function instead of the error screen (JO_DEBUG): automated tests count the errors and go on.
| handler | Function, JO_NULL: the error screen (the default) |
| void jo_core_set_restart_game_callback | ( | const jo_event_callback | callback | ) |
Add a callback when A+B+C+Start is pressed on the first control pad (called at each frame while they are pressed).
| callback | Function name with no parameters and no return value (JO_NULL: back to the multiplayer screen of the BIOS, see jo_core_exit_to_multiplayer()) |
| void jo_core_set_screen_palette | ( | const int | palette_id | ) |
Choose the palette of the sprites in the 640 and 704 pixels modes (the frame buffer of the VDP1 has 8 bits per pixel: one palette of 256 colors for all the sprites).
| palette_id | Palette (jo_create_palette()) |
| bool jo_core_set_screen_resolution | ( | const int | width, |
| const int | height ) |
Change the resolution of the screen while the game runs.
| width | 320, 352, 640 or 704 pixels |
| height | 224 or 240 lines (256 in PAL), or 448 or 480 (512 in PAL): double density interlace |
| void jo_core_set_screen_single_interlace | ( | const bool | enabled | ) |
Single density interlace: the image of 224 to 256 lines is displayed in the 2 fields, the second one half a line lower (the look of the games that use it on a CRT: no dark lines between the lines, a slight flicker).
| enabled | true to enable it, false for the progressive display (default) |
| int jo_core_slave_idle_time | ( | void | ) |
Balance of the CPUs in the last frame (between the 2 last calls of jo_core_wait_for_slave()).
| void jo_core_suspend | ( | void | ) |
Stop the execution until someone press Start.
| void jo_core_tv_off | ( | void | ) |
Turn OFF scroll drawing processing in the monitor.
| void jo_core_tv_on | ( | void | ) |
Turn ON scroll drawing processing in the monitor.
| void jo_core_wait_for_slave | ( | void | ) |
Wait until all the callbacks given to jo_core_exec_on_slave() are completed.
| void jo_dump_vdp1_registers | ( | void | ) |
Dump VDP1 registers.
| void jo_dump_vdp2_registers | ( | void | ) |
Dump VDP2 registers.
|
static |
Get last error.
| void jo_goto_boot_menu | ( | void | ) |
Return to the boot menu.
|
extern |
Frames per second shown (Internal usage, see jo_core_get_fps()).
|
extern |
Count of late frames (Internal usage, see jo_core_get_late_frame_count()).
|
extern |
Number of VBLANK since startup (Internal usage).
|
extern |
Error handling (Internal usage).
|
extern |
The screen now (Internal usage).
| void noinline |