                VGA LOADER CLASS WiTH FREAKiNG DOOZ
                -----------------------------------
                            iSSUE   i


THE iNTRO:

I had just donned my jet-black anti-glare shades, and pumped up some 
heavy Soup-Dragon sound, when I heard the phone ring. "Yo" I answered. It
was my old pal Nova of PET. The call went something like this:

- Yo            (This is me)
o Oh.. Hi.. It's Nova..
- What's up (babe)??
o Yes, well.. I just gotta hold of yer Atomic Caf intro...
- Yezz..
o And, as I marvelled over the 256 colour VGA grafix, as I drooled over the
  stunning plasma font, as I was spellbound by the magical scrolling...
- You would like my autograph.. Is that it??
o Yes, ofcourse.. Thanx..
- No problemo...

I sat back, once again.. It sounded as if he had forgotten to tell me 
something, and sure enough, a few seconds later, the phone sounded 
again..

- Anderssons bordel
o Ojd.. Jag har visst kommit fel.. (blush, blush)
- Yo, dude, only jokin'..
o Oh, thank gawd..
- So, whadya forget?
o Yes, well I recieved such a massive luxury overdose from your intro, 
  that I forgot to ask you..
- Ask me what??
o Well.. I was kinda wondering... Being my friend and all..
- Yezz (very impatient!)
o Could you, I mean would you.. doawriteyourownvgaloadercourseforme..
- VA??
o Could you please write a VGA loader course or something..
- Just for you??
o Noooo.. Of course not... I mean for all the people out there who 
  really would like to make a cool VGA intro, so that they too can show 
  off to their friends..
- People like YOU..
o Well.. I guess so..
- Think 'bout it..   (have ya ever seen the Coca-Cola ad with that pun??)
o You will.. Wow.. You're really rad.. (lick, lick, kiss, kiss!!)
- Take it easy dude.. I said I'll think about it..
o Thanks alot.. Bye.. Take care.. Give the family my regards.. How's your 
  dog by the way?? bla bla bla
- Dialtone.....


I don't know what the hell convinced me.. Was it the new clothes, the money, 
the computers.. Whatever it was.. Here I am.. And you better get ready for 
the ride of yer life...



VGA INTROS AND DEMOS
--------------------

Correct me if I'm wrong, but up until about 2 years ago, a demo in VGA was 
something very rare indeed. I don't think that even the Space Pigs Mega Demo 
used VGA (as I said, correct me if I'm wrong).

So, I guess, if someone is gonna release a demo today, it must be up to 
par. It doesn't matter how well coded it is, people aren't going to pay 
it much attention if it hasn't got eye-bogling VGA effects.

So, where do we begin?

At the begining of course..

In the begining, God created the heavens and the earth. Okay, that might be 
a little far back. I'll give it one more try.

This following part is directly taken from Writing (Graphic) VGA 
Intros/Loaders by Fred Nietzche:

     I'm assuming that you don't understand the concept of video memory, so 
I'll start off from the basics then.  Video memory is defined (for our own 
purposes) as the memory that the video board scans in determining what 
signals (analog) to send to the monitor.  In graphics mode, the segment of 
the location of this is determined by what type of video mode you are on -
VGA/EGA modes = $A000 ($=hex), CGA modes = $B800, and Herc = $B000.  The
offsets always start off at $0.

     Now, what type of organization are the pixels (since we're in graphics 
mode) stored in?  Because of the simplicity of Mode $13 (320x200x256), most
VGA intros are written using this.  I'm not about to go ahead and explain to
you the other VGA modes dealing in the color planes, EGA/VGA registers,etc in
the higher resolution modes, there are a couple of good books out there that
can handle those of you interested in that.  Try your local bookstores and look 
for Power Graphics Programming by Michael Abrash, which contains his articles 
about higher resolution VGA programming from Programmer's Journal.  HIGHLY 
recommendable.  In any case, in this mode, each pixel on the screen 
corresponds to exactly 1 byte on the video memory.  For example, location
(0,0) = Mem[$A000:0], (1,0) = Mem[$A000:1], (2,0) = Mem[A000:2], and so on.
Fairly easy eh?  Because the memory map is linear, the next line would just be
the next byte AFTER the previous line's last pixel.  For example, location
(0,319) = Mem[$A000:319], AND THEN location (0,1) = Mem[$A000:320].  And the 
formula for determining the video memory location is

     Video Mem Offset = YPos*320 + XPos


-- FREAKiNG DOOZ AGAiN

In every byte in the VGA video memory ($A000:x) the color to be displayed is 
stored. This color is between 0 and 255 (0 and FF hex).
     
-- FRED AGAiN

The actual color of the byte values stored in the video memory is flexible 
and can be changed to any color of the 256,047 palette of the VGA. This can 
be accomplished by altering the VGA Video DAC registers at port addresses 
$3C7 through $3C9.  To read the current settings, set the Table Read Index 
(port $3C7) to the color value you want, and then read the three values from 
the Table Data Register (port $3C9) (one each for Red, Green, and Blue).  

-- IN PASCAL (FD)

Colornumber     :=PORT[$3C7];
red             :=PORT[$3C9];
green           :=PORT[$3C9];
blue            :=PORT[$3C9];


Once three values have been read from that port, the current read index is 
incremented by one and the next three 6 bit (range of 2^6, or 0 to 63) 
values read are for the next color value.  Writing the to the Video DAC is 
similar, except the Table Write Index is port $3C8.  

-- IN PASCAL (FD)

Colornumber     :=PORT[$3C8];
red             :=PORT[$3C9];
green           :=PORT[$3C9];
blue            :=PORT[$3C9];


Again, after writing three successive 6 bit values to the Table Data 
Registers increments the Write Index by one.  By the way, all the reference 
information about the Video DAC's can be obtained from any EGA/VGA reference 
book.  I recommend getting Advanced Programmer's Guide to the EGA/VGA by 
George Sutty and Steve Blair.

-- END OF FRED'S DOCUMENTATiON


Now that you know how to set up the colors, I shall teach you how to display 
a picture to the screen.

First, we have to set the video display to mode 13. This can be done by a 
number of ways. Here are two examples:

 Example 1)
 Inline($B8/$13/0/$CD/$10); 

 Example 2)
      Asm
        Mov  AH,00
        Mov  AL,13
        Int  10h
      End;

I usually use example number 1, but both work just as well.


When it comes to displaying the picture, alot of people probably think 
"shit, do I have to CODE all of this???". You can, ofcourse, if you want to, 
copy every single color to every single byte in video-memory for hand if 
you want to, but I prefer a slightly easier way.

First, you draw/find/steal a picture that you want to display. Second, 
you convert it to SCI/ColoRIX form. To do this, use VPIC, view the 
picture you want to show, then press R and you will convert it to a 
SCI/ColoRIX file.

The reason for using the SCI format, is that it is the easiest to 
display, and it can also be packed very effeciently. 

A SCI-file is 64778 bytes long. The first 10 bytes are just a header, and 
should be removed or jumped over. The following 768 bytes are the hex 
values for the intensity of each color. (256 colors (0 to 255), with 3 
values (red, green, blue) 256*3=768!) The value is stored in hex form, 
and you will need to convert this to decimal form before copying the 
value to $3C9.

The following 64000 bytes is the picture as it should be copied to the 
screen.

When displaying the file, you should first split it up into two parts
(This is of course not essential, as you will see when it comes to more 
advanced programing techniques). Part one should contain the palette, 
and part two the picture. 

Included in this package is a file called CONVERT.EXE which does just 
that.

This may seem a little confusing, but I have included a pascal source 
with comments that shows how it should be done.

After setting up the colors, and copying the picture to video memory, 
you can sit back and enjoy your masterpiece.


Watch out for the next issue of VGA LOADER CLASS WiTH FREAKiNG DOOZ, 
where I think we will be covering scrolling in all its shapes and forms. 
By the way, if you do use any of my source, or find this class helpful, 
I would apreciate it if you would credit me, or at least a greet. 
Nothing more is needed, as this is only the very basics when it come to 
VGA loaders and intros.


                / Regards FREAKiNG DOOZ (PET/QUiXiLVER/FDE)


