prog_api.h 705 B

123456789101112131415161718192021222324
  1. /* API passed to loaded program at PROGRAM_API_ADDR. Used by run.c and prog.c. */
  2. #ifndef PROG_API_H
  3. #define PROG_API_H
  4. #define PROGRAM_API_ADDR 0x20F00
  5. #define IO_KEY_ESC 0x1B
  6. /* Function pointer types for the program API. */
  7. typedef void (*prog_draw_string_xy_t)(unsigned int x0, unsigned int y0,
  8. const char *str, unsigned int r_fg, unsigned int g_fg, unsigned int b_fg,
  9. int transparent_bg);
  10. typedef unsigned int (*prog_get_cols_t)(void);
  11. typedef unsigned int (*prog_get_rows_t)(void);
  12. typedef int (*prog_poll_key_t)(void);
  13. struct prog_api {
  14. prog_draw_string_xy_t draw_string_xy;
  15. prog_get_cols_t get_cols;
  16. prog_get_rows_t get_rows;
  17. prog_poll_key_t poll_key;
  18. };
  19. #endif