# turbopascal X-LIB UNiT V0.3รก* This Pascal unit, xlibunit, is a graphics library designed for use in Turbo Pascal programs. It provides various procedures for initializing and manipulating VGA graphics modes, handling color palettes, and drawing on the screen. It's particularly useful for creating graphic demos. ## System Requirements - Turbo Pascal 6.0 - MS-DOS or compatible environment - VGA graphics card ## File Structure | File | Description | |------|-------------| | `xlibunit.pas` | Pascal unit source code | | `xlibunit.tpu` | Compiled Turbo Pascal Unit | | `COMPILE.BAT` | Batch script to compile the unit with Turbo Pascal | | `intel.txt` | Reference documentation for Intel 8086 instruction set | | `LICENSE` | MIT License | ## Usage Include the unit in your Turbo Pascal program and call the methods: ```pascal program MyGraphicsDemo; uses xlibunit; begin initxlib; { Initialize VGA mode 13 } { ... your graphics code ... } exitxlib; { Return to text mode 3 } end. ``` ## Types and Variables | Type / Variable | Description | |-----------------|-------------| | `paltype` | Array of 768 bytes (256 RGB triplets) used for palette data | | `textpal` | Array of 3x16 bytes storing text mode palette on unit initialization | ## Compile Compile.bat uses Turbo Pascal 6.0 installed in c:\progrs\tp\ ``` compile.bat ``` ## Methods | **Method** | **Description** | |--------------------|---------------------------------------------------------------------------------| | `initxlib` | Initializes VGA mode 13. | | `initxmode` | Initializes extended mode. | | `clearxmode` | Quickly clears the screen in extended mode. | | `cleartext` | Quickly clears the screen in text mode. | | `exitxlib` | Exits the library and initializes VGA mode 3. | | `point` | Draws a point in extended mode. | | `blackpal` | Sets all colors to black. | | `vert_retr` | Waits for vertical retrace. | | `fadeup` | Fades up the palette. | | `fadedown` | Fades down the palette. | | `copypic13` | Copies a picture from a segment and offset to VGA in mode 13. | | `copypicx` | Copies a picture from a segment and offset to VGA in extended mode. | | `copypicxd` | Copies a picture in virtual horizontal 640 mode. | | `copypal` | Copies a palette from a segment and offset to another palette. | | `startingarea` | Sets the linear starting area. | | `vert400` | Switches to 320x400 resolution. | | `vert200` | Switches to 320x200 resolution. | | `vert100` | Switches to 320x100 resolution (not tested). | | `hor640` | Switches to virtual horizontal 640 resolution. | | `hor320` | Switches to normal horizontal 320 resolution. | | `vpan` | Vertical panning. | | `hpan` | Horizontal panning. | | `hbegin` | Sets the horizontal start position. | | `CRTC_UnProtect` | Unprotects the CRTC (Cathode Ray Tube Controller). | | `CRTC_Protect` | Protects the CRTC. | | `unprotect` | Unprotects the screen. | | `protect` | Protects the screen. | | `hor_retr` | Waits for horizontal retrace. | | `moveblock` | Moves a block of memory. | | `setdac` | Sets the DAC (Digital-to-Analog Converter) color. | | `print` | Prints text on the screen. | | `locate` | Sets the cursor position. | | `key` | Checks if a key is pressed. | ## Contributing Contributions are welcome. ## Lizenz Lizenziert unter der [MIT License](LICENSE) - Copyright (c) 2026 Stefan Koelle (https://stefankoelle.de)