Bypass navigation menu
RGB Classic Games
Keeping the classics alive
Currently hosting 566 great games!
Return to index

CHAPTER 3 - ASSEMBLER Programming Interface

This chapter gives the technical details of the GRAFIX package. It will give you the necessary information to write an ASSEMBLY language interface for the programming language you are working with. I'm going to assume that anyone who reads this chapter already knows how to program in 80x86 ASSEMBLY language. If you don't then I suggest that you skip this section. It probably will confuse you more than help.

An ASSEMBLY language interface for GRAFIX is the key to writing an interface in another programming language. The BASIC and PASCAL interfaces provided with the package are written in ASSEMBLER. GRAFIX is a memory resident program, all requests to it are done through the video BIOS interrupt. The AH register contains the hexadecimal value EE which indicates to GRAFIX that a function request is about to be made. The AL register contains the function number. The remaining registers BX, CX, DX, SI, DI, and DS contain the parameters of the requested function. For example, if you wanted to draw a solid green box on screen from 0, 0 - 319, 199 the function call would look like this:

        MOV     AX,0EE11H       ;Draw solid box function
        MOV     BX,0            ;X1 location in BX
        MOV     CX,0            ;Y1 location in CX
        MOV     SI,319          ;X2 location in SI
        MOV     DI,199          ;Y2 location in DI
        MOV     DX,2            ;Box color in DX
        INT     10H             ;Call GRAFIX

The next section of this chapter will list each of the GRAFIX functions in numerical order. The format of each function listing is as follows:

Title
Function number
Description
Register entry values
Register exit values
Example
Comments

The title is the name I use for the function in the ASSEMBLY language source file, it is just listed here for reference purposes. The function number is the the value for the AL register, it is listed in decimal format. The description explains what each function does. The register entry values are the values required to execute the function. The exit values are any register values that the function might return to your program. The example is an ASSEMBLY language code fragment showing a call to GRAFIX for that function. The comments section is optional and is included only where I feel extra clarification is needed. Entry values for the AX register for each function are in hexadecimal.

ClearScreen Clears the screen viewport to the current background color.
ColorEnable Turns the color enable signal on or off.
SetColor Sets the current drawing, text, or background color.
GetColor Returns the current drawing, text, or background color.
SetAspect Sets the vertical and horizontal elements of the aspect ratio used to draw circles.
GetAspect Returns the current horizontal and vertical portions of the aspect ratio.
Point Plots individual points onto the screen using the current drawing color.
GetPoint Returns the current color of the point at the specified X, Y position.
MoveTo Updates the current X, Y position by replacing the previous X, Y values.
MoveRel Updates the current X, Y position by adding to the previous X, Y values.
GetXY Returns the current X, Y position.
Line Draws a line starting at the upper left X, Y position to the lower right X, Y position using the current drawing color.
LineTo Draws a line from the current X, Y position to specified X, Y position using the current drawing color.
LineRel Draws a line from the current X, Y position adding the number of points horizontally and vertically to get the ending X, Y position. The line is drawn using the current drawing color.
DrawBox Draws a line box starting at the upper left X, Y position to the lower right X, Y position using the specified color.
Circle Draws a circle centered at the specified X, Y position using the specified radius, and current drawing color.
Paint Paints irregular shapes starting at the specified X, Y position using the specified fill color stopping at the specified boundary color.
FillBox Draws a solid box starting at the upper left X, Y position to the lower right X, Y position using the specified color.
SetPalette Sets the specified palette register to the specified color.
PaletteUsing Sets all 16 palette registers using 16 elements of an integer array.
ResetPalette Resets all 16 palette registers to their default state.
Get Stores a graphics image starting at the upper left X, Y position to the lower right X, Y position into an integer array.
Put Transfers an image that was previously stored using the Get function using 1 of 5 actions.
SetCursor Turns the graphics cursor on/off or sets it to full/half size.
GetCursor Returns the current graphics cursor status and size.
SetCursorPos Sets the current graphics cursor position in text format for use with the 'PrintString' function.
GetCursorPos Returns the current graphics cursor position in text format.
PrintString Prints a text string on the graphics screen starting at the current cursor position using the current text color.
Animate Animates an image doing both the initial transfer and final erase all in one step. The delay is the amount of time to pause between the initial transfer and final erase of the image. Use this to minimize flickering.
PointC Plots individual points onto the screen using the specified color.
LineC Draws a line starting at the upper left X, Y position to the lower right X, Y position using the specified color.
LineToC Draws a line starting at the current X, Y position to specified X, Y position using the specified color.
LineRelC Draws a line from the current X, Y position adding the number of points horizontally and vertically to get the ending X, Y position. The line is drawn using the specified color.
CircleC Draws a circle centered at the specified X, Y position using the specified radius, color.
DrawBoxC Draws a line box starting at the upper left X, Y position to the lower right X, Y position using the current drawing color.
FillBoxC Draws a solid box starting at the upper left X, Y position to the lower right X, Y using the current drawing color.
XorPoint XORs individual points onto the screen using the current drawing color.
XorPointC XORs individual points onto the screen using the specified color.
XorLine XORs a line starting at the upper left X, Y position to the lower right X, Y position using the current drawing color.
XorLineC XORs a line starting at the upper left X, Y position to the lower right X, Y position using the specified color.
XorLineTo XORs a line from the current X, Y position to specified X, Y position using the current drawing color.
XorLineToC XORs a line from the current X, Y position to specified X, Y position using the specified color.
XorLineRel XORs a line from the current X, Y position adding the number of points horizontally and vertically to get the ending X, Y position. The line is drawn using the current drawing color.
XorLineRelC XORs a line from the current X, Y position adding the number of points horizontally and vertically to get the ending X, Y position. The line is drawn using the specified color.
XorDrawBox XORs a line box starting at the upper left X, Y position to the lower right X, Y position using the specified color.
XorDrawBoxC XORs a line box starting at the upper left X, Y position to the lower right X, Y position using the current drawing color.
XorFillBox XORs a solid box starting at the upper left X, Y position to the lower right X, Y position using the specified color.
XorFillBoxC XORs a solid box starting at the upper left X, Y position to the lower right X, Y position using the current drawing color.
XorCircle XORs a circle centered at the specified X, Y position using the specified radius, and current drawing color.
XorCircleC XORs a circle centered at the specified X, Y position using the specified radius, and color.
Ellipse Draws an ellipse centered at the specified X, Y position using the specified major and minor axes and current drawing color.
EllipseC Draws an ellipse centered at the specified X, Y position using the specified major and minor axes and color.
XorEllipse XORs an ellipse centered at the specified X, Y position using the specified major and minor axes and current drawing color.
XorEllipseC XORs an ellipse centered at the specified X, Y position using the specified major and minor axes and color.
SetView Sets the size of the current screen viewport.
GetView Returns the size of the current screen viewport.
ResetView Resets the screen viewport to its default size.
GetScreen Copies the entire screen buffer into an integer array.
PutScreen Copies the entire screen from an integer array into the screen buffer.
SetDisplayPage Sets the current display page which will display on the computer monitor.
GetDisplayPage Returns the current display page.
SetActivePage Sets the current active page which all graphic functions will work with.
GetActivePage Returns the current active page.
PageCopy Copies the source video page to the destination video page.
System This is a blanket routine to incorporate many system level functions of the GRAFIX package.
Sound Generates a sound with the specified frequency, duration, volume, and sound channel.
Noise Generates a periodic or white noise sound using the specified type, volume, and duration.
Delay Delays a program the specified number of clock ticks.
FastTimer Sets the speed of the 8253 timer chip.
ResetTimer Resets the 8253 timer chip to its normal speed which is a setting of 1.
GetTimer Returns the current speed of the 8253 timer chip.