/* Kitsune's Curse Copyright (C) 2020-2023 Juan J. Martinez This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _SPLIB_H #define _SPLIB_H #include // this is 160x160; 8x8 pixels tiles #define TMW 20 #define TMH 20 #define TW 8 #define TH 8 // All the buffer must be under 0x8000 #define BUFF_ADDR 0x0100 // CONFIGURE ** #define SCREEN_ADDR(x, y) ((int)(0xc000 + x + ((y / 8) * 80) + ((y % 8) * 2048))) #define DIRTY_BIT 0x8000 #define ADDR_BITS 0x7fff struct st_tile { uint16_t baddr; const uint8_t *t; uint16_t saddr; struct st_tile *n; }; void init_tiles(); void update_screen(); void validate_screen(); void invalidate_screen(); struct st_tile *get_tile_xy(uint8_t x, uint8_t y); void invalidate_tile(struct st_tile *st) __z88dk_fastcall; uint8_t is_invalid_tile(struct st_tile *st) __z88dk_fastcall; uint8_t is_invalid_tile2(struct st_tile *st) __z88dk_fastcall; void erase_tile(struct st_tile *st) __z88dk_fastcall; void link_buffer(struct st_tile *st) __z88dk_fastcall; void link_buffer_xy(uint8_t x, uint8_t y); void put_tile(const uint8_t *t, struct st_tile *st); void put_sprite4(const uint8_t *s, uint8_t x, uint8_t y, uint8_t th, uint8_t inv); void erase_sprite(uint8_t x, uint8_t y, uint8_t th); void fill_screen(const uint8_t *t) __z88dk_fastcall; // misc void clear_screen(); void wait_vsync(); void set_hw_border(uint8_t c) __z88dk_fastcall; void set_hw_ink(uint8_t ink, uint8_t c); void pad_numbers(uint8_t *s, uint8_t limit, uint16_t number); uint16_t screen_addr(uint16_t x, uint16_t y); uint8_t abs_sub(uint8_t a, uint8_t b); // require spfont, 63 chars (starting on 31) void set_text_ink(uint8_t c, uint8_t c2, uint8_t c3); void put_text(const char *s, uint8_t x, uint8_t y); #endif // _SPLIB_H