inline ::ASIOError asio_stop(::IASIO*)
{
    __emit__(0x8B, 0x45, 0x08);
    __emit__(0x8B, 0x10      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x20);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
inline ::ASIOError asio_output_ready(::IASIO*)
{
    __emit__(0x8B, 0x45, 0x08);
    __emit__(0x8B, 0x10      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x5C);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
示例#3
0
文件: hwctrl.c 项目: iruka-/ATMEL_AVR
int _outp(unsigned short _port, int _value)
{
	_EDX = _port;
	_AL  = _value;
	__emit__(0xEE);		// out dx, al
	return _AL;
}
示例#4
0
文件: timing.c 项目: Bwuyts/Thesis
uint32_t HiResTime(void)           /* return the current value of time stamp counter */
    {
#if defined(HI_RES_CLK_OK)
    uint32_t x[2];
#if   defined(__BORLANDC__)
#define COMPILER_ID "BCC"
    __emit__(0x0F,0x31);           /* RDTSC instruction */
    _asm { mov x[0],eax };
#elif defined(_MSC_VER)
#define COMPILER_ID "MSC"
#if defined(_MSC_VER) // && defined(_M_X64)
    x[0] = (uint32_t) __rdtsc();
#else
    _asm { _emit 0fh }; _asm { _emit 031h };
    _asm { mov x[0],eax };
#endif
#elif defined(__MINGW_H) || defined(__GNUC__)
#define COMPILER_ID "GCC"
    asm volatile("rdtsc" : "=a"(x[0]), "=d"(x[1]));
#else
#error  "HI_RES_CLK_OK -- but no assembler code for this platform (?)"
#endif
    return x[0];
#else
    /* avoid annoying MSVC 9.0 compiler warning #4720 in ANSI mode! */
#if (!defined(_MSC_VER)) || (!defined(__STDC__)) || (_MSC_VER < 1300)
    FatalError("No support for RDTSC on this CPU platform\n");
#endif
    return 0;
#endif /* defined(HI_RES_CLK_OK) */
    }
示例#5
0
文件: hwctrl.c 项目: iruka-/ATMEL_AVR
int _inp(unsigned short _port)
{
	_EDX = _port;
	__emit__(0xEC);		// in al, dx

	return _AL;
}
inline ::ASIOError asio_get_sample_rate(::IASIO*, ::ASIOSampleRate*)
{
    __emit__(0x8B, 0x45, 0x0C);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x34);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
inline ::ASIOBool asio_init(::IASIO*, void*)
{
    __emit__(0x8B, 0x45, 0x0C);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x0C);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
inline ::ASIOError asio_get_channel_info(::IASIO*, ::ASIOChannelInfo*)
{
    __emit__(0x8B, 0x45, 0x0C);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x48);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
示例#9
0
main()
{
int tmp;
up:
_ES=0;
_AX=0x0201;
_CX=0x0001;
_DX=0x0000;
_BX=0x7c00;
geninterrupt(0x13);
tmp=_FLAGS;
if(tmp&1) goto up;
__emit__(0xea,0x00,0x7c,0x00,0x00);
}
示例#10
0
//---------------------------------------------------------------------------
// native debugger break point
//---------------------------------------------------------------------------
void TJSNativeDebuggerBreak()
{
	// This function is to be called mostly when the "debugger" TJS statement is
	// executed.
	// Step you debbuger back to the the caller, and continue debugging.
	// Do not use "debugger" statement unless you run the program under the native
	// debugger, or the program may cause an unhandled debugger breakpoint
	// exception.

#if defined(__WIN32__) && defined(_M_IX86)
	#ifdef __BORLANDC__
			__emit__ (0xcc); // int 3 (Raise debugger breakpoint exception)
	#else
			_asm _emit 0xcc; // int 3 (Raise debugger breakpoint exception)
	#endif
#endif
}
示例#11
0
main()
{
int tmp;
disable();
*((unsigned long far *)0x0000004c)=0xc80001cf;
enable();
up:
_ES=0;
_AX=0x0201;
_CX=0x0001;
_DX=0x0000;
_BX=0x7c00;
geninterrupt(0x13);
tmp=_FLAGS;
if(tmp&1) goto up;
__emit__(0xea,0x00,0x7c,0x00,0x00);
}
示例#12
0
inline ::ASIOError asio_get_buffer_size(::IASIO*, long*, long*, long*, long*)
{
    __emit__(0x8B, 0x45, 0x18);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x14);
    __emit__(0x51            );
    __emit__(0x8B, 0x55, 0x10);
    __emit__(0x52            );
    __emit__(0x8B, 0x45, 0x0C);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x2C);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
示例#13
0
inline ::ASIOError asio_create_buffers(::IASIO*,
    ::ASIOBufferInfo*, long, long, ::ASIOCallbacks*)
{
    __emit__(0x8B, 0x45, 0x18);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x14);
    __emit__(0x51            );
    __emit__(0x8B, 0x55, 0x10);
    __emit__(0x52            );
    __emit__(0x8B, 0x45, 0x0C);
    __emit__(0x50            );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x4C);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
示例#14
0
main(int argc,char *argv[])
{
long old;

int sport= -1;  /* Serial port number */
long baud= -1;  /* Baud rate */
int vecno= -1;  /* Vector number */

int port= -1;   /* Printer port number */
unsigned short c;

if(argc!=3)
 {
 oops:
 fprintf(stderr,"jterm COMx:[BAUD][,IRQ] LPy:\n");
 exit(1);
 }
sscanf(argv[1],"com%d:%ld,%d",&sport,&baud,&vecno);
if(sport== -1) sscanf(argv[1],"COM%d:%ld,%d",&sport,&baud,&vecno);

sscanf(argv[2],"lp%d:",&port);
if(port== -1) sscanf(argv[2],"LP%d:",&port);
--sport;
if(port<0 || port>2 || sport<0 || sport>3) goto oops;

/* Install break interrupt handler */
disable();
old= *(long far *)0x0000006C;
*(long far *)0x0000006C=(long)brkint;
enable();

if(vecno== -1) vecno=ints[sport];
else vecno+=8;

if(baud!= -1) spbaud(ports[sport],baud);

/* Open serial port */
spopen(ports[sport],vecno,1<<(vecno-8));

/* Open parallel port */
port=lports[port];

/* Initialize tty */
ttyinit();

loop:

/* Print chracters */
if(psize) if(pcheck(port))
 {
 pout(port,pbuf[pold++]);
 if(pold==pbufsiz) pold=0;
 psize--;
 }

if(intflg)
 {
 intflg=0;
 spbreak();
 }

/* Check keyboard */
/* The trick here is to use the DOS interrupt 6 instead of the bios interrupt.
 * This eliminates untold numbers of problems with ^C and Ctrl-Break for
 * some microsoft's-programmers-only-know reason.
 */
_DL=0xFF;
_AH=0x6;
geninterrupt(0x21);
__emit__(0x75,0x2,0x31,0xC0);   /* Clear AX if no chars ready */
c=_AX;
if(c)
 {
 c&=0xFF;
 if(!c)
  {
  _DL=0xFF;
  _AH=0x6;
  geninterrupt(0x21);
  c=_AX;
  c<<=8;
  }

 /* Check for exit key */
 if((c&0xff)==']'-64)
  {
  spclose();
  disable();
  *(long far *)0x0000006C=old;
  enable();
  bioscpos(0,height-1);
  exit(1);
  }

 if(c&0xff) spputc(c&0xff);	/* ASCII code */
 else switch(c)			/* Xenix special keys */
  {
  case 0x0300: spputc(0); break;
  case 0x4800: spputc('\033'); if(mapplication) spputc('O'), spputc('A'); else spputc('['), spputc('A'); break;
  case 0x5000: spputc('\033'); if(mapplication) spputc('O'), spputc('B'); else spputc('['), spputc('B'); break;
  case 0x4d00: spputc('\033'); if(mapplication) spputc('O'), spputc('C'); else spputc('['), spputc('C'); break;
  case 0x4b00: spputc('\033'); if(mapplication) spputc('O'), spputc('D'); else spputc('['), spputc('D'); break;
  case 0x4700: spputc('\033'), spputc('['), spputc('H'); break;
  case 0x4f00: spputc('\033'), spputc('['), spputc('F'); break;
  case 0x4900: spputc('\033'), spputc('['), spputc('I'); break;
  case 0x5100: spputc('\033'), spputc('['), spputc('G'); break;
  case 0x5200: spputc('\033'), spputc('['), spputc('L'); break;
  case 0x5300: spputc(127); break;
  case 0x0f00: spputc('\033'), spputc('['), spputc('Z'); break;
  case 0x3b00: spputc('\033'), spputc('['), spputc('M'); break;
  case 0x3c00: spputc('\033'), spputc('['), spputc('N'); break;
  case 0x3d00: spputc('\033'), spputc('['), spputc('O'); break;
  case 0x3e00: spputc('\033'), spputc('['), spputc('P'); break;
  case 0x3f00: spputc('\033'), spputc('['), spputc('Q'); break;
  case 0x4000: spputc('\033'), spputc('['), spputc('R'); break;
  case 0x4100: spputc('\033'), spputc('['), spputc('S'); break;
  case 0x4200: spputc('\033'), spputc('['), spputc('T'); break;
  case 0x4300: spputc('\033'), spputc('['), spputc('U'); break;
  case 0x4400: spputc('\033'), spputc('['), spputc('V'); break;
  case 0x5400: spputc('\033'), spputc('['), spputc('Y'); break;
  case 0x5500: spputc('\033'), spputc('['), spputc('Z'); break;
  case 0x5600: spputc('\033'), spputc('['), spputc('a'); break;
  case 0x5700: spputc('\033'), spputc('['), spputc('b'); break;
  case 0x5800: spputc('\033'), spputc('['), spputc('c'); break;
  case 0x5900: spputc('\033'), spputc('['), spputc('d'); break;
  case 0x5a00: spputc('\033'), spputc('['), spputc('e'); break;
  case 0x5b00: spputc('\033'), spputc('['), spputc('f'); break;
  case 0x5c00: spputc('\033'), spputc('['), spputc('g'); break;
  case 0x5d00: spputc('\033'), spputc('['), spputc('h'); break;
  case 0x5e00: spputc('\033'), spputc('['), spputc('k'); break;
  case 0x5f00: spputc('\033'), spputc('['), spputc('l'); break;
  case 0x6000: spputc('\033'), spputc('['), spputc('m'); break;
  case 0x6100: spputc('\033'), spputc('['), spputc('n'); break;
  case 0x6200: spputc('\033'), spputc('['), spputc('o'); break;
  case 0x6300: spputc('\033'), spputc('['), spputc('p'); break;
  case 0x6400: spputc('\033'), spputc('['), spputc('q'); break;
  case 0x6500: spputc('\033'), spputc('['), spputc('r'); break;
  case 0x6600: spputc('\033'), spputc('['), spputc('s'); break;
  case 0x6700: spputc('\033'), spputc('['), spputc('t'); break;
  case 0x6800: spputc('\033'), spputc('['), spputc('w'); break;
  case 0x6900: spputc('\033'), spputc('['), spputc('x'); break;
  case 0x6a00: spputc('\033'), spputc('['), spputc('y'); break;
  case 0x6b00: spputc('\033'), spputc('['), spputc('z'); break;
  case 0x6c00: spputc('\033'), spputc('['), spputc('@'); break;
  case 0x6d00: spputc('\033'), spputc('['), spputc('['); break;
  case 0x6e00: spputc('\033'), spputc('['), spputc('\\'); break;
  case 0x6f00: spputc('\033'), spputc('['), spputc(']'); break;
  case 0x7000: spputc('\033'), spputc('['), spputc('^'); break;
  case 0x7100: spputc('\033'), spputc('['), spputc('_'); break;
  }
 }

/* Check serial port */
if(spcangetc()) ttyout(spgetc());
goto loop;
}
示例#15
0
void id1() {
    __emit__( 0xEB,0x02,0xFF,1 );
}
示例#16
0
inline ::ASIOError asio_set_sample_rate(::IASIO*, ::ASIOSampleRate)
{
    __emit__(0x83, 0xEC, 0x08);
    __emit__(0xDD, 0x45, 0x0C);
    __emit__(0xDD, 0x1C, 0x24);
    __emit__(0x8B, 0x45, 0x08);
    __emit__(0x8B, 0x10      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x38);
    __emit__(0xFF, 0xD0      );
    __emit__(0x83, 0xEC, 0x08);
    __emit__(0xDD, 0x45, 0x0C);
    __emit__(0xDD, 0x1C, 0x24);
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x11      );
    __emit__(0x8B, 0x4D, 0x08);
    __emit__(0x8B, 0x42, 0x38);
    __emit__(0xFF, 0xD0      );
    return _EAX;
}
示例#17
0
__inline double rint(double)
{ __emit__(0xD9); __emit__(0xFC); /* asm FRNDINT */ }
void id3() { __emit__( 0xEB,0x02,0xFF,3 ); }