Description of subroutines contained in GLIB.LIB

List

Object_Name     Routine name    Brief description of the subroutine
-------		------------	-----------------------------------------------
ANGLE           ANGLE           Calculate the angle given delta_y & delta_X 
ASC2BDS         ASC2BDS         Convert ASCII to binary. For data segment use
ASCI2BIN        ASCI2BIN        Convert ASCII in keyboard buffer to binary num
ATOF   *        ATOF            Convert ASCII input to a floating point number
BEZIER          BEZIER          Draws a Bezier curve using curve coordinate data
BLINE           BLINE           Calculate best staight line of a set of points
CHKLINE         CHECK_LINE      Checks if a horizontal lines been drawn already
CHKEQUIP        CHECK_EQUIP     Checks for presence of co_processor,mouse etc
CHORDS          CHORDS          Draws 4 symmetric horizontal chords
CIRCLE          CIRCLE          Draws a circle in various graphics modes
CLIP            CLIP            Clips a line to fit within a rectangular window
DELAY           DELAY           Delay pgm for N clock ticks
DISP_DEC        DISP_DEC        Display signed integer number in ASCII
DRAW_BOX        DRAW_BOX        Draws a rectangular box in graphics mode 
MHANDLER        DRAW_CURSOR     Draws a special mouse cursor for CAD type pgms
DRAWLINE        DRAWLINE        Draws a line in various graphics modes
ELLIPSE         ELLIPSE         Draws an ellipse using the Keintzle algorithm 
FALOG  *        FALOG           Calculates a common antilog
FILLBOX         FILL_BOX        Draws a rectangular box filled with colour
FILLCIRC        FILL_CIRCLE     Draws a filled in circle
FILLELPS        FILL_ELLIPSE    Draw a filled in ellipse
FILLPOLY        FILL_POLYGON    Draws a polygon filled with colour
FRAME           FRAME           Draws a frame showing the accessible screen area
FTAN   *        FTAN            Calculates tan(x)
FTOA   *        FTOA            Converts a floating point number to ASCII
GETCOORD        GET_COORDINATES Obtain the mouse cursor coordinates
GET_NORM        GET_NORMALISATION  Gets the screen normalisation factor
GET_P16         GET_P16         Reads screen pixel.SVGA 16 color VBE modes
GET_P256        GET_P256        Reads screen pixel.SVGA 256 colour VBE modes
HOREFILL        HOREFILL        Used in the filling in of an ellipse
INVERT_S        INVERT_SCREEN   Makes an inversion of a selected screen window 
LINE            LINE            Draw line using Breshenhams algorithm.All Slopes
LINE_TO         LINE_TO         Draw a line from last location to a new X2,Y2
MAKECIRC        MAKE_CIRCLE     Make a circle interactively using the mouse
MEAN            MEAN            Calculates mean of an array of F.Point numbers
MHANDLER        MOUSE_HANDLER   Provides a user cursor for use in VGA/SVGA modes
MIRROR_S        MIRROR_SCREEN   Makes a mirror-image of a selected screen window
NORMWRIT        NORMWRIT        BIOS routine to write a pixel
PADRCGA2        PIXEL_ADDR_CGA2 Calculates the pixel address for video mode CGA2
PADRMCGA        PIXEL_ADDR_MCGA         "       "       "       "       "   MCGA
PADR_VGA        PIXEL_ADDR_VGA          "       "       "   for 16 bit VGA modes
PADR_256        PIXEL_ADDR_256          "       "       "   for 256 "   "   "
PLOT4           PLOT4           Draws 4 symetrically placed pixels on an ellipse
PLOTCGA2        PLOT_CGA2       Writes a pixel in CGA2 mode
PLOTMCGA        PLOT_MCGA       "       "       " MCGA mode
PLOT_VGA        PLOT_VGA        "       "       in  16 bit VGA mode
PLOT_256        PLOT_256        "       "       in 256 bit VGA mode		
POLYGON         POLYGON         Draws a polygon interactively using the mouse 
PRINTSCR        PRINT_SCREEN    Transfer screen image to PCL compatible printer
PUT_P16         PUT_P16         VBE Pixel writing routine. 16 Colours
PUT_P256        PUT_P256        VBE     "       "       " 256  "
PUT_P32K        PUT_P32K        VBE     "       "       " 32K & 64K colours 
PUT_P16M        PUT_P16M        VBE     "       "       " 16.7 million	" 
RANDOM          RANDOM          Generate a pseudo random number
RESTORE         RESTORE_CONTROLLER Graphics Controller regs to default state
ROTATE          ROTATE          Calculate new coordinates for rotated point X,Y	
RUBBER_B        RUBBER_BAND     Draws a rubber_band line & obtains line coords
SCANLINE        SCANLINE        Searches data in Data Segment for non-white char
SETBANK         SETBANK         Sets the read/write bank in video memory
SETVMODE        SET_V_MODE      As SETMODE, but no assignment for pixel reading 
SETVBEM         SET_VBE_MODE    Sets a VBE video mode and initialises parmblock 
SHRINK          SHRINK          Reduce memory grabbed by DOS to minimum 
SORT            SORT            Sort integer numbers into ascending order
SQUARE          SQUARE          Draw a square in graphics mode 
SYMPOLY         SYMETRIC_POLYGON Construct a symmetric polygon using the mouse
SYM_PLOT        SYM_PLOT        Plots 8 symmetric points. (used by CIRCLE)
TEMPBEZ         TEMP_BEZIER     Draws interactively, a temporary Bezier curve 
TEMPBOX         TEMPBOX         Draws a rubber-band style box
TEMPCIRC        TEMP_CIRCLE     Draws a temporary circle for CAD type programs 
TEMPLINE        TEMP_LINE       Draw a straight line in rubber_band fashion
TOGGLE          TOGGLE_CURSOR   Shows or hides a special graphics cursor 	
WRITCHAR        WRITE_CHAR      Writes a character to the screen
WRITEHEX        WRITE_HEX       Writes a number in hex form (2 digits)
WRITHEXD        WRITE_HEX_DIGIT	Converts a hex digit and writes to screen 
WRITEDEC        WRITE_DECIMAL   Write out an unsigned number in decimal form

The 4 subroutines marked * are by an unknown programmer and were found on a BBS. Object modules only.


Details of the calling procedures
ANGLE Function Calculates the angle for a given delta_Y & delta_X Entry: AX Delta_Y DX Delta_X BX Address containing the normalisation factor Return: st(0) Angle in radians Note: Assumes the presence of a coprocessor ASC2BDS Function Convert a decimal number entered in ASCII form into a binary value. For data segment use. Entry: DS:SI Points at the character Return: AX Returns the binary number SI Points to the character immediately following the read in number. Note Carry set if there is an error See also the ASCI2BIN routine. ASCI2BIN Function Convert a string of decimal characters to a binary word Entry: DX Address of buffer Return: AX Converted number Carry set if error, clear otherwise. Note: Maximum positive number is 65535 (FFFFh) Maximum negative number is 32767 (7FFFh) ATOF Function Convert an ASCII string to a floating point number Entry: DS:SI Address of string, which has the form [sign][digits][.[digits]][E|e[sign][exp]] e.g -123.456E-10 Leading blanks or tabs are ignored Return: ST(0) Binary floating point number DS:SI Address+1 of terminator Note 1. The Co_processor should be previously initialised 2. There is no warning in the event of overflow 3. The 1st invalid character causes termination BEZIER Function Draws a Bezier curve using curve coordinate data Entry: BX Points at the curve coordinate data [BX] X coord for the 1st end point (x0) [BX+2] Y " " " (y0) [BX+4] X coord for 1st control point (x1) [BX+6] Y " " " (y1) [BX+8] X coord for 2nd control point (x2) [BX+10] Y " " " (y2) [BX+12] X coord for the 2nd end point (x3) [BX+14] Y " " " (y3) SI Contains address of the graphics parmeter block ES Contains the video memory address Uses: Subroutine LINE_TO BLINE Function Calculates the best straight line though a set of points Returns the slope, Y intercept, standard deviation of the slope and also the calculated values for Y Entry: ES Address of parameter block in allocated memory [ES] WORD. No of data points [ES+2] Start of a 300 DWORD buffer for the X,Y,W values of up to 100 data points. W is a weighting value [ES+1202] Start of a 100 DWORD buffer to hold the best straight lines predicted values for Y [ES+1602] DWORD Storage for X0 in constrained case [ES+1606] DWORD " Y0 " [ES+1610] DWORD Calculated slope [ES+1614] DWORD Calculated Y intercept [ES+1618] DWORD Calculated Std deviation of slope Note: Currently the limit is 100 data points. Expand the buffer if more data points need to be processed. CHECK_EQUIP Function Checks for the presence of a co_processor the mouse Entry: Nothing Return: Carry set if harware is deficient Note: Also Prints message about the deficient hardware Uses: Subroutine WRITE_STRING CHECK_LINE Function For use by graphics programs. Checks to see if a horizontal line has previously been drawn at the specified line location. Entry DX = Line location External LINE_STATUS word Return Carry set if line exists Carry clear if line doesn't exist Note: Line_status is an 80 word external buffer, which holds the bit settings for all possible lines up to 1280 line resolution. CHORDS Function Draws 4 symetric horizontal chords in a circle Entry: CX,DX = X & Y coordinates of a symetric point on the circle circumference. SI = The address of the circle parameter block. External NORMALISE dword, LINE_STATUS word Uses: Subroutine CHECK_LINE CIRCLE Function Draws a circle on screen in various video modes Entry: SI Address of circle parameter block [SI] Video page no; normaly 0 [SI+2] X coordinate for centre [SI+4] Y coordinate for centre [SI+6] Radius [SI+8] BYTE, Specify the colour [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] If 0 its replace pixel; if 2 its XOR pixel [SI+24] DWORD Address of the Windows set function call ES Contains the address of the video memory Note Uses SYM_PLOT CLIP Function Clips a line to fit into a rectangular window Entry: SI Address of the CLIP parameter block [SI] X1 Set the line coordinates [SI+2] Y1 X1,Y1 and X2,Y2 [SI+4] X2 [SI+6] Y2 [SI+8] xmin Define the limits for the line [SI+10] ymin [SI+12] xmax [SI+14] ymax ES Contains the address of the video memory Return: Carry is set if the line is triviallu rejected otherwise X1,Y1 and X2,Y2 are altered to the clipped values for the line. DELAY Function Causes a time delay Entry: DX Required delay in N 1/18ths seconds Note Clock Freq = 18.2065 ticks/sec DISP_DEC Function Displays a signed number in decimal format Entry: DS:AX number to display DRAW_BOX Function Draws rectangular box given the TLC and BRC coordinates Entry AX,BX coords for TLC of box CX,DX " BRC " SI Address of plotting Parameter Block [SI+8] BYTE, colour attribute ES video memory address Uses: Subroutine LINE_TO DRAW_CURSOR Function Draws a special cursor (a cross) on the graphics screen for use by CAD type programs. Entry: SI Contains the address of the mouse interrupt handler parameter block AL Contains the colour attribute for the cursor BP X coordinate for the cursor centre DX Y coordinate for the cursor centre ES Contains the address of the video memory DRAWLINE Function Draws a straight line between two points Entry: DS:SI Address of the DRAWLINE parameter block [SI] X1 [SI+2] Y1 [SI+4] X2 [SI+6] Y2 [SI+8] BYTE, colour (1 is a useful default) [SI+9] BYTE, repetition bit pattern 033h, a dotted line 00110011 055h, a dotted line 01010101 077h, a dashed line 01110111 0Fh, a long_dash line 00001111 0FFh, a continuous line 11111111 [SI+10] length 0 = full line else length for sub/superset [SI+12] skip_length 0 = full line else=no of pixels to be skipped [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] 0 = pixel replace; 2 = XOR pixel [SI+24] DWORD. Address of the memory bank select routine ES Contains the address of the video memory ELLIPSE Function Draws an ellise defined by the equation:- X^2/A^2 + Y^2/B^2 = 1 Where 2A is the ellipse width & B is the height Entry: SI Address of parameter block [SI] X Coordinate of ellipse centre [SI+2] Y Coordinate " " [SI+4] Ellipse 1/2 width (A) [SI+6] Ellipse 1/2 height (B) [SI+8] BYTE; Colour attribute [SI+10] Reserved [SI+14] Address of the pixel plotting routine [SI+16] No pixels per line [SI+20] No of Lines poer Frame [SI+22] 0 = replace pixel; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine ES Contains the address of the video memory Uses: Subroutine PLOT4 FALOG Function Calculate common antilog Entry: ST(0) Floating point argument Return: ST(0) Antilog to the base 10 Note The Co_processor should be previously initialised FILL_BOX Function Draws a rectangular box filled with colour Entry: ax,bx TLC coordinates of the box cx,dx BRC coordinates of the box si Address of the graphics data block [si+8] BYTE, colour attribute [si+14] Address of the pixel plotting subroutine [SI+16] No pixels per line [SI+20] No of Lines poer Frame [SI+22] 0 = replace pixel; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine ES Contains the address of the video memory FILL_CIRCLE Function Draws a filled in circle Entry SI Address of the circle parameter block [SI+2] X coordinate for circle centre [SI+4] Y coordinate for circle centre [SI+6] Circle radius [SI+8] BYTE, Specify the colour [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] If 0 its replace pixel; if 2 its XOR pixel [SI+24] DWORD Address of the memory bank select routine ES Contains the address of the video memory Note: Uses CHORDS and CHECK_LINE FILL_ELLIPSE Function Draws an ellipse Entry SI Address of the graphics parameter block ES Contains the address of the video memory Uses Subroutine HOREFILL FILL_POLYGON Function Draws a solid polygon Entry SI Address of the graphics parameter block AX Contains the number of sides required External COORDINATES word - address of the buffer containing the coordinates. Uses Subroutine SORT FRAME Function Draws a rectangular frame around the screen limits Entry: SI Address of the graphics parm block ES Contains the address of the video memory Note The video mode should be set before calling Uses: Subroutine DRAWLINE FTAN Function Calculate tangent(x) Entry: ST(0) Argument in radians Return: ST(0) Result Note Uses regs AX & BX, other regs preserved FTOA Function Convert a floating point number to ASCII Entry: DS:SI Address of buffer to receive string ST(0) Contains the floating point number Return: AX Length of string Coprocessor stack popped Note Uses FALOG. Also the coprocessor should have been initialsed before calling. Obtained from a BBS, author unknown. (PC MAG V9N05) GET_COORDINATES Function Obtain the coordinates of the mouse cursor Return: CX Column number DX Row number Note: Mouse must have been initialised GET_NORMALISATION Function Gets the screen normalisation factor Entry: SI Address of the graphics parameter block [SI+16] Number of pixels/line [SI+20] Number of lines/screen BX Video Mode Return: Nothing, but NORMALISE is set and declared PUBLIC Note: The coprocessor is assumed to be initialised GET_P16 Function Read's a pixel from screen in SVGA, 16 colour VBE mode Entry: CX X location DX Y location SI Address of the graphics parameter block [SI+8] BYTE, colour (1 is a useful default) [SI+18] Number of bytes/line ES Address of start of video memory Return: AL Colour attribute BX Address of the pixel GET_P256 Function Read's a pixel from screen in SVGA, 256 colour VBE mode Entry: CX X location DX Y location SI Address of the graphics parameter block [SI+8] BYTE, colour (1 is a useful default) [SI+18] Number of bytes/line ES Address of start of video memory Return: AL Colour attribute BX Address of the pixel HOREFILL Function Fills two centre symetric horizontal lines of an ellipse Entry: CX X coordinate of the symetric point DI Y " " " SI Address of the ellipse parameter block ES Contains the address of the video memory External NORMALISE dword, LINE_STATUS word Uses Subroutine CHECK_LINE INVERT_SCREEN Function Inverts a selected screen window. Entry SI Addrees of the grpaphics parameter block [SI+22] (SWITCH) Plotting mode. 0 is replace, 2 is XOR AX X coordinate of the TLC of the window BX Y coordinate of the TLC of the window CX X coordinate of the BRC of the window DX Y coordinate of the BRC of the window Note: 1 All pixels within the window are inverted, so the window will be represented upside down 2 For the original pixe;ls to be erased set SWITCH to 0 LINE Function Draw a straight line between two points Entry SI Address of LINE parameter block [SI] X1 [SI+2] Y1 [SI+4] X2 [SI+6] Y2 [SI+8] BYTE, Colour [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] 0 = pixel replace; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine ES Address of start of video memory LINE_TO Function Draw a line from the last position to new position Entry SI Address of DRAWLINE/LINE parameter block [SI] X1 [SI+2] Y1 [SI+4] X2 [SI+6] Y2 [SI+8] BYTE, Colour [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] 0 = pixel replace; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine ES Address of start of video memory Uses Subroutine DRAWLINE MAKE_CIRCLE Function Makes a circle interactively using the mouse Entry: SI Address of the circle parameter block [SI+8] BYTE, Colour [SI+14] Address of dot plotting routine [SI+16] Number of pixels/line [SI+18] Number of bytes/line [SI+20] Number of lines/screen [SI+22] 0 = pixel replace; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine AL = 0; Circle is erased after drawing AL = 1; Circle image is retained ES Address of start of video memory External NORMALISE dword, M_PARMBLOCK word Return: [SI+2] X coordinate of the circle centre [SI+4] Y coordinate of the circle centre [SI+6] Interger circle radius [SI+10] DWORD Floating point circle radius Uses Subroutine TEMP_CIRCLE MEAN Function Calculates the mean of an array of floating point numbers Entry: bx = address of array cx = no of elements Return: st = F.P mean Note. The coprocessor should be initialised before calling. MIRROR_SCREEN Function Makes a mirror-image of the selected window. Entry SI Addrees of the grpaphics parameter block [SI+22] (SWITCH) Plotting mode. 0 is replace, 2 is XOR AX X coordinate of the TLC of the window BX Y coordinate of the TLC of the window CX X coordinate of the BRC of the window DX Y coordinate of the BRC of the window Note: 1 All pixels within the window are mirored, so the window will be represented in mirrored form. 2 For the original pixe;ls to be erased set SWITCH to 0 MOUSE_HANDLER Function Provides a user mouse cursor for the VGA/SVGA modes Entry: Nothing; only ever called by the mouse driver External M_parmblock word - parameter block in main routine (words) M_parmblock = Event status is returned here M_parmblock + 2 = Button status is returned here M_parmblock + 4 = Current cursor X coordinate M_parmblock + 6 = " Y " (bytes) M_parmblock + 8 = Cursor colour; 0Fh for bright white M_parmblock + 9 = Flags cursor movement if set. Initially 0 (words) M_parmblock + 10 = X coordinate of last cursor position M_parmblock + 12 = Y " " " " M_parmblock + 14 = Address of the fast plotting routine M_parmblock + 16 = Number of pixels/line; Used by plot routine M_parmblock + 18 = Number of bytes/line ; " " M_parmblock + 20 = Number of scan lines ; Not used at present M_parmblock + 22 = Switch for pixel plotting routine.(2 for XOR) M_parmblock + 24 = Video_memory address for fast plot routine event_status: Bit 0 Cursor position changed (mickey posn change) 1 Left button pressed 2 " " released 3 Right button pressed 4 " " released 5 Middle button pressed 6 " " released button_status: bit 0 = Left button. Bit set if button is down bit 1 = Right button. " " " Note. To use, issue a Int 33h/ Func 0Ch to tag-on user routine Uses a parmeter block "M_parmblock" to pass data between the user routine and the mouse handler. Remember to set the mouse call_mask as required, when invoking user processing of interrupts. A mask of 01Fh will cause the handler to be activated for both left and right buttons and also for any mouse movement. NORMWRIT Function Plots a dot on the screen using the slow BIOS function Entry: AL Dot colour; 1 is a convenient default BH Page No. Ignored if adaptor only supports 1 page CX Column number DX Row no PIXEL_ADDR_CGA2 Function Calculates the pixel address offset in video memory for the CGA2 video mode. Entry: CX Column number DX Row number Return: BX Pixel address offset PIXEL_ADDR_MCGA Function Calculates the pixel address offset in video memory for the MCGA video mode. Entry: CX Column number DX Row number Return: BX Pixel address offset PIXEL_ADDR_VGA Function Calculates the pixel address offset in video memory for the 16 bit VGA video modes. Entry: CX Column number DX Row number SI Address of parameter block [SI+18] Number of bytes/line Return: BX Pixel address offset PIXEL_ADDR_256 Function Calculates the pixel address offset in video memory for the 256 bit VGA video modes. Entry: CX Column number DX Row number SI Address of parameter block [SI+16] Number of pixels/line Return: BX Pixel address offset PLOT4 Function Draws 4 symetrically placed pixels on an ellipse Entry CX X coordinate DI Y coordinate SI Address of the ellipse parameter block [SI] X coordinate for the ellipse centre [SI+2] Y coordinate for the ellipse centre [SI+8] BYTE. Colour attribute ES Address of the video memory EXTRN NORMALISE word PLOT_CGA2 Function Plot a dot on the screen using the CGA2 video mode by either REPLACE or XOR action. Entry: AL Dot colour; 1 is a convenient default CX Column 0 - 639 DX Row 0 - 199 ES Start of video memory SI Address of parameter block [SI+22] WORD. If 0 its replace existing pixel If 2 its XOR with " " Return: BX Display offset in video memory Note: Uses "pixel_addr_cga2" to calculate the memory address PLOT_MCGA Function Plot a dot on the screen using the MCGA video mode by either REPLACE or XOR action. Entry: AL Dot colour; 1 is a convenient default CX Column 0 - 319 DX Row 0 - 199 ES Start of video memory SI Address of parameter block [SI+22] WORD If 0 its replace existing pixel If 2 its XOR with " " Return: BX Display offset in video memory Note: Uses "pixel_addr_mcga" to calculate the memory address PLOT_VGA Function Plot a dot on the screen using a 16 bit VGA video mode (640*480, 800*600 and 1024*768 resolutions) Entry: AL Dot colour; 1 is a convenient default CX Column DX Row ES Start of video memory SI Address of parameter block [SI+22] WORD If 0 its replace existing pixel If 2 its XOR with " " Return: BX Display offset in video memory Note: Uses "pixel_addr_vga" to calculate the memory address PLOT_256 Function Plot a dot on the screen using a 256 bit VGA video mode (640*400, 800*600 and 1024*768 resolutions) Entry: AL Dot colour; 1 is a convenient default CX Column DX Row ES Start of video memory SI Address of parameter block [SI+22] WORD If 0 its replace existing pixel If 2 its XOR with 2 " [SI+24] DWORD Address of the memory bank select routine Return: BX Display offset in video memory POLYGON Function Draws a multisided polygon using the mouse Entry AL = 1 Leaves a permanent image = 0 No image but the coordinates still obtained SI Address of the graphics data block ES Address of the start of video memory External COORDINATES word - Contains start address of the buffer to hold the polygon coordinates Return AX Number of sides in the generated polygon If more than 255 sides are drawn then the polygon is incomplete and AX is set to 0 Uses: Subroutines RUBBER_BAND, FIND_NEXT_CORNER & LINE_TO PRINT_SCREEN Function Transfers a screen image in B/W form to a PCL compatible laser printer. Entry: SI Contains address of the graphics data block AX Contains the video mode BX Contains the printer handle Note: 1 Valid for VBE modes 256h to 262h inclusive also the 648*480*16 mode (fudge for mode 12h) 2 A PCL compatible laser printer is required and it is assumed that this is correctly setup with PCL commands and is ready to receive the graphics data. 3 The printer hardcopy is obtained on return to the calling program, using PCL commands to end the last raster transfer and eject the page. PUT_P16 Function Writes a pixel. 16 colour VBE graphics modes Entry: CX X Coordinate of the pixel DX Y Coordinate of the pixel ES Start Address of video memory SI Address of the parameter block [SI+22] 0 = replace pixel. 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine Return: BX Display offset PUT_P16M Function Writes a pixel. in the 16.7m VBE colour modes Replace mode only at present Entry: CX X Coordinate of the pixel DX Y Coordinate of the pixel ES Start Address of video memory SI Address of the parameter block [SI+22] 0 = replace pixel; 2 = XOR pixel [SI+24] DWORD Address of the memory bank select routine Colour External dword value (pixel attribute) Return: BX Display offset Note: Because of the extra bits associated with true colour we enter the attribute as an external double word. PUT_P256 Function Writes a pixel. 256 colour VBE graphics modes Entry: CX X Coordinate of the pixel DX Y Coordinate of the pixel ES Start Address of video memory SI Address of the parameter block [SI+22] 0 = replace pixel; 2 = XOR pixel 4 = OR pixel; 6 = AND pixel [SI+24] DWORD Address of the memory bank select routine Return: BX Display offset PUT_P32K Function Writes a pixel. 32K & 64K VBE colour modes Entry: CX X Coordinate of the pixel DX Y Coordinate of the pixel ES Start Address of video memory SI Address of the parameter block [SI+22] 0 = replace pixel; 2 = XOR pixel 4 = OR pixel; 6 = AND pixel [SI+24] DWORD Address of the memory bank select routine Colour External word value (pixel attribute) Return: BX Display offset RANDOM Function Generates a pseudo random number Entry AX Size of number in bits Return EAX The random number READ_STRING Function Reads characters into the keyboard buffer Entry: DS:DX Buffer address Byte 1 = Buffer size including CR Return: Buffer byte No 2 = No of characters read " 3 - n contains the read characters RESTORE_CONTROLLER Function Restore Graphics Controller registers to default state Entry: AX contains the video mode Note: This routine should be called after a pixel plotting in 16 colour mode, in order to reset the controller to the default state. Without such a call odd effects might be experienced, especially with text. ROTATE Function Find new coordinates when a point is rotated phi radians Entry: DS:BX Address of ROTATE parameter block ES Set same as DS [BX] REAL4, Required rotation in degrees [BX+4] REAL4, X coordinate [BX+8] REAL4, Y coordinate Return: F.P coordinates in the param block are updated Also ST & ST(1) contain Y1 & X1 respectively Note Uses floating point arithmetic, so a coprocessor is required for this routine RUBBER_BAND Function Draws a line in the Rubber_band manner using a mouse and obtains the endpoint coordinates (X1,Y1) & (X2,Y2) Either the R.H or L.H mouse button may be used. Entry: DS:SI Points at the DRAWLINE parameter block ES Points at the start of the video memory AL = 0 Line erased after endpoints have been determined AL = 1 Line is not erased External M_parmblock word Return: AX X1 coordinate BX Y1 " CX X2 " DX Y2 " Carry is clear for a L.H button press, or is set for a R.H button press. Uses: Subroutines RUBBER_BAND and DELAY SCANLINE Function Routine advances SI to the next non_white space in the line Return: AL Contains the character SI Points at the character Carry set if EOL is reached SETBANK Function Sets the read/write bank in video memory Entry: AX - New read/write bank number SI - Address of Graphics Data Block SET_V_MODE Function Sets fast dot write routines for requested video mode Entry: AL Required video mode AH 0 selects a fast plotting routine -1 selects the slow BIOS functions Return: AX Number of scan lines BX Address of the "dot read" routine CX Number of horizontal pixels DX Address of fast plotting routine ES Set to either A000 or B800 Carry set is if there's an error return Uses: Subroutines PLOT_CGA2, PLOT_MCGA, PLOT_VGA, PLOT_256 and NORMWRIT SET_VBE_MODE Function: Sets a given VBE mode and initalises graphics block and selects the dot plotting subroutine. Also sets the video memory Entry: cx video mode si Address of the graphics block es Should be set to DGROUP ; Return: ah VBE function Status. 0 = O.K; 1 = Failed cx old video mode es set to A000h ; Carry is set if its an error return Note: Mode 12h, 640*480*16 is also accepted. This I find is more acceptable to Codeview, which has a problem with graphics screen switching with VBE modes. Uses: Subroutines WRITE_STRING, PUT_P16 and PUT_P256 SHRINK Function Reduce memory grabbed by DOS to the minimum necessary Entry: CX Top of Stack segment DS Data segment ES program PSP address Return: Carry clear if O.K Set if error, when AX=Error code 7 MCB destroyed 8 Insufficient memory 9 Incorrect seg in ES SORT Function Sorts integer numbers into ascending order Entry: BX Address of integer array CX Number of integers SQUARE Function Draws a square in graphics mode Entry SI Address of the graphics data block ES Address of video memory AL If 1 the image is retained, otherwise is deleted after construction SYMETRIC_POLYGON Function Construct a symetric polygon usinf the mouse. Entry: AX Number of sides required SI Address of the graphics data block ES Address of the start of video memory CX X coordinate of the polygon centre DX Y coordinate of the polygon centre Coordinates WORD is an extrernal buffer to hold the vertex coordinates. External COORDINATES word, NORMALISE dword Return carry is set if the no of sides is < 3 or > 32 Uses: Subroutines GET_COORDINATES, ROTATE and LINE_TO SYM_PLOT Function Plots 8 symetric points of a circle Entry: SI Address of the circle parameter block CX X coordinate of point to be replicated DX Y coordinate " " " EXTRN DWORD NORMALISE.Normalisation factor for Y axis ES Contains the address of the video memory Note Called by CIRCLE TEMP_BEZIER Function Draws an interactive Bezier curve using the mouse Entry: ES Contains the address of the video memory Uses: Subroutines BEZIER and DELAY TEMPBOX Function Draws a rectangular box in the "rubber-band" style using the mouse. Entry: SI Points to the graphics parameter block ES Contains the address of the video memory AL = 0 The box is erased after the box coordinates are found. AL=1 The box is not erased. External M_parmblock word Return: AX TLC coordinates BX " CX BRC coordinates DX " Uses: DRAW_BOX and DELAY TEMP_CIRCLE Function Draws a circle in the "rubber-band" style Entry: SI Points to the CIRCLE parameter block ES Contains the address of the video memory Return Nothing Uses CIRCLE and DELAY TEMP_LINE Function Draw a straight line in rubber-band fashion Entry: SI Points to the graphics parameter block ES Contains the address of the video memory AL = 0 The line is erased after the endpoint coordinates are found. AL = 1 The line is not erased. External M_parmblock WORD - Mouse parmeter block address Uses DRAWLINE and DELAY TOGGLE_CURSOR Function This routine either shows or hides a special graphics cursor (a cross) which is used in CAD type programs. Entry: SI Contains the address of the cursor parameter block ES Contains the address of video memory Uses: DRAW_CURSOR WRITE_CHAR Function Write character to thre screen Entry DL Character to write WRITE_DECIMAL Function Writes a 16 bit unsigned number in decimal notation Entry: DX 16 bit number Uses WRITE_HEX_DIGIT WRITE_HEX_DIGIT Function Converts the lower 4 bits of DL to a hex digit and writes it to the screen Entry: DL Lower 4 bits contain the number Uses WRITE_CHAR WRITE_HEX Function Writes a byte as two hexadeimal digits in ASCII form Entry: DL Contains the byte Note Writes at the current cursor position Uses Subroutine WRITE_HEX_DIGIT WRITE_STRING Function Outputs characters to STDOUT Entry: DX String address