Exemplo n.º 1
0
void JCMouse::update(int newx, int newy, int new_but)
{

  int butn,xx,yy;
  if (newx<0)
  {
    if (here)
    {
      union REGS in,out;

      in.w.ax=0x0b;
      int386(0x33,&in,&out);    // get the mouse movement

      xx=(signed short)out.w.cx;
      yy=(signed short)out.w.dx;

      in.w.ax=5;                 // get the button press info
      in.w.bx=1|2|4;
      int386(0x33,&in,&out);
      butn=out.w.ax;
      

      lx=mx; ly=my; lbut=but;
      but=butn;
      mx+=xx;
      my+=yy;
      if (mx<0) mx=0;
      if (my<0) my=0;
      if (mx>=screen->width()) mx=screen->width()-1;
      if (my>=screen->height()) my=screen->height()-1;
    }
  } else
  { mx=newx; my=newy; but=new_but; }
}
Exemplo n.º 2
0
void vga_set_text_50()
{
	union REGS regs;

	regs.w.ax = 0x1202;
	regs.w.bx = 0x30;
	int386( 0x10, &regs, &regs );

	regs.w.ax = 3;
	int386( 0x10, &regs, &regs );

	regs.w.ax = 0x1112;
	regs.w.bx = 0x0;
	int386( 0x10, &regs, &regs );
}
Exemplo n.º 3
0
void gr_set_text_43()
{
	union REGS regs;

	regs.w.ax = 0x1201;
	regs.w.bx = 0x30;
	int386( 0x10, &regs, &regs );

	regs.w.ax = 3;
	int386( 0x10, &regs, &regs );

	regs.w.ax = 0x1112;
	regs.w.bx = 0x0;
	int386( 0x10, &regs, &regs );
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
  int _fast setfsize(int fd, long size)
  {
    union REGS r;
    long pos=tell(fd);

    lseek(fd, size, SEEK_SET);

  #ifdef __386__
    r.h.ah=0x40;
    r.x.ebx=fd;
    r.x.ecx=0;
    r.x.edx=0;

    int386(0x21, &r, &r);
  #else
    r.h.ah=0x40;
    r.x.bx=fd;
    r.x.cx=0;
    r.x.dx=0;

    int86(0x21, &r, &r);
  #endif

    lseek(fd, pos, SEEK_SET);

    return 0;
  }
Exemplo n.º 6
0
//
// D_DrawTitle
//
void D_DrawTitle(char *string, int bc, int tc)
{
	int color;
	int column;
	int row;
	int i;
	union REGS regs;

	//Calculate text color
	color = (tc << 4) | bc;

	//Get column position
	column = D_GetCursorColumn();

	//Get row position
	row = D_GetCursorRow();

	for (i = 0; i < strlen(string); i++)
	{
		//Set character
		regs.h.al = string[i];
		regs.h.ah = 9;
		regs.h.bl = color;
		regs.h.bh = 0;
		regs.w.cx = 1;
		int386(0x10, &regs, &regs);

		//Check cursor position
		if (++column >= 80)
			column = 0;

		//Set postition
		D_SetCursorPosition(column, row);
	}
}
Exemplo n.º 7
0
static unsigned short allocateTimerStack
   (
   unsigned short size
   )

   {
   union REGS regs;

   // clear all registers
   memset( &regs, 0, sizeof( regs ) );

   // DPMI allocate conventional memory
   regs.w.ax = 0x100;

   // size in paragraphs
   regs.w.bx = ( size + 15 ) / 16;

   int386( 0x31, &regs, &regs );
   if (!regs.w.cflag)
      {
      // DPMI call returns selector in dx
      // (ax contains real mode segment
      // which is ignored here)

      return( regs.w.dx );
      }

   // Couldn't allocate memory.
   return( NULL );
   }
Exemplo n.º 8
0
T_void DirectTalkPollData(T_void)
{
    const union REGS regs ;

    DebugRoutine("DirectTalkPollData") ;

    /* Request that any data that needs to be sent to us is done now. */
    G_talk->command = DIRECT_TALK_COMMAND_RECV ;
    G_talk->bufferFilled = FALSE ;

    /* Do the actual 32-bit interrupt call. */
    int386(
        G_talk->vector,
        &regs,
        &regs) ;

    if (G_talk->bufferFilled)  {
        /* Tell the DOS32 program that it just received data. */
        G_receiveCallback(
            G_talk->buffer,
            G_talk->bufferLength) ;
    }

    DebugEnd() ;
}
Exemplo n.º 9
0
void far *allocDOS (unsigned nbytes, short *pseg, short *psel)
{
   unsigned npara = (nbytes + 15) / 16;
   void far *pprot;
   pprot = NULL;
   *pseg = 0;        // assume will fail
   *psel = 0;

   // DPMI call 100h allocates DOS memory
   segread (&sregs);
   AX (regs) = 0x0100;        // DPMI: Allocate DOS Memory
   BX (regs) = npara;         // number of paragraphs to alloc
   int386( DPMI_INT, &regs, &regs);

   if (regs.w.cflag == 0)
   {
      *pseg = AX (regs);      // the real-mode segment
      *psel = DX (regs);      // equivalent protected-mode selector
      // pprot is the protected mode address of the same allocated block.
      // The Rational extender maps the 1 MB physical DOS memory into
      // the bottom of our virtual address space.
      pprot = (void far *) ((unsigned)*pseg << 4);
   }
   return pprot;
}
Exemplo n.º 10
0
void freeDOS (short sel)
{
   AX(regs) = 0x0101;      // DPMI free DOS memory
   DX(regs) = sel;

   int386( DPMI_INT, &regs, &regs);
}
Exemplo n.º 11
0
/*
** pciPhrlapGetSegmentLinearBase (_dx_tolinear)
*/
int pciPhrlapGetSegmentLinearBase( USHORT selector, ULONG* lin_addrp )
{
  union REGS r;

  /*
  ** Phar Lap 2508h - Get Segment Linear Base Address
  */
  r.w.ax = 0x2508;

  /*
  ** BX segment selector
  */
  r.w.bx = (unsigned short) selector;
  int386( PHARLAP_INTERRUPT, &r, &r );

  if ( r.w.cflag )
  {
    return PHARLAP_UNSPECIFIED_ERROR;
  }

  else
  {
    /*
    ** ECX linear base address of segment
    */
    *lin_addrp = (ULONG) r.x.ecx;
    return 0;
  }
}
Exemplo n.º 12
0
/*
** pciPhrlapWritePageTableEntry (_dx_wr_ptinfn)
*/
int pciPhrlapWritePageTableEntry( ULONG linadr, ULONG pte, ULONG ptinf )
{
  union REGS r;

  /*
  ** Phar Lap 252bh/10 - Write Page Table Entry and Associated Information
  */
  r.w.ax = 0x252b;
  r.h.bh = 0xa;
  r.h.bl = 0x0;     /* select linear */

  /*
  ** ECX linear address to read PTE for
  ** ESI page table entry
  ** EDI additional page table information
  */
  r.x.ecx = linadr;
  r.x.esi = pte;
  r.x.edi = ptinf;

  int386( PHARLAP_INTERRUPT, &r, &r );

  if ( r.w.cflag )
  {
    /*
    ** EAX error code
    */
    return r.x.eax;
  }

  else
  {
    return 0;
  }
}
Exemplo n.º 13
0
void main()
  {
    union REGS r;
    struct SREGS s;

    s.ds = s.es = s.fs = s.gs = FP_SEG( &s );

#if defined(__PHARLAP__)
    r.w.ax = 0x2503;    /* get real-mode vector */
    r.h.cl = 0x33;      /* interrupt vector 0x33 */
    int386( 0x21, &r, &r );
    printf( "mouse handler real-mode address="
            "%lx\n", r.x.ebx );
    r.w.ax = 0x2502;    /* get protected-mode vector */
    r.h.cl = 0x33;      /* interrupt vector 0x33 */
    int386x( 0x21, &r, &r, &s );
    printf( "mouse handler protected-mode address="
            "%x:%lx\n", s.es, r.x.ebx );

#else
    r.h.ah = 0x35;  /* get vector */
    r.h.al = 0x33;  /* vector 0x33 */
    int386x( 0x21, &r, &r, &s );
    printf( "mouse handler protected-mode address="
            "%x:%lx\n", s.es, r.x.ebx );
#endif
  }
Exemplo n.º 14
0
void MGenWakeupDll (void)
{
	REGISTERS	regs;

	regs.d.eax = MGENVXD_WAKEUPDLL_ORD << 16 | MGENVXD_DEVICE_ID;
	int386(CHUNNEL_INT, &regs, &regs);
}
Exemplo n.º 15
0
word IN_GetMouseButtons
(
    void
)

{
    word  buttons;
    union REGS inregs;
    union REGS outregs;

    if (!MousePresent || !mouseenabled)
        return (0);

    inregs.w.ax = MButtons;
    int386 (MouseInt, &inregs, &outregs);

    buttons = outregs.w.bx;

// Used by menu routines that need to wait for a button release.
// Sometimes the mouse driver misses an interrupt, so you can't wait for
// a button to be released.  Instead, you must ignore any buttons that
// are pressed.

    IgnoreMouse &= buttons;
    buttons &= ~IgnoreMouse;

    return (buttons);
}
Exemplo n.º 16
0
MVFunc *PAS_GetFunctionTable
   (
   void
   )

   {
   union REGS   regs;
   MVFunc *ptr;

   regs.w.ax = MV_GetPointerToFunctionTable;

   #ifdef __386__
      int386( MV_SoundInt, &regs, &regs );
   #else
      int86( MV_SoundInt, &regs, &regs );
   #endif

   if ( regs.w.ax != MV_Signature )
      {
      PAS_SetErrorCode( PAS_DriverNotFound );
      return( NULL );
      }

   #if defined(__WATCOMC__) && defined(__FLAT__)
      ptr = ( MVFunc * )( ( ( ( unsigned )regs.w.dx ) << 4 ) +
         ( ( unsigned )regs.w.bx ) );
   #else
      ptr = MK_FP( regs.w.dx, regs.w.bx );
   #endif

   return( ptr );
   }
Exemplo n.º 17
0
int curs_set( const int visibility)
{
    union _REGS regs;
    int start, end;

    switch (visibility)
    {
        case 0:  /* invisible */
            start = 32;
            end = 0;  /* was 32 */
            break;
        case 2:  /* highly visible */
            start = 0;   /* full-height block */
            end = 7;
            break;
        default:  /*' normal' visibility */
            start = 0;
            end = 31;
            break;
    }

    /* if scrnmode is not set, some BIOSes hang */

    regs.h.ah = 0x01;
    regs.h.al = (unsigned char)3;
    regs.h.ch = (unsigned char)start;
    regs.h.cl = (unsigned char)end;
    int386(0x10, &regs, &regs);

    return 1;
}
Exemplo n.º 18
0
uint32_t pci_read_cfg_BIOS(uint8_t bus,uint8_t card,uint8_t func,uint8_t reg,uint8_t size) {
	static const uint32_t msks[3] = {0xFFUL,0xFFFFUL,0xFFFFFFFFUL};
	union REGS regs;
	
	if (size > 2) return ~0UL;
#if TARGET_MSDOS == 16
	if (size == 2) { /* 32-bit DWORD read in real mode when Watcom won't let me use 386 style registers or int386() */
		return pci_bios_read_dword_16(
			/* BH=bus BL(7-3)=card BL(2-0)=func */
			(bus << 8) | (card << 3) | func,
			/* DI=reg */
			reg);
	}
#endif

	regs.w.ax = 0xB108 + size;
	regs.w.bx = (bus << 8) | (card << 3) | func;
	regs.w.di = reg;
#if TARGET_MSDOS == 32
	int386(0x1A,&regs,&regs);
#else
	int86(0x1A,&regs,&regs);
#endif
	if (regs.w.cflag & 1) /* carry flag set on error */
		return ~0UL;
	if (regs.h.ah != 0x00) /* AH=0x00 if success */
		return ~0UL;

#if TARGET_MSDOS == 32
	return regs.x.ecx & msks[size];
#else
	return regs.w.cx & msks[size];
#endif
}
Exemplo n.º 19
0
int PAS_CheckForDriver
   (
   void
   )

   {
   union REGS regs;
   unsigned   result;

   regs.w.ax = MV_CheckForDriver;
   regs.w.bx = 0x3f3f;

   #ifdef __386__
      int386( MV_SoundInt, &regs, &regs );
   #else
      int86( MV_SoundInt, &regs, &regs );
   #endif

   if ( regs.w.ax != MV_CheckForDriver )
      {
      PAS_SetErrorCode( PAS_DriverNotFound );
      return( PAS_Error );
      }

   result = regs.w.bx ^ regs.w.cx ^ regs.w.dx;
   if ( result != MV_Signature )
      {
      PAS_SetErrorCode( PAS_DriverNotFound );
      return( PAS_Error );
      }

   return( PAS_Ok );
   }
Exemplo n.º 20
0
void pci_write_cfg_BIOS(uint8_t bus,uint8_t card,uint8_t func,uint8_t reg,uint32_t data,uint8_t size) {
	union REGS regs;
	
	if (size > 2) return;
#if TARGET_MSDOS == 16
	if (size == 2) { /* 32-bit DWORD read in real mode when Watcom won't let me use 386 style registers or int386() */
		pci_bios_write_dword_16(
			/* BH=bus BL(7-3)=card BL(2-0)=func */
			(bus << 8) | (card << 3) | func,
			/* DI=reg */
			reg,
			/* data */
			data);
		return;
	}
#endif

	regs.w.ax = 0xB10B + size;
	regs.w.bx = (bus << 8) | (card << 3) | func;
	regs.w.di = reg;
#if TARGET_MSDOS == 32
	regs.x.ecx = data;
	int386(0x1A,&regs,&regs);
#else
	regs.w.cx = (uint16_t)data;
	int86(0x1A,&regs,&regs);
#endif
}
Exemplo n.º 21
0
void gr_set_3dbios_mode( uint mode )
{
	union REGS regs;
	memset( &regs, 0, sizeof(regs) );
	regs.w.ax = 0x4fd0;
	regs.w.bx = 0x3d00 | (mode & 0xff);
	int386( 0x10, &regs, &regs );
}
Exemplo n.º 22
0
int MGenWait (void)
{
	REGISTERS	regs;

	regs.d.eax = MGENVXD_WAIT_ORD << 16 | MGENVXD_DEVICE_ID;
	int386(CHUNNEL_INT, &regs, &regs);
	return regs.d.eax;
}
Exemplo n.º 23
0
void gr_setcursor(ubyte x, ubyte y, ubyte sline, ubyte eline)
{
	union REGS regs;

	memset( &regs, 0, sizeof(regs) );
	regs.w.ax = 0x0200;
	regs.w.bx = 0;
	regs.h.dh = y;
	regs.h.dl = x;
	int386( 0x10, &regs, &regs );

	memset( &regs, 0, sizeof(regs) );
	regs.w.ax = 0x0100;
	regs.h.ch = sline & 0xf;
	regs.h.cl = eline & 0xf;
	int386( 0x10, &regs, &regs );
}
Exemplo n.º 24
0
 mouse_detector()
 {
   union  REGS in,out;
   memset(&in,0,sizeof(in));
   in.w.ax=0;
   int386(0x33,&in,&out);
   detected=(((unsigned short)out.w.ax)==0xffff);
 } 
Exemplo n.º 25
0
ubyte vga_get_screen_mode( void )
{
	union REGS regs;

	regs.w.ax = 0x0f00;
	int386( 0x10, &regs, &regs );
	return regs.w.ax & 0xff;
}
Exemplo n.º 26
0
void vga_disable_default_palette_loading()
{
	union REGS regs;
	regs.w.ax = 0x1201;
	regs.w.bx = 0x31;
	int386( 0x10, &regs, &regs );
	vga_prevent_palette_loading = 1;
}
Exemplo n.º 27
0
void vga_set_cursor_type( uword ctype )
{
	union REGS regs;

	regs.w.ax = 0x0100;
	regs.w.cx = ctype;
	int386( 0x10, &regs, &regs );
}
Exemplo n.º 28
0
void InitMouse()
{
  memset(&regs, 0, sizeof regs);
  int386(0x33,&regs,&regs);

  regs.w.ax=7;
  regs.w.cx=0;
  regs.w.dx=640; /*320;*/ /* -- ric:13/Jun/98 - fix horizontal jumps -- */
  int386(0x33,&regs,&regs);

  regs.w.ax=8;
  regs.w.cx=0;
  regs.w.dx=sy; // aen
  int386(0x33,&regs,&regs);

  PutMouse(sx/2,(sy/2) /2); // aen
}
Exemplo n.º 29
0
void vga_set_text_25()
{
	union REGS regs;

	regs.w.ax = 3;
	int386( 0x10, &regs, &regs );

}
Exemplo n.º 30
0
void vga_set_misc_mode( uword mode )
{
	union REGS regs;

	regs.w.ax = mode;
	int386( 0x10, &regs, &regs );

}