#pragma once

constexpr inline int div(int n, int d)
{
  return (n + 32 - 1) / 32;
}

struct framebuffer {
  int px_width;
  int px_height;

  framebuffer(int width, int height)
    : px_width(width), px_height(height)
  {}

  int tile_width() {
    return div(px_width, 32);
  }
  int tile_height() {
    return div(px_height, 32);
  }
};

const int bytes_per_pixel = 2;

extern struct framebuffer framebuffer;

void framebuffer_init();
void scaler_init();
void spg_set_mode_720x480();
void spg_set_mode_640x480();
void core_param_init();
