Share this post

Link to post

Share on other sites

Thanks for trying but it still doesn''t work, if someone could just put something brief together how to change the colour of the background in dos, or draw lines, circles etc.. in dos, or point me in the direction of a tutorial I would be sooo greatful

0

Share this post

Link to post

Share on other sites

Oh my god, its DOS!!!!! I haven''t seen mode 0x13 and far pointers in a long time. To start with, MK_FP is a macro to make a far pointer. You have to understand the way far pointers work. They are 20 bit numbers composed of a segment and an offset (both 16 bit) -- this is because noone thought they would ever need a whole 32 bits to address memory. Anyways the value of the far pointer is segement shifted left 4 bits + offset. Since you want segement 0xA000, you can just use char far vga = (char far*) 0xA0000, or define MK_FP as ((seg<<4) + off). As for pixel plotting, you have 320 x 200 pixels and 256 possible colors per pixel (you need to set the value of these colors in the palette, otherwise i think a bunch default to black, but i don''t remeber). To set a pixel with the given color, just use vga [x + y*320] = color. Of course you can do some optimizing (especially with the multiply or by using longs) if you will be setting multiple pixels. My 16 bit programming is very fuzzy right now, but I hope this helps...