#include <revolution/os.h> void ASSERT(int expression);
| expression | Conditional expression to check when the _DEBUG macro is defined. |
|---|
None.
When the _DEBUG macro is defined, ASSERT displays an assert failure message if expression is FALSE. A message that includes the text in expression is output to the output port, and the program is halted.
If the _DEBUG macro is not defined, ASSERT will do nothing.
Tips: By default, the output of the assertion failure message goes to the serial port of the development hardware. In the final phase of game development, you should output to the TV screen rather than the serial port. When an assertion failure occurs, the following OSPanic function in os[D].a is called.
|
It is difficult to implement a generic print function for the TV screen due to various graphics configurations. Therefore, you are free to implement a game-specific version of the OSPanic function and replace the one implemented in os[D].a. Since the OSPanic function is defined to be weak in os[D].a, the game-specific OSPanic function takes precedence over the default version in os[D].a.
The following code is an example implementation of the OSPanic function that shows the assertion failure message on TV screen using the OSFatal function.
|
Error Functions, ASSERTMSG, OSHalt, OSReport
2006/03/01 Initial version.
CONFIDENTIAL