Lab5
 All Data Structures Functions Variables Groups
Functions
lab5

Functions

void * test_init (unsigned short mode, unsigned short delay)
 Tests initialization of video card in graphics mode.
int test_square (unsigned short x, unsigned short y, unsigned short size, unsigned long color)
 Tests drawing a square with a given color.
int test_line (unsigned short xi, unsigned short yi, unsigned short xf, unsigned short yf, unsigned long color)
 Tests drawing a line segment with specifed end points and color.
int test_xpm (unsigned short xi, unsigned short yi, char *xpm[])
 Tests drawing XPM on the screen at specified coordinates.
int test_move (unsigned short xi, unsigned short yi, char *xpm[], unsigned short hor, short delta, unsigned short time)
 Tests moving sprite on the screen along horizontal/vertical axes.
int test_controller ()
 Tests retrieving VBE controller information (VBE function 0x0)

Detailed Description

Functions for outputing data to screen in graphics mode

Function Documentation

void* test_init ( unsigned short  mode,
unsigned short  delay 
)

Tests initialization of video card in graphics mode.

Uses the VBE INT 0x10 interface to set the desired graphics mode, and resets Minix's default text mode after a short delay. Before exiting, displays on the console the physical address of VRAM in the input graphics mode.

Parameters
mode16-bit VBE mode to set
delaydelay in seconds after which returns to text mode
Returns
Virtual address VRAM was mapped to. NULL, upon failure.
int test_square ( unsigned short  x,
unsigned short  y,
unsigned short  size,
unsigned long  color 
)

Tests drawing a square with a given color.

Tests drawing a square with the specified size and color, at the specified coordinates (which specify the upper left corner (ULC)) in video mode 0x105

Parameters
xhorizontal coordinate of ULC, starts at 0 (leftmost pixel)
yvertical coordinate of ULC, starts at 0 (top pixel)
sizeof each side in pixels
colorcolor to set the pixel
Returns
0 on success, non-zero otherwise
int test_line ( unsigned short  xi,
unsigned short  yi,
unsigned short  xf,
unsigned short  yf,
unsigned long  color 
)

Tests drawing a line segment with specifed end points and color.

Tests drawing a line segment with the specified end points and the input color, by writing to VRAM in video mode 0x105

Parameters
xihorizontal coordinate of "first" endpoint, starts at 0 (leftmost pixel)
yivertical coordinate of "first" endpoint, starts at 0 (top pixel)
xfhorizontal coordinate of "last" endpoint, starts at 0 (leftmost pixel)
yfvertical coordinate of "last" endpoint, starts at 0 (top pixel)
colorcolor of the line segment to draw
Returns
0 upon success, non-zero upon failure
int test_xpm ( unsigned short  xi,
unsigned short  yi,
char *  xpm[] 
)

Tests drawing XPM on the screen at specified coordinates.

Tests drawing a sprite from an XPM on the screen at specified coordinates by writing to VRAM in video mode 0x105

Parameters
xihorizontal coordinate of upper-left corner, starts at 0 (leftmost pixel)
yivertical coordinate of upper-left corner, starts at 0 (top pixel)
xpmarray with XPM (assuming indexed color mode)
Returns
0 upon success, non-zero upon failure
int test_move ( unsigned short  xi,
unsigned short  yi,
char *  xpm[],
unsigned short  hor,
short  delta,
unsigned short  time 
)

Tests moving sprite on the screen along horizontal/vertical axes.

Tests moving a XPM on the screen along horizontal/vertical axes, at the specified speed, in video mode 0x105

Parameters
xihorizontal coordinate of upper-left corner, starts at 0 (leftmost pixel)
yivertical coordinate of upper-left corner, starts at 0 (top pixel)
xpmarray with XPM (assuming indexed color mode)
horwhether the movement is in the horizontal direction (!= 0) or in the vertical direction (== 0)
deltamovement in along specified direction in pixels
timeduration in seconds of the movement
Returns
0 upon success, non-zero upon failure
int test_controller ( )

Tests retrieving VBE controller information (VBE function 0x0)

Tests retrieving VBE controller information (VBE function 0x0) and its parsing. Upon its invocation it should provide at least the following information:

  • Capabilities
  • List of mode numbers supported
  • Total memory
Returns
0 upon success, non-zero upon failure