-
-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Labels
Description
Since you can replace the GRAPHX.8xv file you send to your calculator, why not provide a "hardened" version of GraphX specifically for developers. This hardened version would print to the CEmu debug console when attempting to read or write a pixel out of bounds.
There are two ways we can implement this:
- print to the CEmu console and nothing else
- add a
gfx_SetErrorHandler(void (*)(struct gfx_error_data*))routine that will be called on out of bounds or etc
One was I also thought of is having macros that call a function when building the debug graphx version.
; void gfx_Sprite_NoClip(const gfx_sprite_t *sprite, uint24_t x, uint8_t y);
gfx_Sprite_NoClip:
DEBUG(gfx_Sprite_NoClip)
ld iy, 0
add iy, sp
ld hl, (CurrentBuffer)void debug_gfx_Sprite_NoClip(
void* caller_return_address,
const gfx_sprite_t *sprite, uint24_t x, uint8_t y
) {
if (sprite == NULL) {
dbg_printf(
"caller(%p): gfx_Sprite_NoClip: "
"sprite is NULL\n",
caller_return_address
);
jump(caller_return_address);
}
if (x >= GFX_LCD_WIDTH || y >= GFX_LCD_HEIGHT) {
dbg_printf(
"caller(%p): gfx_Sprite_NoClip: "
"out of bounds (sprite = %p, x = %d, y = %d)\n",
caller_return_address,
sprite, x, y
);
jump(caller_return_address);
}
// OK
return;
}Reactions are currently unavailable