• Please review our updated Terms and Rules here

Help with CGA Grpahics

Sanocon

New Member
Joined
Sep 4, 2021
Messages
2
So I've been trying to find tutorials on programming with CGA Graphics. Mostly what I'm trying to find is how to place pixels on the screen and choose what color to use. I'm planning to use C for the program but will use assembly if needed. wishing to know this for mode 4 and mode 6. also side note how do i change the foreground color on mode 6?
 
PCRetroProgrammer has been doing some videos recently on just this topic! https://www.youtube.com/channel/UCI70OkBmDW9yb_n2ICayysg/videos . You can also just play around with writing bytes to segment 0xb800, offsets 0 to 0x3fff and see what happens. Some clues: bit 13 of the offset is actually bit 0 of the y coordinate in graphics modes, and the most significant bits are on the left within each byte, but otherwise the memory layout is what you'd expect. To change the foreground colour in mode 6, output the desired colour to port 0x3d9.
 
Please download source codes of the follwing games, clonk, commander keen, catacombs, from archive.org which have cga and ega routines wriitten in C and assembly, the code is released under GPL and is available on github as well I think.
 
Back
Top