www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/19/06:29:50

Message-ID: <C@dancall.dk>
Date: 19 Feb 97 11:11:07 EDT
From: KG AT dancall DOT dk
Sender: kg AT dancall DOT dk
To: djgpp AT delorie DOT com
Subject: <none>
MIME-Version: 1.0


I have a C program (normaly compiled and linked in Borland C) that have 
been modified to be used on your platform.
Using your GCC version 2.7.2.1 compiler and linker to create the exe 
file a few problems have been seen that I hope you can help me with !

1.  Using interrupt the way you describe in INFO replacing old 
interrupt vector with a new vector and saving the old vector, the 
program crasses.
      Instead I would like to make an assembler interrupt handler, but 
I do not know how.
      The handler will need to access about 64K memory and must run in 
procted mode.
      Can you please explane how I make an assembler interrupt handler, 
demonstrating it in an example ?

2.  In the program I save the old timer interrupt handler (0x08) 
address and set it to a new address.
     For every 100 times the new timer interrupt handler has been 
called the old timer interrupt handler must be accessed.
     How do I access the old timer interrupt handler only ones for 
every 100 times the timer interrupt handler has been accessed, on your 
platform ?

3. Can you please explane why the example below do not work properly 
when OS_getch() are called again under case 0?
     But when 'key = OS_getch();' are swapped with 'key = getch();' the 
program work properly.
     Calling OS_getch() twice in Borland C do not cause any problems.
    The behavia of the problem: pressing arrow down key ok, but when 
pressing key up then down will be selected.
    Pressing key up again and now up will be selected.

Example on keyboard handling:

void menu(void)
{
  char key;

  do
  {
    key = OS_getch();
    switch(key)
    {
      case 0:
        key = OS_getch();       /* Do not work with this line */
        /* key = getch(); */    /* Work with this line */
        switch(key)
        {
          case UP:
            /* move one up */
            break;
          case DOWN:
            /* move one down */
            break;
          default:
           break;
        }
        break;
      case RETURN:
        break;
    }
  }
  while(key != ESC);
}


char OS_getch(void)
{
  do
  {
    do_something();
  }
  while(!kbhit());

  return getch();
}


Best regards

Kim Gravesen
Dancall Telecom
KG AT dancall DOT dk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019