delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/11/13:38:25

From: "Luiz Fernando" <luisoft AT myway DOT com DOT br>
To: <djgpp AT delorie DOT com>
Subject: Interrupt problem....
Date: Sun, 11 Apr 1999 14:26:11 -0300
Message-ID: <01be8440$64e8bbe0$LocalHost@aguia>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

Hi,

    How can i convert this old program written for Borland C++ v3.1 compiler
to DJGPP ? THe questionis how can i write interrupt-service routines(ISR)
using DJGPP ? Do you have any tutorial or source code ? Could you translate
the following code to use it with DJGPP compiler ?


#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>

#define TIMER_KEEPER_INT 0x1C

// holds old com port interrupt handler.
void (_interrupt _far *Old_Isr)();

long time =0 ;

void _interrupt _far Timer(void)
{
   // increment global time variable
  time++;
}

void main(void)
{
  // install our ISR
  Old_Isr = _dos_getvect(TIME_KEEPER_INT);
  _dos_setvect(TIME_KEEPER_INT, Timer);
 // wait for the player to hit a key
 while(!kbhit())
  {
    _settextposition(0,0);
    printf("\nThe timer reads:%ld    ",time);
  }

  // replace old ISR.
  _dos_setvect(TIME_KEEPER_INT, Old_Isr);
}


Thanks for the help,

Luiz Fernando
luisoft AT myway DOT com DOT br




- Raw text -


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