delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/08/14:34:23

Date: Sun, 8 Jan 1995 12:47:24 -0500 (EST)
From: Kimberley Burchett <OKRA AT max DOT tiac DOT net>
Subject: Re: timer int
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: DJGPP Mailing List <djgpp AT sun DOT soe DOT clarkson DOT edu>

On Sun, 8 Jan 1995, Eli Zaretskii wrote:

> >   I don't feel like spamming the group with my code unless someone asks 
> > for it, so I'll leave it at this and hope it might be enough to ring a 
> 
> Not the whole program, but a snippet thereof: how do you call the old
> timer interrupt routine?

..... snip from InitTimer()

  // save old interrupt vector
  _go32_dpmi_get_protected_mode_interrupt_vector(8, &OldTimerPMSegInfo);
  _go32_dpmi_get_real_mode_interrupt_vector(8, &OldTimerRMSegInfo);

  // _simulate_fcall_iret() needs a regs struct, so copy old handler addr.
  memset(&OldTimerRegs, 0, sizeof(OldTimerRegs));
  OldTimerRegs.x.cs = OldTimerRMSegInfo.rm_segment;
  OldTimerRegs.x.ip = OldTimerRMSegInfo.rm_offset;

..... end snip


static void TimerInternalHandler() {

  TimerHandler();                  // call user's handler

  // Adjust the count of clock ticks
  counter += counter_inc;

  // is it time for BIOS to do its thing?
  if (counter >= 65536) {
    // I've replaced this area with a call to my Error() function which
    // would abort the program but it never gets called.
    counter -= 65536;
    _go32_dpmi_simulate_fcall_iret(&OldTimerRegs);
  }
  else    // if not, acknowledge the interrupt
    outportb(0x20, 0x60);
}

							Kim


- Raw text -


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