Hacking CGA

This is meant to be a short post to talk about some CGA idiosyncrasies and how you can bypass them.

My video library VGALIB now supports CGA in addition to VGA, EGA support is planned too. Adding VGA was simple and that’s why I did it first; VGA implements a 320×200 linear framebuffer. A linear framebuffer is one where each pixel is represented by a simple lookup and the pixels are contiguous in the memory region. The formula width*y + x is commonly used to perform linear buffer address resolution. It is because of this simplicity that I made the internal representation of images 8 bit linear buffers. Each pixel is represented by 1 byte that can hold 1 of 256 colors.

Continue reading “Hacking CGA”

Introduction to VGALIB

During the Christmas break of 2018 I started working on a cross-platform video library that would work on DOS, Linux, and Web. The idea was really born from tinkering with some old C++ code that found on an old hard drive.

I wrote my first C++ code in 1995 in Borland C++ 3.1 on my old DOS computer. When I was a Junior in High School [ca 1993] I was part of what they call a “coding bootcamp” today. There were 2 Support Engineers from Borland, Tom Orsi and Jeff Peters, and they volunteered to teach a small group of HS students how to program in C. Most, but not all of us, had prior programming experience in another language. My experience was with Microsoft QBasic, Visual Basic for DOS, and Visual Basic 3.0 for Windows.

Continue reading “Introduction to VGALIB”