User Tools

Site Tools

Translations of this page:


This is the set of functions made available by the library. Their use is bound to the loading of the midres library. Some of these features are available for all platforms (some require the overlay to be enabled). Others, however, are only available for those configurations that have enough contiguous memory.


These functions take care of initializing and deinitializing the graphics subsystem for the various platforms. The mr_init function must always be called, before each call. The call to mr_cleanup is optional, and only necessary if you want to leave the system “clean” after execution.

  • mr_init - initialize the graphics subsystem
  • mr_cleanup - release the graphics subsystem


These functions are only needed if you want to ensure support from the overlay system. They must be used before calling those certain functions.

  • mr_use_screen - enable screen management functions and loading
  • mr_use_screen2 - enable screen management functions and saving
  • mr_use_drawing - enable primitive drawing functions (v1.0)
  • mr_use_drawing2 - enable primitive drawing functions (v1.1)
  • mr_use_bitblit - enable bit blitting functions (v1.2)


These functions are required for manipulating entire midres screens. They take care of loading, saving, compressing and decompressing images from files to certain screens. They also allow you to indicate which screen should be shown and which to write to (where the hardware has more than one screen).

  • mr_clear - clear the midres screen
  • mr_show - show a midres screen
  • mr_enable - set a midres screen as output
  • mr_load - load a midres screen (luminance/mixels only)
  • mr_save - save a midres screen (luminance/mixels only)
  • mr_load_color - load a midres screen (color only)
  • mr_save_color - save a midres screen (color only)
  • mr_compress - compress a midres screen
  • mr_uncompress - uncompress a midres screen
  • mr_pack - pack a midres screen
  • mr_unpack - unpack a midres screen


These functions take care of drawing and coloring mixels on the screen. Version 1.0 is suitable for systems with low memory and for integration with other enviroments (i.e. img2midres utility). The two versions are compatible, in the sense that they act on the same midres screens and can therefore be mixed.


  • mr_psetop - set/clear/invert a mixel at given coordinates
  • mr_pcolorop - set color at given coordinates
  • mr_ink - set implicit color for a given screen
  • mr_pset - set a mixel at given coordinates
  • mr_pclear - clear a mixel at given coordinates
  • mr_pinvert - invert a mixel at given coordinates
  • mr_pcolor - set color at given coordinates
  • mr_psetc - set a mixel at given coordinates with implicit color


  • mr_clear_bitmap - clear the bitmap to BLACK
  • mr_clear_to_color - fill the bitmap to a given color
  • mr_putpixel - set a pixel with the given color
  • mr_getpixel - get the color for a pixel
  • mr_vline - draw a vertical line with the given color
  • mr_hline - draw an horizontal line with the given color
  • mr_line - draw a line with the given color
  • mr_triangle - draw a triangle with the given color
  • mr_polygon - draw a polygon with the given color
  • mr_rect - draw a rectangle with the given color
  • mr_circle - draw a circle with the given color


These functions deal with copying operations of rectangular screen areas of the same size. The areas can be two screens or a memory area towards one screen. Copying can also take place with the application of a logical operation (AND, OR or XOR) or with the effect of transparency (“off” mixels are considered transparent). These functions can be used to implement a rudimentary form of software sprite.

  • mr_copy - generic copy of two areas (mixels and colors)
  • mr_blit_from_screen - copy (blit) an area from the screen to memory
  • mr_blit_to_screen - copy (blit) an area from memory to screen


These functions implement a double buffering mechanism: this is a way to avoid flickering during animations, and consists of drawing on one screen while the other is shown to the user. The screens are exchanged with each other only when the frame needs to be updated.

  • mr_doublebuffer_init - enable support for double buffering
  • mr_doublebuffer_switch - swap the visible screen with the enabled screen


These functions deal with defining, drawing and modifying the “tiles”.

  • mr_tileset_visible - set the actual visibile tileset
  • mr_tileset_load - load a tileset
  • mr_tileset_copy - copy a tileset over another
  • mr_tile_redefine - redefine a single tile using the given data
  • mr_tile_prepare_horizontal - redefine a set of tiles to allow horizontal movement
  • mr_tile_moveto_horizontal - put a tile precisely on the screen (eventually) moving horizontally
  • mr_tile_prepare_vertical - redefine a set of tiles to allow vertical movement
  • mr_tile_moveto_vertical - put a tile precisely on the screen (eventually) moving vertically
  • mr_puttile - put a tile on the screen
  • mr_cleartile - clear a tile on the screen
  • mr_gettile - get a tile from the screen