Archived

This topic is now archived and is closed to further replies.

FlorianapoliS

MK_FP WTF???

Recommended Posts

Hi, I decided to learn C++ yesterday, I''ve had about 6 months programming experince in good ol''Visual Basic, so I found that most of the basic principals were the same, and it was coming really quickly to me. I wanted to make a little program that just changed the color of the screen but when I went to compile it, it said "Call to undefined function MK_FP?" I''m using Borland C++ Compiler 5.5.1 Here is the source code (sorry if its a bit messy I''m only a mega Newbie): Source Code ------------------------ #include #include #include #include #include unsigned char *vga = (unsigned char *) MK_FP(0xA000, 0); void SetMCGA(); void SetText(); void Cls(unsigned char Col); void SetMCGA() { _AX = 0x0013; geninterrupt (0x10); } void Cls(unsigned char Col) { memset(vga, Col, 0xffff); } void SetText() { _AX = 0x0003; geninterrupt (0x10); } void main() { clrscr(); SetMCGA(); Cls(90); getch(); SetText(); printf ("Hello World!\n\n\n"); printf ("Hit any key to Exit..."); getch(); } --------------------- End of Source Thanks for looking.

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

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...

Share this post


Link to post
Share on other sites