#include #include "vga.h" #include "data.h" #include "map.h" static const uint8_t *cmap; void map_init(const uint8_t map[]) { cmap = map; } void map_render() { const uint8_t *tiles = binary_tiles_start; Rect src = { 0, 0, 160, 48 }; Rect dst = { 0, 0, 8, 8 }; for (uint8_t y = 0; y < MAP_H; y++) for (uint8_t x = 0; x < MAP_W; x++) { dst.x = x * MAP_TILE_W; dst.y = y * MAP_TILE_H + MAP_OFFS_Y; uint8_t t = cmap[x + y * MAP_W]; src.x = (t % MAP_TILESET_COLS) * MAP_TILE_W; src.y = (t / MAP_TILESET_COLS) * MAP_TILE_H; blitrc(binary_tiles_start, &src, &dst); } }