
*****************************************************************************
                        The SVGA-VESA Unit V0.72
                          English Documentation
     See file doc.txt for german doc or press ESC if you run readme!    
            Take a look at the Homepage for the HTML-manuals

                      http://home.inm.ch/artdesign
*****************************************************************************

See PCX.TXT for an english and german documentation of the converter! 


1. What's new since V0.6?


  V0.72 - 02.04.97
          colour-Fonts (Unit Draw)
          15 Fonts are included
          editor is under construction...

  V0.7 - 20.03.97
         new ADGF/LBM Pictureloadroutines - over 50% faster   
         new 32bit converter
         some Bugs were removed...
         BMP support       
         Autodetection of picture-format
         one single picture Unit

  V0.6 - 01.01.97

         first release



Welcome to the SVGA-Vesa Unit fro, Art Design Software.
We have tried to make a very good product. You can now see the result
with this demoversion.

This not restricted Demoversion you can use only 30 days. You are not
allowed to give away programs which use this demoversion of the Unit(s)
If you would like to give away your new SVGA-programs so please register.
You get then the newest version of the SVGA-Vesa Unit and a key which      
allows you to register always the newest version. You are not allowed to
give away this key! Beside that you get life-long support via e-mail!

There are two ways you can register

1. --> Registering via E-mail:

     Costs:         20 DM or 20.000 Lire or 15 US-Dollar
     Advantages:    cheaper - you get your key via e-mail                 
     Disadvantages: Not yet possible!                                        
                    Please take always a look at our homepage to see when it
                    is possible:                                             

                    http://www.geocities.com/SiliconValley/Pines/4855 or
                    http://home.inm.ch/artdesign


2. --> Registrierung via snail-mail:

    Costs:         25 DM or 25.000 Lire or 18 US-Dollar

    Advantages:    Not everyone has Internet! and for now the only possible way!
    Disadvantages: More expensive because i have to pay disk and postage!

    Vorgangsweise: You send us a letter with your address and the money  
                   in cash or a traveler-cheque or a Euro-cheque made out for
                   Andreas Kostner. You get then via mail a letter with
                   a Disk on wich you will find all Units!            


  Following our address:

  Art Design Software
  c/o Andreas Kostner
  Vergilstr. 33

  39012 - MERAN
  Italy (BZ)

  Email: artdesign@comports.com


Ok, now let's speak about the documentation:


The documantation is not very detailed, but I think that's enough.
If there are still questions so please send us your questions to           
  artdesign@comports.com                                             

Of course we like it when you send us suggestions about improvements!


First of all I would like to explain you the ADGF (Art Design Graphic Format)

In the beginning of '96 I needed a loader for SVGA-Pictures. I had only
a very slow gif-loader for the original graph-unit. This loader was to slow
for me and so I decided that I make my own pictureformat. The trick on the   
ADGF is that you can only use pictures which won't use all 256 colours. But   
quiete all pictures won't use all colours at all. If your picture uses all  
available colours so simply use a proggy like Paint Shop Pro to decrease the 
uses colours!
Ok, another reason was it to make password-protected pictures. The encrypter
uses no patented encryption but works very good. If you don't have the right
key you will only get garbage! But try it out! Take a look at our intro and
try to use the password "Helmo!" instead of "Hello!" - You will get a total
muddle thoug the difference between the two passwords is very little!

Eine kurze Gegenberstellung der Vor- und Nachteile:

ADVANTAGES:

- The file will never get bigger than the uncompressed
- In quite all cases the ADGF-File is compacter than the PCX/BMP or other file
- repetition of more then 127 times need only 3 instead of 4 byte  
- single pixels with the colour value of over 127 need only 1 instead of 2 byte
- password-protected pictures are possible
- Because the ADGF is quite unknown no would-be-hacker can modify
  the pictures of a game or such proggy


DISADVANTAGES:

- Repetitions of less then 128 need 3 instead of 2 byte
- The format cannot be made with any convert-program                


  The instruction for the PCX to ADGF-converter you will find on PCX.txt

  Please read the text on the bottom of the file too!


  Ok, now let's explain the Units

                        
  Unit SVGAVESA
  ----------------

  a) predefined types
  -------------------

  type TTBlock=Record
               br,h:word;
               buf:Array[1..64000] of byte;
               end;
       TBlock=^TTBlock;

  TBlock is a type for the Get/PutBlock procedures

  b) predefined variables   
  -----------------------

    palette:Array[0..256*3-1] of Byte; In this Array GetPal will save the  
                                       Colour-palette           
    ScreenX,ScreenY:longint;           Width and Height of the screen
    VesaErr:word;                      Error variable


  c) Procedures and functions 
  ---------------------------

Procedure InitVESA(Mode:word);
Sets a Vesa Modus (f.e. $101) - Take a look at the mode-table at the bottom

Procedure SetText;
Sets the normal textmodus 80x25 (VGA Modus 3h)

Procedure Colour(ColorNo : Byte; R,G,B : Byte);
Sets the colour nr. [ColorNo] on the values [R,G,B]

Procedure SetScanWidth(width:word);
Sets the width of the screen on [width] - Has no effect on the resolution,
but enables horizontal scrolling
ATTENTION: All graphics which are already on the screen will be distort!

Procedure Set_VisualPage(which:word);
Sets the visual page on [wich] - take a look at the table [Pagesize]

Procedure Set_ActivePage(which:word);
Sets the active page on [wich] - any operation take place on this page    
the pictureloadroutines too!                

Function  ImageSize(x,y,x2,y2:integer):word;
Gives you the memory-consumation of the block. If the block needs more then
64kb VesaErr will get 1.
ATTENTION:
VesaErr will not set automaticly to 0 - you have to do it!

Procedure GetBlock(var bl:TBlock;x,y,x2,y2:integer);
Cpies the part of the screnn fron [x,y] to [x2,y2] in the Array, which  
you supplied as [bl]                           

Procedure PutBlock(bl:TBlock;x,y:integer);
Cpies the image from the Array on the screen

Procedure PutYFlip(bl:TBlock;x,y:integer);
Does the same like PutBlock, but puts the block mirrored on the y-axe

Procedure FlipX(var bl:TBlock);
Mirrors the block in memory on the x-axe (does no put!)

Procedure Clear(color:byte);
Clears the whole page with the colour [color]

Procedure SetStart(pixel,line:word);
Sets the start of the visible part to [pixel,line]
With this procedure it is very easy to make a scrolling (see example)

Procedure Fade_in(ZPal:Array of Byte);
Fadex from the actual colour palette to the palette saves in [ZPal]      
The fade works only from a low value (0 - black) to a higher value (63 white)
You can make the array ZPal with:

 GetPal;Move(Palette,ZPal,768);

Then you can make the screen for example black and fade to the saved palette:

 FillChar(Palette,768,0);SetPal;
 Fade_in(ZPal);

Procedure Fade_out(ZPal:Array of Byte);
This is the same like Fade_in, but it fades from a high to a lower value 

Procedure FadeOut;
Fades the current palette to black

Procedure Fade_To(Zielpal:Array of Byte; Step:Byte);
Fades to a defined palette with the speed [step]

Procedure Screen_Off;
Turns the screen off - you will see nothing!    

Procedure Screen_On;
Turns the screen on - you see it again!

Procedure WaitRetrace;
Waites for the vertical retrace

Procedure SetPal;
Sets the palette saved in [Palette] 

Procedure GetPal;
Saves the current palette to the array [Palette] 

Procedure PutPixel(x,y:word;color:byte);
Puts the pixel on position [x,y] to the value [Color]  

Function  GetPixel(x,y:word):byte;
You get the colour of the pixel on [x,y]

Procedure PutLine(y:word;var buf:Array of byte);
Puts the line from the Array [buf] onto the screen on position [0,y]
It puts the full screen-width

Procedure PutPLine(x,y,num:word;var buf:Array of byte);
Puts the line from the Array [buf] with the length [num] onto the screen
on position [x,y] 

Function IdealMode(width,height:integer):integer;
You get the ideal vesa-mode number
 for example
   IdealMode(640,480) --> $101  [640*480]
   IdealMode(720,300) --> $103  [800*600]
   IdealMode(600,700) --> $105  [1024*768]     


------------------------------------------------------------------------------

  Unit DRAW
  ------------

predefined variables:

    colwidth,colheight: Width and height of the font current in memory
    Font_Error:
                   1 --> Can't find font-file  (Loadfont)
                   2 --> No ADF (Art Design Font) (Loadfont)

Procedure HLine(x,y,x2:word;colour:byte);
Draws a horizontal line from [x,y] to [x2,y] with the colour [colour]

Procedure VLine(x,y,y2:word;colour:byte);
Draws a vertical line from [x,y] to [x,y2] with the colour [colour]

Procedure Line(x1, y1, x2, y2 : integer; colour : byte);
Draws a line with any degrees from [x,y] to [x2,y2] with the colour [colour]

Procedure Bar(x,y,x2,y2:word;colour:byte);
Draws a filled rectangle from [x,y] to [x2,y2] with the colour [colour]

Procedure Box(x,y,x2,y2:word;colour:byte);
Draws an empty rectangle from [x,y] to [x2,y2] with the colour [colour]

Procedure Circle(x,y,radius:word;colour:byte);
Draws a circle with the centre on [x,y] and the radius [radius] with
the colour [colour]                                                

Procedure PrintChar(x,y:integer;vg,hg:byte;charact:char);
Writes the character [charact] with the ROM-Font 8x8 onto 
position [x,y] with the forground- and backgroundcolor [vg,hg] 

Procedure Text(x,y:integer;vg,hg:byte;strt:string);
Writes the string [strt] with the ROM-Font 8x8 onto
position [x,y] with the forground- and backgroundcolor [vg,hg] 


ATTENTION:
You have perhaps notated that not all chars are included in the 
fonts (some have no numbers either!)                         
But don't worry an editor is under construciont...


Procedure LoadFont(name:string;setpa:boolean);
Loads the font with filename [name] intro the memory and
sets if setpa=true the palette of the font
error-variable Font_Error!

Procedure DoneFont;
Clears the loaded font of the memory

Procedure PrintColChar(X,Y: INTEGER; CH: CHAR);
Draws a char with the colour-font         

Procedure ColText(X,Y: INTEGER; S: STRING);
Draws a text (string) with the colour-font

------------------------------------------------------------------------------


Unit SVGAPic;


  supported are (only 256 colours)

    1 --> ADGF-Picture format 3 - converter enclosed
    2 --> compr. PCX - pictures
    3 --> compr. LBM/PBM - pictures
    4 --> uncompr. BMP - pictures


  a) predefined types
  -------------------

type pic_format=(bmp,pcx,lbm,adgf,none);

  pic_format is needed by Get_PicFormat


  b) predefinded variables
  ------------------------

var Pic_Error:integer;             

          -1 --> Can't open/find file
           1 --> No ADGF-File
           2 --> Old V2-File [ADGF]
           3 --> No PCX-File
           4 --> No BMP-File
           5 --> no uncompressed BMP pic  
           6 --> not 8bits per pixel [BMP]
           7 --> no LBM/PBM pic

  Every procedure/function sets Pic_Error to 0 on beginning
  If during the execution of the function/procedure an error appears
  Pic_Error will be set accordingly.



  c) procedures and functions
  ---------------------------

  Procedure Show_PicError;
  If you don't want to evaluate Pic_Error by yourself then simply run
  Show_PicError. A short notice will tell the user why your programm was 
  closed.

  Function  Get_PicFormat(st:string):pic_format;
   You get the format of the picture:
	 z.B.   Get_PicFormat('svga.xxx') --> adgf

         Take a look at loadpics.pas to see how to use this function!

  Procedure PicData(s:string;var width,height:integer);
   If the file is in one of the four supported formats so the 
   widht and height of the picture will be saved in [height,width]
   If not then widht and height will get -1


  Procedure LoadADGF(filename:string;setpa:boolean);
  Procedure LoadBMP (filename:string;setpa:boolean);
  Procedure LoadLBM (filename:string;setpa:boolean);
  Procedure LoadPCX (filename:string;setpa:boolean);
   Loads a ADGF/BMP/PCX/LBM picture on the current picturepage   
   If the picture is higher then the screen, so the information will be  
   attached to the next page. So you can load a 640x800 picture and scroll then!
   If setpa = true then the palette of the picture will be set


  Procedure LoadPADGF(filename,passwort:string;setpa:boolean);
   Loads a password-protected ADGF-picture (take a look to LoadADGF)

  Procedure LoadXYbmp(filename:string;setpa:boolean;x,y :integer);
  Procedure LoadXYpcx(filename:string;setpa:boolean;x,y:integer);
   Loads a PCX/BMP picture on the position [x,y]     

  Procedure ADGFData(s:string;var width,height:integer);
  Procedure BMPData (s:string;var width,height:integer);
  Procedure LBMData (s:string;var width,height:integer);
  Procedure PCXData (s:string;var width,height:integer);
   You get the width and height of the picture
   If the picture is in another format or not recognized so widht and height
   will get -1


  Function IsADGF(s:string):boolean;
  Function IsBMP(s:string):boolean;
  Function IsLBM(s:string):boolean;
  Function IsPCX(s:string):boolean;
   You get true if the file is a ADGF/BMP/LBM/PCX - picture 



Ok, thats it now two tables:

------------------------------------------------------------------------------

List of all supported VESA-modes from SVGA-Vesa

$100 -  640 x 400  x 256 Colours
$101 -  640 x 480  x 256 Colours
$103 -  800 x 600  x 256 Colours
$105 - 1024 x 768  x 256 Colours
$107 - 1200 x 1024 x 256 Colours

------------------------------------------------------------------------------

List of the memory-usage of the diff. VESA-Modes:

Resolution | memory usage of 1 page     | min.  RAM | min. RAM for 2 pages  
--------------------------------------------------------------------------
 640x 400  |   256.000 bytes            | 256kb     | 512kb  - 2 pages  
 640x 480  |   307.200 bytes            | 512kb     | 1 MB   - 3 pages
 800x 600  |   480.000 bytes            | 512kb     | 1 MB   - 2 pages
1024x 768  |   786.432 bytes            | 1 MB      | 2 MB   - 2 pages
1200x 1024 | 1.228.800 bytes            | 2 MB      | 4 MB   - 3 pages

------------------------------------------------------------------------------



Ok, that was the short documentation. I think thats enough to understand
the SVGA-Vesa Unit. If there are any other questions so just send me
a mail:

  artdesign@comports.com

Or take a look to our homepage:

  http://www.netforward.com/comports/?artdesign     [only link]

  http://home.inm.ch/artdesign                      [Europe - Switzerland]

  http://www.geocities.com/SiliconValley/Pines/4855 [USA]




At least the usual lines:



THE SOFTWARE IN THE DISTRIBUTED FILE HAS NO GUARANTEE OF ANY TYPE WHATSOEVER.

IN NO EVENT WILL THE AUTHOR OF THIS PROGRAM (Andreas Kostner)
BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO LOST PROFITS,
LOST SAVINGS, OR OTHER INCIDENTIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR THE INABILITY TO USE SUCH PROGRAM, EVEN IF THE AUTHORS HAVE BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER
PARTY.

DO NOT USE VIDEO MODES THAT YOUR MONITOR CANNOT HANDLE. EXCLUDE THESE MODES
FROM USE.

THIS PRODUCT MAY BE DISTRIBUTED FREELY IN UNMODIFIED FORM AS LONG AS NO
FEES ARE CHARGED. DO NOT DISTRIBUTE THE FILE 'REGISTER.DAT'. IN THIS FILE
YOUR PERSONAL DATA IS SAVED IF YOU ARE REGISTERED! IF YOU DISTRIBUTE THIS
FILE YOU VIOLATE INTERNATIONAL RIGHTS!

IF YOU DO NOT AGREE WITH THESE TERMS, STOP USING THIS PROGRAM.
--------------------------------------------------------------

ALL PRODUCT NAMES MENTIONED IN THIS SOFTWARE AND DOCUMENT ARE TRADEMARKS
OR REGISTERED TRADEMARKS OF THEIR RESPECTIVE OWNERS.

