Jo Engine  9
Jo Sega Saturn Engine
core.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2017, 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 #ifndef __JO_CORE_H__
36 # define __JO_CORE_H__
37 
38 #ifdef JO_DEBUG
39 
44 void __jo_core_error(char *message, const char *function);
45 # define jo_core_error(...) do {sprintf(__jo_last_error, __VA_ARGS__); __jo_core_error(__jo_last_error, __FUNCTION__);} while(0)
46 
47 #endif
48 
50 # define JO_ENGINE_VERSION (9.0)
51 
52 /*
53 ** TYPEDEFS
54 */
56 typedef void (*jo_event_callback)(void);
57 
59 typedef void (*jo_slave_callback)(void);
60 
65 void jo_core_init(const jo_color back_color);
66 
70 void jo_core_run(void);
71 
74 void jo_core_suspend(void);
75 
81 int jo_core_add_callback(const jo_event_callback callback);
82 
86 void jo_core_remove_callback(const int event_id);
87 
94 
98 void jo_core_remove_slave_callback(const int event_id);
99 
102 void jo_goto_boot_menu(void);
103 
108 
111 void jo_core_wait_for_slave(void);
112 
116 {
119 }
120 
124 {
127 }
128 
129 #ifdef JO_DEBUG
130 
135 {
136  return (__jo_last_error);
137 }
138 
139 #ifdef JO_DEBUG
140 
143 void jo_dump_vdp1_registers(void);
144 
147 void jo_dump_vdp2_registers(void);
148 
149 #endif
150 
151 #endif
152 
153 #endif /* !__JO_CORE_H__ */
154 
155 /*
156 ** END OF FILE
157 */
void jo_dump_vdp1_registers(void)
Dump VDP1 registers.
static __jo_force_inline void jo_smpc_begin_command(void)
Definition: smpc.h:150
unsigned short jo_color
15 bits color type
Definition: types.h:39
static __jo_force_inline void jo_core_enable_reset(void)
Enable reset button.
Definition: core.h:123
void(* jo_slave_callback)(void)
Function prototype for jo_core_exec_on_slave()
Definition: core.h:59
static __jo_force_inline void jo_smpc_end_command(jo_smpc_command command)
Definition: smpc.h:155
void jo_dump_vdp2_registers(void)
Dump VDP2 registers.
void jo_core_suspend(void)
Stop the execution until someone press Start.
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: conf.h:154
void jo_core_remove_slave_callback(const int event_id)
Remove a callback in the game loop from on slave CPU.
int jo_core_add_slave_callback(const jo_event_callback callback)
Add a callback in the game loop on slave CPU.
void jo_goto_boot_menu(void)
Return to the boot menu.
void jo_core_remove_callback(const int event_id)
Remove a callback in the game loop from on main CPU.
void jo_core_wait_for_slave(void)
Wait until slave callback is completed.
void jo_core_init(const jo_color back_color)
Init the engine.
static __jo_force_inline void jo_core_disable_reset(void)
Disable reset button.
Definition: core.h:115
void jo_core_exec_on_slave(jo_slave_callback callback)
Execute a callback on the slave CPU.
char __jo_last_error[JO_PRINTF_BUF_SIZE]
Error handling (Internal usage)
#define JO_PRINTF_BUF_SIZE
Max character in available in jo_printf()
Definition: conf.h:147
static __jo_force_inline char * jo_get_last_error(void)
Get last error.
Definition: core.h:134
void jo_core_run(void)
Run the game.
Disables NMI requests to be sent when the Reset button is pressed.
Definition: smpc.h:78
int jo_core_add_callback(const jo_event_callback callback)
Add a callback in the game loop on main CPU.
void(* jo_event_callback)(void)
Function prototype for jo_core_add_callback()
Definition: core.h:56
void __jo_core_error(char *message, const char *function)
Enables NMI requests to be sent when the Reset button is pressed.
Definition: smpc.h:76