home *** CD-ROM | disk | FTP | other *** search
- ─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
- Msg : 396 of 474
- From : James Cook 1:387/307.0 16 Apr 93 22:59
- To : All
- Subj : MCGA #1 Tutorial
- ────────────────────────────────────────────────────────────────────────────────
- MCGA Graphics Tutorial
- Lesson #1
- by Jim Cook
-
- I'm not sure how this online tutorial will be received, but with your
- comments and feedback I plan on creating a full-blown animation package. This
- graphics library will be available to the public domain and will contain the
- following abilities:
-
- Setting/Reading Pixels
- Drawing lines
- Saving/Restoring areas of the screen
- Displaying PCX/LBM files to the screen
- Spriting (Display picture with transparent areas)
- Palette control (Smooth fades to black)
- Page flipping
-
- Before we're done, you will have the tools to produce programs with rich,
- even photo-realistic (for the resolution) images on your PC. The necessary
- hardware is a VGA card and monitor that's it. I'll be using Turbo Pascal
- version 6.0. Please holler if that will be a problem. I'm using it to
- create inline assembly. My alternatives are inline code (yuk) or linking in
- external assembly. For speed (and actually ease) the latter is better. If I
- receive three complaints against 6.0, I'll use external assembly.
-
- What is MCGA?
-
- Multi-Color Graphics Array is the video card that IBM built into it's Model
- 25 and 30 PS/2's. It subsequently became a subset of the standard VGA
- adapter card. It has the distiction of being the first card (excluding
- Targa and other expensive cards) to display 256 colors at once on the
- computer screen. To us that meant cool games and neat pictures. The MCGA
- addapter has added two new video modes to the PC world:
-
- Mode $11 640x480x2 colors
- Mode $13 320x200x256 colors
-
- Obviously, we will deal with mode $13. If we wanted to deal with two
- colors, we'd be programming a CGA. So much for the history lesson...let's
- dive in.
-
- I've created a unit, MCGALib, that will contain all of our MCGA routines.
- The first two procedures we will concern ourselves with are setting the
- graphics mode and setting a pixel. The MCGALib is followed by a test
- program that uses the two procedures.
-
- e where these listings could get unbearably long in time. I'll
- explore a few ways I can get this information to ya'll without taking up too
- much space. I would like you to make sure this routine works, just in case
- you ou graphis card. You may notce two SetPxel
- procedures in the MCGALib, one is commented out. Remove the comments,
- comment up the uncommented SetPixel and run the test program aain. Notice
- the speed degradation. Linking in raw assembly will even improve upon the
- speed of the inline assembly.
- Please take the time to study each procedure and ASK ANY QUESTIONS that you
- may have, even if it doesn't relate to the graphics routines. I'm certain I
- do not want to get pulled off track by any discussions about STYLE or critique
- for others to learn rom.
-
- Coming next time
-
- I think a discussion of video memory is paramount. Possibly vertical and
- horizontal lines, if space permits.
-
- Happy grafx
- jim
-