Skip to content

Lab 5 Tasks

Requested Functions

  • int video_set_mode(uint16_t mode)
  • int video_map_framebuffer(void)
  • int video_fill_rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t color)
  • int video_draw_xpm(const char *const *xpm, int16_t x, int16_t y)
  • int video_present(void)

Guided Gaps

  • Store mode info for later drawing.
  • Decide how repeated mode setup behaves.
  • Clip drawing before writing pixels.
  • Keep color packing clear.
  • Parse enough XPM for course sprites.

IMPORTANT

Drawing past the framebuffer is memory corruption. Clip rectangles and sprites before writing.

Common Mistakes

  • Assuming pitch equals visible row width.
  • Forgetting to map before drawing.
  • Writing colors in the wrong byte order.
  • Ignoring negative sprite coordinates.

Next: checks and references.

Course/docs licensed CC BY 4.0. Code licensed MIT.