getting keyboard input in mode 13

Im making a game in mode13 and whenever i try and use something along the lines of:

vgamode(); //Set video mode to 13
//PLOTTING AND OTHER GRAPHICS OPERATIONS
//GO HERE
char inp; //For input from the keyboard
inp = getch();
//ETC.

When i do that, the screen doesnt switch to vga...it just stays in text mode, and it doesnt display any of the graphics.  It just kinda "skips" them.

I need to know how to get input from the user while in vga mode.  Thanks.  
PeanutheadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nietodCommented:
I a graphics mode, you need to perform low-level I/O (you especially can't use anything that does echoing or line buffering).  You might try using DOS service 6.

continues.
0
nietodCommented:
For example,

char  // Character read.  0 if no character was read.
GetChar()
{
   char Chr = 0;

   _asm
   {
      MOV AH,06h
      MOV DL,0FFh
      INT 21h
      JNZ ABORT
      MOV Chr,AL

ABORT:
   }
   return Chr;
}
0
PeanutheadAuthor Commented:
Could you give me that code in C++...assemler doesnt seem to wanna work in my compiler :), then ill accept your answer
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

nietodCommented:
There is no C/C++ code for this.  Standard C/C++ provides I/O only through the standard streams, which are text based.  You need to use low-level OS-specific techniques to do this.  In DOS this means executing DOS service interrupts.  You will either need to 1) use a compiler that can porform the inline assembly, 2) write and compile the procedures in assembly and link to the static library produced, or 3) link to some non-standard library that provides this functionallity.

what compiler are you using?
What is the error you get when it tries to compile.

it is not necessary to reject an answer when you only want addtional information and/or clarification from the expert that answered. You should reject only if you want another expert to work on the question.
0
PeanutheadAuthor Commented:
Sorry about the rejection thing...
Im using Turbo C++ verion 1.0
Dont laugh...i got it on a disk out of a book.

The error message i get is:
Cannot find executable: TASM
0
PeanutheadAuthor Commented:
Sorry about the rejection thing...
Im using Turbo C++ verion 1.0
Dont laugh...i got it on a disk out of a book.

The error message i get is:
Cannot find executable: TASM
0
nietodCommented:
You need to supply your own copy of TASM.  (Most C/C++ packages are shipped with an assembler, but not Borland's, not even their current ones--I believe.)  TASM is available cheaply from Borland, but make sure the copy they are distributing will work with an old copy of BTC.

You may want to upgrade to a more modern compiler.  C++ has changed in many ways since the days of TC 1.0. and many problems with the borland line of compilers has been solved since then.  Unfortunately the latest and gratest compilers don't support 16 bit code.  However borland still distributes BC 4.5 (far superior to TC 1) with some of its 32 bit products.  I recommend you look into it.  

VC 1.42 is probably about the same age as your TC 1, so I don't really recommend it, but it does do inline assembly without the need to an additional assembler.  it is still available from MS bundled with other products, like the DDK.

You may also want to think about making the switch to 32 bits.  You are about a decade behind the times....
0
Lab_RatCommented:
>>>When i do that, the screen doesnt switch to vga...it just stays in text mode, and it doesnt display any of the graphics.  It just kinda "skips" them.

Peanuthead, you mean the computer NEVER enters VGA mode?
0
Lab_RatCommented:
Have you ever tried to increment an unsigned char huge pointer in Turbo C++ using the shorthand post increment notation?

unsigned char huge *alpha;
alpha++;

Be warned, the version I was using skipped them!
0
PeanutheadAuthor Commented:
Well, i might be wrong about not going into VGA mode, but it gets out of it the second it hits the getch()
0
PeanutheadAuthor Commented:
Well, i might be wrong about not going into VGA mode, but it gets out of it the second it hits the getch()
0
nietodCommented:
So what are you going to do?
0
PeanutheadAuthor Commented:
Well, is there any was i can get a hold of a free TASM executable somewhere on the 'net?  Or, does DJGPP allow for assembly?
0
nietodCommented:
>> is there any was i can get a hold of a free TASM
Not legally.  But it is available for under $100 I beleive.

>> does DJGPP allow for assembly?
No idea.

I would really  recommend you move to a modern compiler.  If you want to actually get something done, the minimal amount of money is worth it.  You can get a student copy of VC for about $100 bucks.  That is 100 of times more powerful than TC.  Borland probably has similar offers.
0
Matthew85HCommented:
try getch as suggested

switch(getch())
{
case 'a': do this;
}

if it hits a than it'll "do this"

or

switch(getch())
{
case 78: do this;
}
78 is one of the arrows, it's key #78, there are lists of all the keys

of course this is bad, cuz it doesn't continue UNTIL you press a buttons so add
if(kbhit())

so only if you hit the keyboard, if not it continues with the program

if(kbhit())
{
switch(getch())
{
case 'a': do this;
}
}

of course this is not good cuz it doesn't do multiple keyboard functions, in order to do that, you'll hafta switch the keyboard interrupt and change it to another one, it's pretty complicated, but that's what I'm currently using.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nietodCommented:
Did mathew85, answer work for you?
0
Lab_RatCommented:
Ooooo-Ahhhhhhh!
It worked for me!
:)
0
Matthew85HCommented:
GREAT! anyhoo.....

http://fly.to/sflare
0
PeanutheadAuthor Commented:
BTW, good site Matthew...
0
Matthew85HCommented:
GOOD you say? the site plain sucks NOW, the layout... it'll change soon...
0
PeanutheadAuthor Commented:
i dont give a damn about the layout, its the first site I came across that got me doin graphics stuff, and that makes it good :-).
0
Matthew85HCommented:
so u a game coder? you hae ICQ? talk on that,instead of posting here
0
Lab_RatCommented:
I'm a coder, check my game @
http://surf.to/labratspage
Intrested?
0
PeanutheadAuthor Commented:
I have ICQ, but im at school now, so i cant give u my ICQ, its too long for my petty mind to memorize....if you have AIM, my name is Lmn0tdumb  Copy and paste that cuz its spelled wierd.  Yeah im a game coder but i havnt made anything worth showing off.  Its all perty ugly ;-)  Ill post my ICQ when i get home.
0
PeanutheadAuthor Commented:
Ah, i got me ICQ # right ere:
51603385
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.