About me

Vladimir Nabokov

Books
Programming
Biochemistry
Aim | Communicate

Search
 


 
   
Letters from Terra - Life in water warmed by sunlight
 
 

     
 
 

     
The original canvas 2.4 displaying a rather fetching pollen grain. Click here for more info on imaging in MCGA.
 
 
     

Units and Tools

Welcome to the units and tools section of the programming area of the site. These pages will contain the entirety of the resources available on the original PascalGames.co.uk, organised in a logical fashion and with extended information to allow their ease of use and implementation in your own programs. The 3D units and tools are all available for download in the 3D project section, which is also accessible from these pages. Otherwise, this section will contain all of the tools I have developed to allow me to construct my various projects, and the units that contain libraries and routines that underpin much of the coding. Prominent are the graphics and imaging tools. Anyone that is interested into moving into dealing with sprites and images in pascal, whether in low resolution MCGA (320x200x256) or hi-res SVGA (640x480x256) should find the availability of complete, functioning libraries makes the implementation of their code much easier. When I started to experiment, the complexity of writing fast, high capacity imaging routines, fairly abstract coding for my level of experience, proved very difficult, and I tried numerous combinations of use of memory and graphics modes until I established a system I could use to hold the several hundred images necessary for a large game, and display each on the screen at the correct speed. The graphics libraries, both written by myself in pure assembly language, provide a fairly intuitive (or so I find) interface to a complex and very rapid graphics engine, sourcing images from conventional memory, EMS or XMS, and implementing page flipping as well as direct access with fast pixel and palette routines. Images can be imported into my raw .IMG format through the use of the Canvas applications, which are simple drawing programs for MCGA and SVGA respectively. These allow images to be stored seperately from their palette, and existing images and .PCX files to be converted to an existing palette, to allow one set of colours to be used throughout a program. Once in IMG format, images can be loaded directly into the graphics engine for rapid display and manipulation, or can be compiled into 'libraries' of images, that not only constitute one file but also use a simple GIF style compression (a JPG compressor was under development, but is currently stalled due to lack of time) that can reduce the size of the images on disk severalfold. Images can be also loaded seperately out of the library by routines included in the graphics engine. I also include the sound units I used to introduce sound into Trooper II and earlier programs. These are constituted by a MIDI sound engine, that plays XMS format tunes, of which a library of around 30 is available for download, and a VOC sound engine that is capable of playing high quality WAV style sound directly from an XMS buffer whilst the program is running. A CD audio unit is also available, that allows extended control over the CD drive and can play CDs whilst the program is processing. Mouse control is a vital component of many programs, and can be difficult to implement in a language as pure as Pascal. I therefore include a mouse unit for MCGA, which is not my own, and an SVGA unit written from scratch, that allows manifold control of the mouse. Finally, access to extended memory is something that is nearly always required when large programs overrun their paltry allocation of conventional memory. I provide several XMS and EMS memory units that can be used to simply transer data between the conventional and extended/expanded memory, allowing storage and quick retrieval. Both graphics engines automatically make use of these units. I hope that you find these units and tools useful; many of them contain my signiture ideosyncracies, but be assured that all have been extensively tested, and rarely go wrong. Enjoy, Jon.

 
 
Letters from Terra | Updated 15th December 2004 | By Jonathan Ayling