.gitignore | ||
asmvga.asm | ||
bmp.c | ||
bmp.h | ||
chkn640.bmp | ||
dpmi.c | ||
dpmi.h | ||
main.c | ||
makefile | ||
README.md | ||
run | ||
setup.sh | ||
simple.c | ||
svga.c | ||
vesa.c | ||
vesa.h | ||
vga.asm |
VGA and SVGA code examples
Some code to exercise the four logic units of the VGA card in 256 color mode, as well as code that gets SVGA mode working. Most of this is in C, but some of it's in assembler to help me learn assembler better, as well as get comfortable with C/asm interop on x86.
Check out the video I wrote all this code to support: https://makertube.net/w/sQSZJcxh8CRuMZWVh8Q6aF
Read more about my project The Industrious Rabbit at https://theindustriousrabbit.com/
Building
You'll need Open Watcom 2.0. You can use
wmake
on the makefile
to build some of these, and
wcl386 -q -bt=dos -l=dos4g <c or asm files>
for the others. All of these
run in 32-bit protected mode within a DPMI wrapper and in a flat memory space,
because I really don't want to deal with segment:offset addressing.
What's here
main.c
and vga.asm
C code that exercises a bunch of the VGA registers by transforming a colored
cube of all 256 VGA colors in different ways. The display is set to unchained
mode. Lots of latch copies and transforming data with stuff in the latches.
The core of the transformation code is in vga.asm
, which is also where the
keyboard handler for exiting the program lives.
svga.c
, vesa.c
, dpmi.c
, and bmp.c
Display a bitmap in a 640x480x256 SVGA mode. Trying to find a fully working SVGA, DOS Protected Mode Interface, and VESA example was tough, so hopefully this will help you out if you're trying to do the same thing!
simple.c
and asmvga.asm
These both draw a single dot on the screen, but in different ways:
simple.c
draws the dot directly to VGA memoryasmvga.asm
allocates a block of RAM, writes the pixel there, then shovels the data from the RAM into the VGA card withrep movsb
, which is the procedure a game would use to draw to a non-VGA RAM buffer and then copy when done.