VESA Turbo Pascal Unit ßßßßßßßßßßßßßßßßßßßßßßßß Version 1.20 June 1994 (c) '94 by Mark Stehr TABLE OF CONTENTS ßßßßßßßßßßßßßßßßß 1. General information 1.1 Introduction 1.2 Requirements 1.3 Dedication 1.4 Corrections, updates, problems and so on 1.5 Source code 1.6 Else 1.7 License Agreement 1.8 Registration 1.9 Trademarks 1.10 Credits 1.11 History 2. VGRAPH.TPU 2.1 Main differences 2.2 Overview over the functions 2.3 What is new ? 3. VESA.TPU 4. CPU.TPU INTRODUCTION ßßßßßßßßßßßß VESA Turbo Pascal Unit (VESA TP) is a set of routines for working on IBM PC's with MCGA/SVGA/VESA compatible video cards. It is thought as a replacement of the graph.tpu. VESA TP supports: þ 256, Hi- and TrueColor modes from 320x200 up tp 1280x1024 þ PCX þ Mouse þ Multiple pages þ Double/tripple buffering þ Scrolling and panning þ Virtual screens VESA TP is the result of a my desire to use all features of my graphic card. I expect to continue to improve VESA TP in speed and features. REQUIREMENTS ßßßßßßßßßßßß Hardware requirements: þ 80386 or better þ 640k RAM þ at least a MCGA graphic card (one mode supported) VESA TP gains it full power with a VESA BIOS/VESA TSR. For SVGA cards an additional driver is needed that you can get by: godzilla.cgl.rmit.oz.au (131.170.14.2): kjb/MGL/univbe??.zip This driver was written by Kendall Bennett. Software: MS-Dos 3.3 or above. Turbo Pacal 6.0 or 7.0 This software has been testet intensive with þ Cirrus Logic GD-5424 þ ET4000/W32 with Tlivesa 1.2 DEDICATION ßßßßßßßßßß This program is dedicated to God, my family, my girlfriend, my country, my university and to all who know me. CORRECTIONS, UPDATES, PROBLEMS AND SO ON ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß If you have any corrections, problems or updates to the code in this package, or you have any questions you would like asked, feel free to contact me through one of the following methods. EMail: mkstehr@cip.informatik.uni-erlangen.de Mail: Mark Stehr Wuerzburger Ring 50 91056 Erlangen Germany Telephon: +49 9131 47752 While I tested VESA TP thoroughly, it's possible that you may encounter a situation I hadn't anticipated. If this happens, I would be interested in knowing about it so I can deal with it in the next release of VESA TP. Here's how to report a problem to me. Copy your file (xyz.pas) onto a floppy. Add a description of the problem and send it to me. If I can't recreate it, I probably won't be able to fix it. SOURCE CODE ßßßßßßßßßßß The source code is not available yet. It is nevertheless possible for you to obtain part of it. Tell me your problem (e.g. fading) and I will perhaps send the routines to you. ELSE ßßßß A public domain graphic file format viewer that uses VESA TP is available, too. It supports at the moment: GIF,Targa,BMP,ICO,Tiff,PCX. The source code is included in the package. You can get it via FTP at: ftp.uni-erlangen.de: pub/pc/msdos/graphics/viewer/viewer.zip LICENSE AGREEMENT ßßßßßßßßßßßßßßßßß VESA Turbo Pascal Unit, Copyright (C) 1994 by Mark Stehr. All Rights Reserved. VESA TP is a Shareware product. It is copyrighted software, Copyright (C) 1994 by Mark Stehr. VESA TP is NOT FREE. You MUST REGISTER after the 30-day evaluation period. This registration entitles you to use the software on one computer at one time. If you wish to run several copies of the software concurrently, you need to pay a license fee for each concurrent copy. VESA TP is a Shareware product. It is distributed through public access channels so that prospective buyers can have the opportunity to evaluate the product before making a decision to buy. If you decide to use this software, then you are under both legal and moral obligations to register it with the author. It is fully protected by State, Federal and International copyright laws. I does not warrant that the functions contained in this program will meet your requirements or that the program operation will be uninterrupted or error free. I specifically disclaims all other warranties, expressed or implied, including but not limited to implied warranties of fitness for any particular purpose and of merchantability. IN NO EVENT WILL I BE LIABLE TO YOU FOR ANY DAMAGES,INCLUDING BUT NOT LIMITED TO ANY LOST PROFITS, LOST SAVINGS, COMMERCIAL DAMAGE OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM, OR FOR ANY CLAIM BY ANY OTHER PARTY. REGISTRATION ßßßßßßßßßßßß [From the documentation of Graphic Workshop:] If you like this program and find it useful, you are requested to support it by sending us $20.00. This will entitle you to support, notification of updates, a free copy of the latest version of this software and other worthwhile things. It will also avail you of a registration number to shut off the closing beg notice. More to the point, though, it'll make you feel good. We've not infested this program with excessive beg notices, crippled it or had it verbally insult you after ten days. We trust you to support this software if you like it. If you want to see additional features in this program, register it. If we had an Arcturian mega-dollar for everyone who has said they'd most certainly register their copy if we'd add just one more thing to it, we could buy ourselves a universe and retire. Oh yes, should you fail to support this program and continue to use it, a leather winged demon of the night will tear itself, shrieking blood and fury, from the endless caverns of the nether world, hurl itself into the darkness with a thirst for blood on its slavering fangs and search the very threads of time for the throbbing of your heartbeat. Just thought you'd want to know that. [END] This program is not free! You are allowed to use this program for a trial period of 30 days free of charge. If, after 30 days, you decide that you would like to continue using VESA TP, you must complete the following form and return it to me with the required registration fee enclosed. Your registration entiles you to the following: - Perpetual license to use Vesa TP on one computer at one time. - A program diskette of the latest version and your registration number (if you have no email account). All annoying functions are removed ! - Advance notification of updates and new products. - Support via mail/email/telephon. ----- CUT HERE ---------- CUT HERE ---------- CUT HERE ---------- CUT HERE ----- To: Mark Stehr VESA Turbo Pascal Unit 1.20 Wuerzburger Ring 50 91056 Erlangen Germany Name _____________________________________________________________ Address _____________________________________________________________ _____________________________________________________________ _____________________________________________________________ Phone ____________________________ Fax ____________________________ EMail ____________________________ Comment _____________________________________________________________ _____________________________________________________________ _____________________________________________________________ Computer: [ ] 286 [ ] 386 [ ] 486 [ ] 586 [ ] ELSE Video Card: _____________________________________________________________ Disk size: [ ] 3.5" [ ] 5.25" Yes! I want to register my copy of Vesa TP. I want to use: [ ] VESA TP shareware version DM 5 or US$ 5 [ ] VESA TP single reg. (private license) DM 35 or US$ 25 [ ] foreign cheque surcharge US$ 10 Total: DM ___ US$ ___ I have read the License Agreement and agree to its terms. Signature ____________________________________ Date ____________ ----- CUT HERE ---------- CUT HERE ---------- CUT HERE ---------- CUT HERE ----- There are some different ways to pay: þ cash (enclosed), DM or $US þ Eurocheque, DM only (European customers) þ cheque (enclosed), DM only (German customers) þ other cheque (enclosed), add US$ 10 for bank charge þ postal money order, DM only TRADEMARKS ßßßßßßßßßß Microsoft, MS, MS DOS, OS/2 are trademarks of Microsoft Corp. IBM, PC, PCjr, PC/XT, PC/AT, XT/286, PS/2, TopView are trademarks of IBM Corp. Logitech is a trademark of Logitech, Inc. Turbo C, Turbo Pascal and Borland Pascal are registered trademarks of Borland International GIF is a trademark of Compuserve, Inc. Various other names are trademarks or registered trademarks of their respective holders CREDITS ßßßßßßßß Kai Rohrbacher (AniVGA) for most of the .fnt files Kent Porter for the code of 'DrawBezier' Jeff Duntemann, COMPLETE TURBO PASCAL, for the code of 'RoundedRectangle' HISTORY/BUGS ßßßßßßßßßßßß þ Version 1.20 (June '94) : Changed code from 286 to 386 þ Version 1.10 (May '94) : Added 'InstallUserFnt' and some fonts Added 'SetClearFlag' & 'SetRestoreFlag' Added 'RoundedRectangle' & 'DrawBezier' Added 'PutSprite' Fixed bug in 'Circle' þ Version 1.00 (March '94) : Added some missing procedures þ Version 0.96 (March '94) : 'SetVirtualWidth' added þ Version 0.95 (March '94) : 'SetPalMethod' added þ Version 0.94 (March '94) : Detected problems with S3 cards þ Version 0.93 (March '94) : minor changes þ Version 0.90 (November 1993) : published VGRAPH.TPU ßßßßßßßßßß VGRAPH should work like the original GRAPH.TPU. Hence only the new functions are documented. For the 'standard' graph.tpu functions please refer to your manual or the online help. Main differences GRAPH.TPU <--> VGRAPH.TPU ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß þ Vectorfonts (.chr): They have to be in your current working directory. þ Linestyles: Not implemented yet. þ Procedure/Functions: Some functions are in work; refer to the overview Overview over procedure/functions ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß Function Supported New Sytax Not supported Replaced by ----------------------------------------------------------------------------- - High-level error handling: GraphErrorMsg x GraphResult x - Detection, initialization and crt mode routines : RegisterBGIfont x RegisterBGIdriver x InstallUserDriver x InstallUserFont x SetGraphBufSize x GetMaxMode x x GetModeRange x GetModeName x GetDriverName x SetGraphMode x GetGraphMode x GraphDefaults; x RestoreCrtMode; x CloseGraph; x CloseVesa InitGraph x x InitVesa DetectGraph x x DetectVesa GetX x GetY x GetMaxX x GetMaxY x - Screen, viewport and page routines: ClearDevice x SetVisualPage x SetActivePage x SetViewPort x GetViewSettings x ClearViewPort; x - Point-oriented routines: PutPixel x GetPixel x - Line-oriented routines: SetWriteMode x Line x LineTo x LineRel x MoveTo x MoveRel x GetLineSettings (x) SetLineStyle (x) - Polygon, fills and figures: Rectangle x DrawPoly x Bar x Bar3D x FillPoly x GetFillSettings x GetFillPattern x SetFillStyle x SetFillPattern x FloodFill x - Arc, circle, and other curves: Circle x Arc x GetArcCoords x Ellipse x FillEllipse x GetAspectRatio (x) SetAspectRatio (x) PieSlice x Sector x - Color and palette routines: SetBkColor x SetColor x GetBkColor x GetColor x SetAllPalette x SetPalette x GetPalette x GetPaletteSize x GetDefaultPalette x GetMaxColor x SetRGBPalette x SetRGBPal - Bit-image routines: ImageSize x GetImage x PutImage x x - Text routines: GetTextSettings x OutText x OutTextXY x SetTextJustify x SetTextStyle x SetUserCharSize x TextHeight x TextWidth x Explanation: -Supported: The functions have the fully functionality like the original. -New Syntax: The arguments of the function have changed. -Not supp.: There is no implementation of the function yet. -Replaced by: The function got a new name. WHAT IS NEW ? ßßßßßßßßßßßßß The following functions are new: þ PROCEDURE Beep; Produces a nice 'Beep'. þ PROCEDURE DrawBezier(NumPoints: WORD; VAR PolyPoints); Draw a Bezier curve. Same syntax as 'DrawPoly' þ PROCEDURE FadeDown(d:BYTE; pal : PaletteType); Fade the palette down. Only valid for 256 color modes ! þ PROCEDURE FadeUp(d:BYTE; pal : PaletteType); Fade the palette up. Only valid for 256 color modes ! þ FUNCTION FindVesaMode(xsize,ysize : word; bitpixel : byte):WORD; Check if the BIOS supports a video mode with the resolution XSize x YSize and the resolution BitPixel. If such a mode is found it is returned. Else a zero is returned. þ FUNCTION GetMaxRed:BYTE; FUNCTION GetMaxGreen:BYTE; FUNCTION GetMaxBlue:BYTE; þ FUNCTION GetMaxPage:BYTE; Returns the number of different pages available. þ FUNCTION GetVMaxX:INTEGER; FUNCTION GetVMaxY:INTEGER; Returns the new resolution after setting up a virtual screen with 'SetVirtualWidth'. þ PROCEDURE GetPal(VAR pal : PaletteType); Returns the actual palette. Only valid for 256 color modes ! þ PROCEDURE GetRGBPal(color : BYTE; VAR r,g,b: BYTE); Returns the values R,G,B for palette entry 'Color'. Only valid for 256 color modes ! þ PROCEDURE grayscale; Convert the actual palette to 'gray'. Only valid for 256 color modes ! þ PROCEDURE InstallUserFnt(Font : POINTER); Use another bitmap font instead of the default. About 60 fonts are provided in this package. Each .fnt file consists of a six byte header: - the tag "FNT" indicating that this is a valid font file - the width of the chars in pixel - the height of the chars in pixel - a reserved byte þ PROCEDURE lineh(x1,y1,x2,y2 : Integer); PROCEDURE linev(x1,y1,x2,y2 : Integer); Draw a horizontal or vertical line. Faster than 'Line'. þ PROCEDURE LoadPCX(x1,y1 : Integer; PCXFName : STRING); Load a PCX file onto the screen. þ PROCEDURE NewPal(VAR pal : PaletteType); Creates a new palette. After creating the new palette 'SetPal' is called. Only valid for 256 color modes ! þ PROCEDURE PushPal(VAR pal : PaletteType); Rotates the actual palette. Only valid for 256 color modes ! þ PROCEDURE putpixel2(x,y : Integer); Same as 'PutPixel' except that 'PutPixel2' uses the current color. þ PROCEDURE putsprite(x1,y1,x2,y2 : Integer; VAR SaveAddr); Works equivalent to 'PutImage' except that black pixels are not draw onto the screen. Can be used for sprites and/or mouse pointers. þ PROCEDURE ResetScroll; þ FUNCTION rgb(r,g,b : WORD):LONGINT; Composes a color with the color parts r,g,b. Only valid for Hi- and TrueColor modes ! þ PROCEDURE RoundedRectangle(X1,Y1,X2,Y2 : INTEGER; r : Word); This routine draws a rectangle with corners (X1,Y1) and (X2,Y2)h with rounded corners of radius R. þ PROCEDURE SavePCX(x1,y1,x2,y2 : Integer; PCXFName : STRING); Saves the area from (x1,y1) to (x2,y2) to a PCX file. þ PROCEDURE ScrollUp; þ PROCEDURE ScrollDown; þ PROCEDURE ScrollRight; þ PROCEDURE ScrollLeft; þ PROCEDURE Scroll(i,j : INTEGER); þ PROCEDURE Split(zeile : WORD); þ PROCEDURE SetClearFlag(YesNo : BOOLEAN); When switching to a graphic mode you can choose if video ram is cleared (YesNo = TRUE) or not (YesNo = FALSE). This is important when changing between text & graphic. þ PROCEDURE SetVirtualWidth(Width : WORD); Set up a 'Virtual Screen'. Virtual Screen means that you only see a part of this screen on your monitor. þ PROCEDURE SetPal(VAR pal); Set a new palette. Only valid for 256 color modes ! Description: [from AniVGA] Drawing colors in 256 color modes is quite an interesting thing! You probably heard that "mode $13 gives you 256 out of 262144 colors". The key to this is the palette (or, to be precise: the color-look-up-table "CLUT"). Every color (in the range 0..255) is used as a pointer into the CLUT; the corresponding entry consists of three bytes, which stand for the red/green/blue intensity of that color (in that order!). These three "bytes" (only the values 0..63 are valid for each of them) together form an "PaletteEntry". Because we have 256 colors, a complete CLUT is made of 256 such entries: such a table is called a "Palette". þ PROCEDURE SetRestoreFlag(YesNo : BOOLEAN); When changing between text & graphic you can tell 'VESA TP' to save the all registers,palette etc (YesNo = TRUE) or not (YesNo = FALSE). The later can cause a problem when switching back to graphic from text on some cards (eg. ATI,ET4000). þ PROCEDURE SetRGBPal(color,r,g,b: BYTE); Changes the palette entry 'Color' to R,G,B. Only valid for 256 color modes ! þ PROCEDURE SetPaletteFlag(method : BOOLEAN); Some cards have problems with setting the palette directly via the PEL port. On these card the palette can be set via the BIOS. SetPalMethod(BIOS) or SetPalMethod(PEL). Only valid for 256 color modes ! þ PROCEDURE swapRGB; Changes the position of the red and the blue part of a color. Only valid for Hi- and TrueColor modes ! VESA.TPU ßßßßßßßß This unit is used by VGRAPH.TPU. It is the interface between the hardware and VGRAPH.TPU. CPU.TPU ßßßßßßß This unit detects your processor. This is necessary because VESA TP needs at least an 80286. If VESA TP detects that you are only have an processor below you will get a message and the program stops.