vga-logic-processor-examples/README.md

48 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2024-05-27 11:15:18 +00:00
# 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.
2024-05-27 11:15:18 +00:00
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](https://open-watcom.github.io/). 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
2024-05-27 12:45:40 +00:00
mode. Lots of latch copies and transforming data with stuff in the latches.
2024-05-27 11:15:18 +00:00
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 memory
* `asmvga.asm` allocates a block of RAM, writes the pixel there, then
shovels the data from the RAM into the VGA card with `rep movsb`, which
is the procedure a game would use to draw to a non-VGA RAM buffer and then
copy when done.