Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

iret from dpmi interrupt handler (Developers)

posted by RayeR(R) Homepage, CZ, 20.03.2018, 00:59

You don't need to care about ret/iret in djgpp.
just define your ISR as simple C function:

void covox_playback_isr(void)
{}

and here is sample code how to install your new ISR:

//***************** install Covox playback ISR at timer interrupt ***********
void covox_playback_install(void)
{
  printf("Installing new timer ISR for Covox playback...n");
  // lock the functions and variables
  _go32_dpmi_lock_code(covox_playback_isr,(DWord)sizeof(covox_playback_isr));
  _go32_dpmi_lock_data((void *)&sound_buffer_cnt,(DWord)sizeof(sound_buffer_cnt));
  _go32_dpmi_lock_data((void *)&sound_data_request,(DWord)sizeof(sound_data_request));
  // load the address of the old timer ISR into the OldISR structure
  _go32_dpmi_get_protected_mode_interrupt_vector(INT_TIMER,&timer_isr_old);
  // point NewISR to the proper selector:offset for handler function
  timer_isr_new.pm_offset=(DWord)covox_playback_isr;
  timer_isr_new.pm_selector=_go32_my_cs();
  // chain the new ISR onto the old one so that first the old INT_TIMER ISR will be called, then the new timer ISR
//  _go32_dpmi_set_protected_mode_interrupt_vector(INT_TIMER,&timer_isr_new);
  _go32_dpmi_chain_protected_mode_interrupt_vector(INT_TIMER,&timer_isr_new);
}

//***************** remove Covox playback ISR from timer interrupt chain ****
void covox_playback_uninstall(void)
{
  printf("nRemoving new timer ISR for Covox playback...n");
  // load the old timer ISR back without the new ISR chained on
  _go32_dpmi_set_protected_mode_interrupt_vector(INT_TIMER,&timer_isr_old);
  covox_playback_setup_fs(0);          // set default timer speed
}

As I told, under DPMI host you cannot manipulate IVT on your own will but ratther use DPMI function wrappers to do things correctly. Read DJGPP FAQ documnt for more...

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
15664 Postings in 1426 Threads, 259 registered users, 13 users online (0 registered, 13 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum