#include (iostream)
#include (stdlib.h)
#include (dos.h)
#include (mem.h)
#include (conio.h)
unsigned char *vga = (unsigned char *) MK_FP
(0xA000, 0);
// Go into Mcga mode ($13h)
void SetMcga() {
_AX = 0x0013;
geninterrupt (0x10);
}
// Go back to text mode
void SetText() {
_AX = 0x0003;
geninterrupt (0x10);
}
//Clear the screen
void Cls(unsigned char Col) { //Color between 0 to 255
memset(vga, Col, 0xffff);
}
//Plot a pixel
void PutPixel(int x, int y, unsigned char Col)
{ // 0 to 255
memset(vga+x+(y*320),Col,1);
}
////////////////// // Main Program // /////////////////
int loop1, loop2;
void main() {
SetMcga();
Cls(32);
getch();
Cls(90);
getc ();
Cls(5);
getch();
Cls(200);
getch();
Cls( 50);
getch();
//place pixels all around
PutPixel( 50, 100, 25 );
PutPixel( 100, 199, 50);
PutPixel( 250, 150, 75);
PutPixel( 125, 125, 100);
PutPixel( 200, 113, 125);
PutPixel( 30, 30, 150 );
PutPixel( 210, 122, 175);
PutPixel( 80, 80, 200);
PutPixel( 260, 148, 225);
PutPixel( 223, 111, 250);
getch();
//cover the screen with random pixels
for(loop1=0, loop1(320, loop1++) {
for(loop2=0, loop2(200, loop2++) {
PutPixel(loop1, loop2, rand());
}
}
getch();
Cls(0);
getch();
SetText();
rintf('Graphics test complete. Press any key to continue... ');
getch();
}
Mcga 13h mode in C++
Im new to C++. Im learning about mcga graphics mode. I read a tutorial on it in C++ and made a test program to see what I learned. All its supposed to do is play with the graphics a bit. When I tried to compile it I got a crap load of error messages from my compiler, Dev-C++. I dont have any idea what they mean! Can anyone help me out?! Here are the errors im getting.
implicit declaration of function `int MK_FP(...)'
[Warning] In function `void SetMcga()':
`_AX' undeclared (first use this function)
[Build Error] (Each undeclared identifier is reported only once
[Build Error] for each function it appears in.)
implicit declaration of function `int geninterrupt (...)' [Warning] In function `int main(...)':
parse error before `)' parse error before `;'
character constant too long
And here is the test program I wrote.
[edited by - sum1 on November 17, 2002 10:34:40 PM]
You need a DOS compiler. Dev-C++ won't compile Real Mode applications.
Download TurboC++ 1.01...
http://community.borland.com/article/0,1410,21751,00.html
Or TurboC 2.01....
http://community.borland.com/article/0,1410,20841,00.html
[edited by - Xanth on November 18, 2002 2:25:25 PM]
Download TurboC++ 1.01...
http://community.borland.com/article/0,1410,21751,00.html
Or TurboC 2.01....
http://community.borland.com/article/0,1410,20841,00.html
[edited by - Xanth on November 18, 2002 2:25:25 PM]
"I thought Genius lived in bottles..." - Patrick Star
Ok, ill give it a try!
By da way, are you that same guy from the gametutorials forum? Sorry I didnt get a chance to reply there. I cant get onto the forum part of the site! Im guessing its down or something.
By da way, are you that same guy from the gametutorials forum? Sorry I didnt get a chance to reply there. I cant get onto the forum part of the site! Im guessing its down or something.
quote: By da way, are you that same guy from the gametutorials forum?
Yup.
quote: Sorry I didnt get a chance to reply there. I cant get onto the forum part of the site! Im guessing its down or something.
Yeah it must be down, no apology necessary
"I thought Genius lived in bottles..." - Patrick Star
Ok, I downloaded and installed Turbo C++. I copied and pasted the code to the compiler, but it cant seem to find the header files. I tried changing the directory that it looks in for the header files. I also checked for the header files and found them all. also tried re-installing it. Didnt help. Got any suggestions?
[edited by - sum1 on November 18, 2002 8:26:25 PM]
[edited by - sum1 on November 18, 2002 8:26:25 PM]
Yup.
Go to the TC++ directory then \bin. Now open turboc.cfg, and adjust the following lines...
-IC:\TURBOCPP\INCLUDE
-LC:\TURBOCPP\LIB
(Note: those lines will look a little different for you. The above example is what my turboc.cfg is set to.)
Anyway just change the paths, and you should be all set.
(Also Note: Those are the only two lines )
[edited by - Xanth on November 18, 2002 12:16:01 AM]
Go to the TC++ directory then \bin. Now open turboc.cfg, and adjust the following lines...
-IC:\TURBOCPP\INCLUDE
-LC:\TURBOCPP\LIB
(Note: those lines will look a little different for you. The above example is what my turboc.cfg is set to.)
Anyway just change the paths, and you should be all set.
(Also Note: Those are the only two lines )
[edited by - Xanth on November 18, 2002 12:16:01 AM]
"I thought Genius lived in bottles..." - Patrick Star
Still didnt work... I had to change the file to .txt before editing it. I put in the correct path then I saved it back as .CFG. I tried it and it still gave me the same error messages saying it couldnt open the header files.
P.S. I also tried putting the header files in the same directory as the source, but it still didnt work... 8^(
P.S. I also tried putting the header files in the same directory as the source, but it still didnt work... 8^(
Shouldn''t
#include (iostream)
#include (stdlib.h)
#include (dos.h)
#include (mem.h)
#include (conio.h)
be
#include <iostream>
#include <stdlib.h>
#include <dos.h>
#include <mem.h>
#include <conio.h>
or is that something to do with the code display portion of this forum?
#include (iostream)
#include (stdlib.h)
#include (dos.h)
#include (mem.h)
#include (conio.h)
be
#include <iostream>
#include <stdlib.h>
#include <dos.h>
#include <mem.h>
#include <conio.h>
or is that something to do with the code display portion of this forum?
hmmm, thats strange. Well, my original source has the pointy brackets <>.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement