Ejemplo n.º 1
0
 void SetSysIntVect (int16 Num) {
	switch (Num) {
	  case 1 : 
		       break; 
	  case 2 : 
		       break; 
	  case 0x1B : 
	               _dos_setvect(0x1B, DsspIntHandler_1Bh);
		       break; 
	  case 0x1C : 
	               _dos_setvect(0x1C, DsspIntHandler_1Ch);
		       break; 
	  case 0x23 : 
	               _dos_setvect(0x23, DsspIntHandler_23h);
		       break; 
	  case 0x24 : 
	               _dos_setvect(0x24, DsspIntHandler_24h);
		       break; 
	  case 0x61 : 
	               _dos_setvect(0x61, DsspIntHandler_61h);
		       break; 
          		       
	  default:
		       ;

  	} // switch
 }// SetSysIntVect
Ejemplo n.º 2
0
void main(void)
 {
   void interrupt (*original_handler)();

   int old_count = 0;

   original_handler = _dos_getvect(5);

   _disable();  // Turn off interrupts during _dos_setvect
   _dos_setvect(5, handler);
   _enable();

   printf("Press Shift-PrtSc three times or any key to end\n");
     
   while (count < 3)
     if (count != old_count)
       {
         printf("Shift-PrtSc pressed\n");
         old_count = count;
       }
   
   _disable();
   _dos_setvect(5, original_handler);
   _enable();
 }
Ejemplo n.º 3
0
void __restore_int_ctrl_break( void )
{
    if( __old_int_ctrl_break == 0 ) {
        return;
    }
    if( __int23_exit == __restore_int ) {
        __int23_exit = __restore_int23;
    } else if( __int23_exit == __restore_int_ctrl_break ) {
        __int23_exit = __null_int23_exit;
    }
#if defined(__WINDOWS_386__)
    TinySetVect( CTRL_BRK_VEC, __old_int_ctrl_break );
#elif defined( __386__ )
    if( _IsPharLap() ) {
        pharlap_rm_setvect( CTRL_BRK_VEC, __old_int_ctrl_break );
        pharlap_pm_setvect( CTRL_BRK_VEC, __old_pm_int_ctrl_break );
    } else if( __DPMI_hosted() == 1 ) {
        DPMISetRealModeInterruptVector( CTRL_BRK_VEC, __old_int_ctrl_break );
        DPMISetPMInterruptVector( CTRL_BRK_VEC, __old_pm_int_ctrl_break );
    } else {
        _dos_setvect( CTRL_BRK_VEC, __old_int_ctrl_break );
    }
#else
    _dos_setvect( CTRL_BRK_VEC, __old_int_ctrl_break );
#endif
    __old_int_ctrl_break = 0;
}
Ejemplo n.º 4
0
void __grab_int_ctrl_break( void )
{
    if( __old_int_ctrl_break == 0 ) {
#if defined(__WINDOWS_386__)
        __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC );
        TinySetVect( CTRL_BRK_VEC, (void (_WCNEAR *)(void))__int_ctrl_break_handler );
#elif defined( __386__ )
        if( _IsPharLap() ) {
            __old_int_ctrl_break = pharlap_rm_getvect( CTRL_BRK_VEC );
            __old_pm_int_ctrl_break = pharlap_pm_getvect( CTRL_BRK_VEC );
            pharlap_setvect( CTRL_BRK_VEC, (pfun) (void (_WCNEAR *)(void))__int_ctrl_break_handler );
        } else if( __DPMI_hosted() == 1 ) {
            DPMILockLinearRegion((long)__int_ctrl_break_handler,
                ((long)__restore_int23 - (long)__int_ctrl_break_handler));
            __old_int_ctrl_break = DPMIGetRealModeInterruptVector( CTRL_BRK_VEC );
            __old_pm_int_ctrl_break = DPMIGetPMInterruptVector( CTRL_BRK_VEC );
            DPMISetPMInterruptVector( CTRL_BRK_VEC, __int_ctrl_break_handler );
        } else {        /* what it used to do */
            __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC );
            _dos_setvect( CTRL_BRK_VEC, __int_ctrl_break_handler );
        }
#else
        __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC );
        _dos_setvect( CTRL_BRK_VEC, __int_ctrl_break_handler );
#endif
        if( __int23_exit == __null_int23_exit ) {
            __int23_exit = __restore_int_ctrl_break;
        } else if( __int23_exit == __restore_int23 ) {
            __int23_exit = __restore_int;
        }
    }
}
Ejemplo n.º 5
0
Archivo: timer.c Proyecto: mdurrer/cgd
void init_timer(int res_hz)
{
	_disable();

	if(res_hz > 0) {
		int reload_val = DIV_ROUND(OSC_FREQ_HZ, res_hz);
		set_timer_reload(reload_val);

		tick_interval = DIV_ROUND(1000, res_hz);
		ticks_per_dos_intr = DIV_ROUND(65535L, reload_val);

		inum = PIT_TIMER_INTR;
		prev_timer_intr = _dos_getvect(inum);
		_dos_setvect(inum, timer_irq);
	} else {
		tick_interval = 55;

		inum = DOS_TIMER_INTR;
		prev_timer_intr = _dos_getvect(inum);
		_dos_setvect(inum, dos_timer_intr);
	}
	_enable();

	atexit(cleanup);
}
Ejemplo n.º 6
0
void __restore_int23( void )
{
    if( __old_int23 == 0 ) {
        return;
    }
    if( __int23_exit == __restore_int ) {
        __int23_exit = __restore_int_ctrl_break;
    } else if( __int23_exit == __restore_int23 ) {
        __int23_exit = __null_int23_exit;
    }
#if defined(__WINDOWS_386__)
    TinySetVect( 0x23, __old_int23 );
#elif defined( __386__ )
    if( _IsPharLap() ) {
        pharlap_rm_setvect( 0x23, __old_int23 );
        pharlap_pm_setvect( 0x23, __old_pm_int23 );
    } else if( __DPMI_hosted() == 1 ) {
        DPMISetRealModeInterruptVector( 0x23, __old_int23 );
        DPMISetPMInterruptVector( 0x23, __old_pm_int23 );
    } else {        /* this is what it used to do */
        _dos_setvect( 0x23, __old_int23 );
    }
#else
    _dos_setvect( 0x23, __old_int23 );
#endif
    __old_int23 = 0;
}
Ejemplo n.º 7
0
void main(void)
 {
   int i;

   // Zero the function counts
   for (i = 0; i < 255; i++)
     function[i] = 0;

   original_handler = _dos_getvect(0x21);
   _disable();
   _dos_setvect(0x21, handler);
   _enable();

   printf("This is a message\n");
   fprintf(stdout, "This is a second message\n");

   printf("Current disk is %c\n", getdisk() + 'A');

   _disable();
   _dos_setvect(0x21, original_handler);
   _enable();


   for (i = 0; i <= 255; i++)
     if (function[i])
       printf("Function %x called %d times\n", i, function[i]);
 }
Ejemplo n.º 8
0
void run_dos () {

	static char command[COMMAND_LENGTH] = "";
	register char *s;
	register ret, o_errno;
	CURSOR	 Old;

	if ((s = getstring(COMMAND_LENGTH, command, "Выполнение команды DOS",
			 "Введите команду DOS")) != NULL) {
		strncpy (command, s, COMMAND_LENGTH);
		_dos_setvect (0x1C, old_timer);
		Old = VGetCursor ();
		VMove (0, 0);
		VSync ();
		VIClear ();
		s = strcmp (command, "") == 0 ? "COMMAND.COM" : command;
		ret = system (s);
		o_errno = errno; /* VRedraw () портит errno */
		fprintf (stderr, "Нажмите 'Enter' для продолжения.");
		(void) getchar ();
		VSetCursor( Old );
		VRedraw ();
		_dos_setvect (0x1C, timer_int);
		old_addr = -1;
		if (ret == -1)
			error ("DOS : %s", sys_errlist[o_errno]);
	}
}
Ejemplo n.º 9
0
//............................................................................
void QF::onCleanup(void) {             // restore the original DOS vectors ...
    QF_INT_LOCK(dummy);
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_UNLOCK(dummy);

    QS_EXIT();                                                      // exit QS
    _exit(0);                                                   // exit to DOS
}
Ejemplo n.º 10
0
/*..........................................................................*/
void QF_stop(void) {
                                    /* restore the original DOS vectors ... */
    QF_INT_DISABLE();
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_ENABLE();

    _exit(0);                                                /* exit to DOS */
}
Ejemplo n.º 11
0
int monint( int print )
{
    int i;

    for( i = 0; i < NUM_INTS; i++ ) {
        prev_int[i] = _dos_getvect( i );
    }

    if( print ) techoutput( "\nInstalling interrupt handlers\n" );
    for( i = NUM_INTS - 1 ; i >= 0; i-- ) {
        _dos_setvect( i, new_int[i] );
    }

    if( print ) {
        Sample_On = 1;
        while( int_tick[ 8 ] < 24 );
        Sample_On = 0;

        techoutput( "Normal system operation:\n" );
        int_summary();
        memset( (void *)int_tick, 0, sizeof( int_tick ) );

        techoutput( "Starting exception test...\n" );
    }
    Sample_On = 1;
    _TEST_NDP();
    while( int_tick[ 8 ] < 24 );
    Sample_On = 0;

    _INIT_NDP();

    NDP_Status = NDP_Env.status_word;

    if( print ) {
        techoutput( "System operation with NDP divide by zero exception:\n" );
        int_summary();
        techoutput( "Restoring interrupt handlers\n" );
    }
    for( i = NUM_INTS - 1 ; i >= 0; i-- ) {
        _dos_setvect( i, prev_int[i] );
    }

#define TEST_FPU(x,y) techoutput( "\t%s " y "\n", \
                ((NDP_Status & x) ? "  " : "No") )

    if( print ) {
        techoutput( "80x87 status:\n" );
        TEST_FPU( SW_INVALID, "invalid operation" );
        TEST_FPU( SW_DENORMAL, "denormalized operand" );
        TEST_FPU( SW_ZERODIVIDE, "divide by zero" );
        TEST_FPU( SW_OVERFLOW, "overflow" );
        TEST_FPU( SW_UNDERFLOW, "underflow" );
        TEST_FPU( SW_INEXACT, "inexact result" );
    }

    return( (int_tick[ 2 ] != 0) && ((NDP_Status & SW_ZERODIVIDE) != 0) );
}
Ejemplo n.º 12
0
/*-----------------------------------------------------------*/
portBASE_TYPE xPortStartScheduler( void )
{
pxISR pxOriginalTickISR;

	/* This is called with interrupts already disabled. */

	/* Remember what was on the interrupts we are going to use
	so we can put them back later if required. */
	pxOldSwitchISR = _dos_getvect( portSWITCH_INT_NUMBER );
	pxOriginalTickISR = _dos_getvect( portTIMER_INT_NUMBER );
	pxOldSwitchISRPlus1 = _dos_getvect( portSWITCH_INT_NUMBER + 1 );

	prvSetTickFrequency( configTICK_RATE_HZ );

	/* Put our manual switch (yield) function on a known
	vector. */
	_dos_setvect( portSWITCH_INT_NUMBER, prvYieldProcessor );

	/* Put the old tick on a different interrupt number so we can
	call it when we want. */
	_dos_setvect( portSWITCH_INT_NUMBER + 1, pxOriginalTickISR );

	/* The ISR used depends on whether the preemptive or cooperative
	scheduler is being used. */
	#if( configUSE_PREEMPTION == 1 )
	{
		/* Put our tick switch function on the timer interrupt. */
		_dos_setvect( portTIMER_INT_NUMBER, prvPreemptiveTick );
	}
	#else
	{
		/* We want the timer interrupt to just increment the tick count. */
		_dos_setvect( portTIMER_INT_NUMBER, prvNonPreemptiveTick );
	}
    #endif

	/* Setup a counter that is used to call the DOS interrupt as close
	to it's original frequency as can be achieved given our chosen tick
	frequency. */
	sDOSTickCounter = portTICKS_PER_DOS_TICK;

	/* Clean up function if we want to return to DOS. */
	if( setjmp( xJumpBuf ) != 0 )
	{
		prvExitFunction();
		xSchedulerRunning = pdFALSE;
	}
	else
	{
		xSchedulerRunning = pdTRUE;

		/* Kick off the scheduler by setting up the context of the first task. */
		portFIRST_CONTEXT();
	}

	return xSchedulerRunning;
}
Ejemplo n.º 13
0
//............................................................................
void QF::onStartup(void) {
                                         // save the origingal DOS vectors ...
    l_dosTmrISR = _dos_getvect(TMR_VECTOR);
    l_dosKbdISR = _dos_getvect(KBD_VECTOR);

    QF_INT_LOCK(dummy);
    _dos_setvect(TMR_VECTOR, &ISR_tmr);
    _dos_setvect(KBD_VECTOR, &ISR_kbd);
    QF_INT_UNLOCK(dummy);
}
Ejemplo n.º 14
0
/*..........................................................................*/
void QF_onStartup(void) {
                                      /* save the origingal DOS vectors ... */
    l_dosTmrISR = _dos_getvect(TMR_VECTOR);
    l_dosKbdISR = _dos_getvect(KBD_VECTOR);

    QF_INT_DISABLE();
    _dos_setvect(TMR_VECTOR, &ISR_tmr);
    _dos_setvect(KBD_VECTOR, &ISR_kbd);
    QF_INT_ENABLE();
}
Ejemplo n.º 15
0
static void RestoreInterruptVectors()
  {
#if ALLOW_ENVIRONMENT_GLOBALS
   void *theEnv;
   
   theEnv = GetCurrentEnvironment();

   _dos_setvect(0x23,SystemDependentData(theEnv)->OldCtrlC);
   _dos_setvect(0x1b,SystemDependentData(theEnv)->OldBreak);
#endif
  }
Ejemplo n.º 16
0
void main()
  {
    prev_int_1c = _dos_getvect( 0x1c );
    _dos_setvect( 0x1c, timer_rtn );
    while( compile_a_line() ) {
        if( clock_ticks >= BLIP_COUNT ) {
            putchar( '.' );
            clock_ticks -= BLIP_COUNT;
        }
    }
    _dos_setvect( 0x1c, prev_int_1c );
  }
Ejemplo n.º 17
0
/*..........................................................................*/
void QF_stop(void) {
                                    /* restore the original DOS vectors ... */
    if (l_dosTmrISR != (void interrupt (*)(void))0) { /* DOS vectors saved? */
        QF_INT_DISABLE();
        _dos_setvect(TMR_VECTOR, l_dosTmrISR);
        _dos_setvect(KBD_VECTOR, l_dosKbdISR);
        QF_INT_ENABLE();
    }
                                                       /* clear the display */
    //Video_clearScreen(VIDEO_BGND_BLACK | VIDEO_FGND_LIGHT_GRAY);
    _exit(0);                                                /* exit to DOS */
}
Ejemplo n.º 18
0
void    R_TrapInit( void ) {
//====================

    int enable_excpt;

    enable_excpt = __EnableF77RTExceptionHandling();

    if( enable_excpt ) {
        signal( SIGSEGV, AbnormalTerm );
        signal( SIGILL, AbnormalTerm );
    }
#if !defined( __WINDOWS__ )
    signal( SIGINT, BreakSignal );
#endif
#if defined( __DOS__ )
    if( __NonIBM ) {
        // Assume NEC
        BreakVector = 0x06;
    }
    CBSave = _dos_getvect( BreakVector );
    _dos_setvect( BreakVector, BreakHandler );
  #if defined( __386__ )
    if( _IsPharLap() ) {
        CBRealSave = _dos_getrealvect( BreakVector );
        _dos_setvectp( BreakVector, BreakHandler );
    }
  #endif
    ISave = _dos_getvect( IntOverFlow );
    _dos_setvect( IntOverFlow, IOvFlHandler );
    ZSave = _dos_getvect( IntDivBy0 );
    _dos_setvect( IntDivBy0, IDivZHandler );
#elif defined( __WINDOWS__ )
 #if !defined( __386__ )
    ISave = _dos_getvect( IntOverFlow );
    _dos_setvect( IntOverFlow, IOvFlHandler );
    ZSave = _dos_getvect( IntDivBy0 );
    _dos_setvect( IntDivBy0, IDivZHandler );
 #endif
#elif defined( __OS2_386__ ) || defined( __NT__ )
    signal( SIGBREAK, BreakSignal );
    if( enable_excpt ) {
        signal( SIGIDIVZ, IDivZSignal );
        signal( SIGIOVFL, IOvFlSignal );
    }
#elif defined( __OS2_286__ )
    signal( SIGBREAK, BreakSignal );
    DosSetVec( IntOverFlow, (PFN)IOvFlHandler, (PFN FAR *)&ISave );
    DosSetVec( IntDivBy0, (PFN)IDivZHandler, (PFN FAR *)&ZSave );
#endif
    FPTrapInit();
}
Ejemplo n.º 19
0
/*..........................................................................*/
void QF_onCleanup(void) {
                               /* restore the DOS system clock tick rate... */
    QF_INT_DISABLE();
    outp(0x43, 0x36);                 /* use mode-3 for timer 0 in the 8254 */
    outp(0x40, 0);                             /* load low  byte of timer 0 */
    outp(0x40, 0);                             /* load high byte of timer 0 */
                                   /* restore the original DOS vectors ... */
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_ENABLE();

    QS_EXIT();                                                   /* exit QS */
    _exit(0);                                                /* exit to DOS */
}
Ejemplo n.º 20
0
//............................................................................
void QF::onCleanup(void) {
                                  // restore the DOS system clock tick rate...
    QF_INT_DISABLE();
    outp(0x43, 0x36);                    // use mode-3 for timer 0 in the 8254
    outp(0x40, 0);                                // load low  byte of timer 0
    outp(0x40, 0);                                // load high byte of timer 0
                                       // restore the original DOS vectors ...
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    _dos_setvect(SPARE_VECTOR, l_dosSpareISR);
    QF_INT_ENABLE();

    QS_EXIT();                                                      // exit QS
    _exit(0);                                                   // exit to DOS
}
Ejemplo n.º 21
0
static void prvExitFunction( void )
{
const uint16_t usTimerDisable = 0x0000;
uint16_t usTimer0Control;

	/* Interrupts should be disabled here anyway - but no 
	harm in making sure. */
	portDISABLE_INTERRUPTS();
	if( sSchedulerRunning == pdTRUE )
	{
		/* Put back the switch interrupt routines that was in place
		before the scheduler started. */
		_dos_setvect( portSWITCH_INT_NUMBER, pxOldSwitchISR );
	}

	/* Disable the timer used for the tick to ensure the scheduler is
	not called before restoring interrupts.  There was previously nothing
	on this timer so there is no old ISR to restore. */
	portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerDisable );

	/* Restart the DOS tick. */
	usTimer0Control = portINPUT_WORD( portTIMER_0_CONTROL_REGISTER );
	usTimer0Control |= portTIMER_INTERRUPT_ENABLE;
	portOUTPUT_WORD( portTIMER_0_CONTROL_REGISTER, usTimer0Control );


	portENABLE_INTERRUPTS();
}
Ejemplo n.º 22
0
int kb_init(int bufsz)
{
	if(DONE_INIT) {
		fprintf(stderr, "keyboard driver already initialized!\n");
		return 0;
	}

	buffer_size = bufsz;
	if(buffer_size && !(buffer = malloc(buffer_size * sizeof *buffer))) {
		fprintf(stderr, "failed to allocate input buffer, continuing without\n");
		buffer_size = 0;
	}
	buf_ridx = buf_widx = 0;
	last_key = -1;

	memset(keystate, 0, sizeof keystate);
	num_pressed = 0;

	/* set our interrupt handler */
	_disable();
	prev_handler = _dos_getvect(KB_INTR);
	_dos_setvect(KB_INTR, kbintr);
	_enable();

	return 0;
}
Ejemplo n.º 23
0
void timer_exit(void)
{
    if (!timer_initialized)
        return;

    _disable();

    /* Reset channel 0 to square wave mode, 18.2 Hz. */

    outp(PIT_COMMAND, 54);
    outp(PIT_CH0_DATA, 0x00);
    outp(PIT_CH0_DATA, 0x00);

    _dos_setvect(PIT_SYSTEM_INT, timer.default_handler);

    _enable();

    if (dpmi_unlock_linear_region((uint32_t) &timer, sizeof(timer)) != 0)
        error("Unlocking timer data failed");

    if (dpmi_unlock_linear_region(
            (uint32_t) &timer_handler,
            (char *) timer_handler_end - (char *) timer_handler) != 0)
        error(" Unlocking timer interrupt handler failed");
}
Ejemplo n.º 24
0
void TS_Shutdown
   (
   void
   )

   {
   if ( TS_Installed )
      {
      TS_FreeTaskList();

      TS_SetClockSpeed( 0 );

      _dos_setvect( 0x08, OldInt8 );

#ifdef USESTACK

      deallocateTimerStack( StackSelector );
      StackSelector = NULL;

#endif

      // Set Date and Time from CMOS
//      RestoreRealTimeClock();

#ifdef LOCKMEMORY

      TS_UnlockMemory();

#endif
      TS_Installed = FALSE;
      }
   }
Ejemplo n.º 25
0
PUBLIC void SER_InitComInterrupts(SER_PComPort p, void __interrupt (__far *isr)(void)) {
    byte t;
    assert(p != NULL);

        // Init interrupts.
    outp(p->port + SERR_IER, 0);
    t = inp(p->port + SERR_MCR);
    t |= SERR_MCR_OUT2;
    t &= ~SERR_MCR_LOOPBACK;
    outp(p->port + SERR_MCR, t);

    if (isr != NULL) {
            // Save previous vector and hook vector.
        p->oldint = _dos_getvect(p->irq + 8);
        _dos_setvect(p->irq + 8, isr);
    }
        // Setup comm interrupts.

    outp(0x21, inp(0x21) & ~(1 << p->irq)); // Mask in port's IRQ.
    _disable();
    outp(p->port + SERR_IER, SERR_IER_RXREADY | SERR_IER_TXREADY);
    outp(0x20, 0xC2);

        // Raise DTR
    outp(p->port + SERR_MCR, inp(p->port + SERR_MCR) | SERR_MCR_DTR);

    _enable();
}
Ejemplo n.º 26
0
 void RestoreSysIntVect (int16 Num, int32 IHPtr1, int32 IHPtr2  ) {
	INT_HANDLER_PTR IHPtr ;
	// construct IHPtr using two long int values
	*(wptr)((lptr)(&IHPtr)+1) = (word)IHPtr2 ; // set low word of second high long part
	*((lptr)(&IHPtr)) = IHPtr1;  // set low long word part
 	_dos_setvect(Num, (INT_HANDLER_PTR)IHPtr);
 }// ResetSysIntVect
Ejemplo n.º 27
0
/*..........................................................................*/
void QF_onStartup(void) {
    uint16_t count;
                                      /* save the origingal DOS vectors ... */
    l_dosTmrISR   = _dos_getvect(TMR_VECTOR);
    l_dosKbdISR   = _dos_getvect(KBD_VECTOR);

    QF_INT_DISABLE();
    count = (uint16_t)(((1193180 * 2) / BSP_TICKS_PER_SEC + 1) >> 1);
    outp(0x43, 0x36);                 /* use mode-3 for timer 0 in the 8254 */
    outp(0x40, count & 0xFF);                  /* load low  byte of timer 0 */
    outp(0x40, (count >> 8) & 0xFF);           /* load high byte of timer 0 */

    _dos_setvect(TMR_VECTOR, &ISR_tmr);
    _dos_setvect(KBD_VECTOR, &ISR_kbd);
    QF_INT_ENABLE();
}
Ejemplo n.º 28
0
Archivo: port.c Proyecto: dessel/stf12
static void prvExitFunction( void )
{
const unsigned short usTimerDisable = 0x0000;
unsigned short usTimer0Control;

	/* Interrupts should be disabled here anyway - but no 
	harm in making sure. */
	portDISABLE_INTERRUPTS();
	if( sSchedulerRunning == pdTRUE )
	{
		/* Put back the switch interrupt routines that was in place
		before the scheduler started. */
		_dos_setvect( portSWITCH_INT_NUMBER, pxOldSwitchISR );
	}

	/* Disable the timer used for the tick to ensure the scheduler is
	not called before restoring interrupts.  There was previously nothing
	on this timer so there is no old ISR to restore. */
	portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerDisable );

	/* Restart the DOS tick. */
	usTimer0Control = portINPUT_WORD( portTIMER_0_CONTROL_REGISTER );
	usTimer0Control |= portTIMER_INTERRUPT_ENABLE;
	portOUTPUT_WORD( portTIMER_0_CONTROL_REGISTER, usTimer0Control );


	portENABLE_INTERRUPTS();

	/* This will free up all the memory used by the scheduler.
	exiting back to dos with INT21 AH=4CH will do this anyway so
	it is not necessary to call this. */
	vTaskCleanUpResources(); 
}
Ejemplo n.º 29
0
static int pc_init_vidmode ()
{
	union REGS r;
	int i;

	clock_count = 0;
	clock_ticks = 0;

	screen_buffer = calloc (GFX_WIDTH, GFX_HEIGHT);

	prev_08 = _dos_getvect (0x08);
	_dos_setvect (0x08, tick_increment);

	memset (&r, 0x0, sizeof(union REGS));
#ifdef __WATCOMC__
	r.w.ax = 0x13;
	int386 (0x10, &r, &r);
#endif

#ifdef __TURBOC__
	r.x.ax = 0x13;
	int86 (0x10, &r, &r);
#endif

	__outp (0x3c8, 0);
	for (i = 0; i < 32 * 3; i++)
		__outp (0x3c9, palette[i]);

	return err_OK;
}
Ejemplo n.º 30
0
void InitMSDOS(void)
{
#ifdef BPP8
  int J;
  /* Create RRR:GGG:BB static color palette in BPP8 mode */
  for(J=0;J<256;J++)
    SetPalette(J,(J>>5)*255/7,((J>>2)&0x07)*255/7,(J&0x03)*255/3);
#endif

  /* Initialize variables */
  IRQ1Old   = _dos_getvect(0x09);
  IRQ0Old   = 0;
  MouseON   = 0;
  SyncReady = 0;
  SyncFreq  = 0;
  VGAMode   = 0;
  JoyState  = 0;
  LastKey   = 0;
  KeyModes  = 0;
  SndRate   = 0;

  /* No output image yet */
  OutScreen.Data = 0;

  /* Install new keyboard interrupt */
  _dos_setvect(0x09,IRQ1Handler);
}